claude-threads 1.38.0 → 1.38.1

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
@@ -2514,20 +2514,487 @@ var init_types = __esm(() => {
2514
2514
  };
2515
2515
  });
2516
2516
 
2517
- // src/utils/spawn.ts
2518
- import { spawn as nodeSpawn, spawnSync as nodeSpawnSync } from "child_process";
2519
- function addWindowsShell(options) {
2520
- if (isWindows && options.shell === undefined) {
2521
- return { ...options, shell: true };
2517
+ // node_modules/isexe/windows.js
2518
+ var require_windows = __commonJS(function(exports, module) {
2519
+ module.exports = isexe;
2520
+ isexe.sync = sync;
2521
+ var fs = __require("fs");
2522
+ function checkPathExt(path, options) {
2523
+ var pathext = options.pathExt !== undefined ? options.pathExt : process.env.PATHEXT;
2524
+ if (!pathext) {
2525
+ return true;
2526
+ }
2527
+ pathext = pathext.split(";");
2528
+ if (pathext.indexOf("") !== -1) {
2529
+ return true;
2530
+ }
2531
+ for (var i = 0;i < pathext.length; i++) {
2532
+ var p = pathext[i].toLowerCase();
2533
+ if (p && path.substr(-p.length).toLowerCase() === p) {
2534
+ return true;
2535
+ }
2536
+ }
2537
+ return false;
2522
2538
  }
2523
- return options;
2524
- }
2539
+ function checkStat(stat, path, options) {
2540
+ if (!stat.isSymbolicLink() && !stat.isFile()) {
2541
+ return false;
2542
+ }
2543
+ return checkPathExt(path, options);
2544
+ }
2545
+ function isexe(path, options, cb) {
2546
+ fs.stat(path, function(er, stat) {
2547
+ cb(er, er ? false : checkStat(stat, path, options));
2548
+ });
2549
+ }
2550
+ function sync(path, options) {
2551
+ return checkStat(fs.statSync(path), path, options);
2552
+ }
2553
+ });
2554
+
2555
+ // node_modules/isexe/mode.js
2556
+ var require_mode = __commonJS(function(exports, module) {
2557
+ module.exports = isexe;
2558
+ isexe.sync = sync;
2559
+ var fs = __require("fs");
2560
+ function isexe(path, options, cb) {
2561
+ fs.stat(path, function(er, stat) {
2562
+ cb(er, er ? false : checkStat(stat, options));
2563
+ });
2564
+ }
2565
+ function sync(path, options) {
2566
+ return checkStat(fs.statSync(path), options);
2567
+ }
2568
+ function checkStat(stat, options) {
2569
+ return stat.isFile() && checkMode(stat, options);
2570
+ }
2571
+ function checkMode(stat, options) {
2572
+ var mod = stat.mode;
2573
+ var uid = stat.uid;
2574
+ var gid = stat.gid;
2575
+ var myUid = options.uid !== undefined ? options.uid : process.getuid && process.getuid();
2576
+ var myGid = options.gid !== undefined ? options.gid : process.getgid && process.getgid();
2577
+ var u = parseInt("100", 8);
2578
+ var g = parseInt("010", 8);
2579
+ var o = parseInt("001", 8);
2580
+ var ug = u | g;
2581
+ var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
2582
+ return ret;
2583
+ }
2584
+ });
2585
+
2586
+ // node_modules/isexe/index.js
2587
+ var require_isexe = __commonJS(function(exports, module) {
2588
+ var fs = __require("fs");
2589
+ var core;
2590
+ if (process.platform === "win32" || global.TESTING_WINDOWS) {
2591
+ core = require_windows();
2592
+ } else {
2593
+ core = require_mode();
2594
+ }
2595
+ module.exports = isexe;
2596
+ isexe.sync = sync;
2597
+ function isexe(path, options, cb) {
2598
+ if (typeof options === "function") {
2599
+ cb = options;
2600
+ options = {};
2601
+ }
2602
+ if (!cb) {
2603
+ if (typeof Promise !== "function") {
2604
+ throw new TypeError("callback not provided");
2605
+ }
2606
+ return new Promise(function(resolve, reject) {
2607
+ isexe(path, options || {}, function(er, is) {
2608
+ if (er) {
2609
+ reject(er);
2610
+ } else {
2611
+ resolve(is);
2612
+ }
2613
+ });
2614
+ });
2615
+ }
2616
+ core(path, options || {}, function(er, is) {
2617
+ if (er) {
2618
+ if (er.code === "EACCES" || options && options.ignoreErrors) {
2619
+ er = null;
2620
+ is = false;
2621
+ }
2622
+ }
2623
+ cb(er, is);
2624
+ });
2625
+ }
2626
+ function sync(path, options) {
2627
+ try {
2628
+ return core.sync(path, options || {});
2629
+ } catch (er) {
2630
+ if (options && options.ignoreErrors || er.code === "EACCES") {
2631
+ return false;
2632
+ } else {
2633
+ throw er;
2634
+ }
2635
+ }
2636
+ }
2637
+ });
2638
+
2639
+ // node_modules/which/which.js
2640
+ var require_which = __commonJS(function(exports, module) {
2641
+ var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
2642
+ var path = __require("path");
2643
+ var COLON = isWindows ? ";" : ":";
2644
+ var isexe = require_isexe();
2645
+ var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
2646
+ var getPathInfo = (cmd, opt) => {
2647
+ const colon = opt.colon || COLON;
2648
+ const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
2649
+ ...isWindows ? [process.cwd()] : [],
2650
+ ...(opt.path || process.env.PATH || "").split(colon)
2651
+ ];
2652
+ const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
2653
+ const pathExt = isWindows ? pathExtExe.split(colon) : [""];
2654
+ if (isWindows) {
2655
+ if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
2656
+ pathExt.unshift("");
2657
+ }
2658
+ return {
2659
+ pathEnv,
2660
+ pathExt,
2661
+ pathExtExe
2662
+ };
2663
+ };
2664
+ var which = (cmd, opt, cb) => {
2665
+ if (typeof opt === "function") {
2666
+ cb = opt;
2667
+ opt = {};
2668
+ }
2669
+ if (!opt)
2670
+ opt = {};
2671
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
2672
+ const found = [];
2673
+ const step = (i) => new Promise((resolve, reject) => {
2674
+ if (i === pathEnv.length)
2675
+ return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
2676
+ const ppRaw = pathEnv[i];
2677
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
2678
+ const pCmd = path.join(pathPart, cmd);
2679
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
2680
+ resolve(subStep(p, i, 0));
2681
+ });
2682
+ const subStep = (p, i, ii) => new Promise((resolve, reject) => {
2683
+ if (ii === pathExt.length)
2684
+ return resolve(step(i + 1));
2685
+ const ext = pathExt[ii];
2686
+ isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
2687
+ if (!er && is) {
2688
+ if (opt.all)
2689
+ found.push(p + ext);
2690
+ else
2691
+ return resolve(p + ext);
2692
+ }
2693
+ return resolve(subStep(p, i, ii + 1));
2694
+ });
2695
+ });
2696
+ return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
2697
+ };
2698
+ var whichSync = (cmd, opt) => {
2699
+ opt = opt || {};
2700
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
2701
+ const found = [];
2702
+ for (let i = 0;i < pathEnv.length; i++) {
2703
+ const ppRaw = pathEnv[i];
2704
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
2705
+ const pCmd = path.join(pathPart, cmd);
2706
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
2707
+ for (let j = 0;j < pathExt.length; j++) {
2708
+ const cur = p + pathExt[j];
2709
+ try {
2710
+ const is = isexe.sync(cur, { pathExt: pathExtExe });
2711
+ if (is) {
2712
+ if (opt.all)
2713
+ found.push(cur);
2714
+ else
2715
+ return cur;
2716
+ }
2717
+ } catch (ex) {}
2718
+ }
2719
+ }
2720
+ if (opt.all && found.length)
2721
+ return found;
2722
+ if (opt.nothrow)
2723
+ return null;
2724
+ throw getNotFoundError(cmd);
2725
+ };
2726
+ module.exports = which;
2727
+ which.sync = whichSync;
2728
+ });
2729
+
2730
+ // node_modules/path-key/index.js
2731
+ var require_path_key = __commonJS(function(exports, module) {
2732
+ var pathKey = (options = {}) => {
2733
+ const environment = options.env || process.env;
2734
+ const platform = options.platform || process.platform;
2735
+ if (platform !== "win32") {
2736
+ return "PATH";
2737
+ }
2738
+ return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
2739
+ };
2740
+ module.exports = pathKey;
2741
+ module.exports.default = pathKey;
2742
+ });
2743
+
2744
+ // node_modules/cross-spawn/lib/util/resolveCommand.js
2745
+ var require_resolveCommand = __commonJS(function(exports, module) {
2746
+ var path = __require("path");
2747
+ var which = require_which();
2748
+ var getPathKey = require_path_key();
2749
+ function resolveCommandAttempt(parsed, withoutPathExt) {
2750
+ const env = parsed.options.env || process.env;
2751
+ const cwd = process.cwd();
2752
+ const hasCustomCwd = parsed.options.cwd != null;
2753
+ const shouldSwitchCwd = hasCustomCwd && process.chdir !== undefined && !process.chdir.disabled;
2754
+ if (shouldSwitchCwd) {
2755
+ try {
2756
+ process.chdir(parsed.options.cwd);
2757
+ } catch (err) {}
2758
+ }
2759
+ let resolved;
2760
+ try {
2761
+ resolved = which.sync(parsed.command, {
2762
+ path: env[getPathKey({ env })],
2763
+ pathExt: withoutPathExt ? path.delimiter : undefined
2764
+ });
2765
+ } catch (e) {} finally {
2766
+ if (shouldSwitchCwd) {
2767
+ process.chdir(cwd);
2768
+ }
2769
+ }
2770
+ if (resolved) {
2771
+ resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
2772
+ }
2773
+ return resolved;
2774
+ }
2775
+ function resolveCommand(parsed) {
2776
+ return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
2777
+ }
2778
+ module.exports = resolveCommand;
2779
+ });
2780
+
2781
+ // node_modules/cross-spawn/lib/util/escape.js
2782
+ var require_escape = __commonJS(function(exports, module) {
2783
+ var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
2784
+ function escapeCommand(arg) {
2785
+ arg = arg.replace(metaCharsRegExp, "^$1");
2786
+ return arg;
2787
+ }
2788
+ function escapeArgument(arg, doubleEscapeMetaChars) {
2789
+ arg = `${arg}`;
2790
+ arg = arg.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
2791
+ arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
2792
+ arg = `"${arg}"`;
2793
+ arg = arg.replace(metaCharsRegExp, "^$1");
2794
+ if (doubleEscapeMetaChars) {
2795
+ arg = arg.replace(metaCharsRegExp, "^$1");
2796
+ }
2797
+ return arg;
2798
+ }
2799
+ exports.command = escapeCommand;
2800
+ exports.argument = escapeArgument;
2801
+ });
2802
+
2803
+ // node_modules/shebang-regex/index.js
2804
+ var require_shebang_regex = __commonJS(function(exports, module) {
2805
+ module.exports = /^#!(.*)/;
2806
+ });
2807
+
2808
+ // node_modules/shebang-command/index.js
2809
+ var require_shebang_command = __commonJS(function(exports, module) {
2810
+ var shebangRegex = require_shebang_regex();
2811
+ module.exports = (string = "") => {
2812
+ const match = string.match(shebangRegex);
2813
+ if (!match) {
2814
+ return null;
2815
+ }
2816
+ const [path, argument] = match[0].replace(/#! ?/, "").split(" ");
2817
+ const binary = path.split("/").pop();
2818
+ if (binary === "env") {
2819
+ return argument;
2820
+ }
2821
+ return argument ? `${binary} ${argument}` : binary;
2822
+ };
2823
+ });
2824
+
2825
+ // node_modules/cross-spawn/lib/util/readShebang.js
2826
+ var require_readShebang = __commonJS(function(exports, module) {
2827
+ var fs = __require("fs");
2828
+ var shebangCommand = require_shebang_command();
2829
+ function readShebang(command) {
2830
+ const size = 150;
2831
+ const buffer = Buffer.alloc(size);
2832
+ let fd;
2833
+ try {
2834
+ fd = fs.openSync(command, "r");
2835
+ fs.readSync(fd, buffer, 0, size, 0);
2836
+ fs.closeSync(fd);
2837
+ } catch (e) {}
2838
+ return shebangCommand(buffer.toString());
2839
+ }
2840
+ module.exports = readShebang;
2841
+ });
2842
+
2843
+ // node_modules/cross-spawn/lib/parse.js
2844
+ var require_parse = __commonJS(function(exports, module) {
2845
+ var path = __require("path");
2846
+ var resolveCommand = require_resolveCommand();
2847
+ var escape = require_escape();
2848
+ var readShebang = require_readShebang();
2849
+ var isWin = process.platform === "win32";
2850
+ var isExecutableRegExp = /\.(?:com|exe)$/i;
2851
+ var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
2852
+ function detectShebang(parsed) {
2853
+ parsed.file = resolveCommand(parsed);
2854
+ const shebang = parsed.file && readShebang(parsed.file);
2855
+ if (shebang) {
2856
+ parsed.args.unshift(parsed.file);
2857
+ parsed.command = shebang;
2858
+ return resolveCommand(parsed);
2859
+ }
2860
+ return parsed.file;
2861
+ }
2862
+ function parseNonShell(parsed) {
2863
+ if (!isWin) {
2864
+ return parsed;
2865
+ }
2866
+ const commandFile = detectShebang(parsed);
2867
+ const needsShell = !isExecutableRegExp.test(commandFile);
2868
+ if (parsed.options.forceShell || needsShell) {
2869
+ const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
2870
+ parsed.command = path.normalize(parsed.command);
2871
+ parsed.command = escape.command(parsed.command);
2872
+ parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
2873
+ const shellCommand = [parsed.command].concat(parsed.args).join(" ");
2874
+ parsed.args = ["/d", "/s", "/c", `"${shellCommand}"`];
2875
+ parsed.command = process.env.comspec || "cmd.exe";
2876
+ parsed.options.windowsVerbatimArguments = true;
2877
+ }
2878
+ return parsed;
2879
+ }
2880
+ function parse(command, args, options) {
2881
+ if (args && !Array.isArray(args)) {
2882
+ options = args;
2883
+ args = null;
2884
+ }
2885
+ args = args ? args.slice(0) : [];
2886
+ options = Object.assign({}, options);
2887
+ const parsed = {
2888
+ command,
2889
+ args,
2890
+ options,
2891
+ file: undefined,
2892
+ original: {
2893
+ command,
2894
+ args
2895
+ }
2896
+ };
2897
+ return options.shell ? parsed : parseNonShell(parsed);
2898
+ }
2899
+ module.exports = parse;
2900
+ });
2901
+
2902
+ // node_modules/cross-spawn/lib/enoent.js
2903
+ var require_enoent = __commonJS(function(exports, module) {
2904
+ var isWin = process.platform === "win32";
2905
+ function notFoundError(original, syscall) {
2906
+ return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
2907
+ code: "ENOENT",
2908
+ errno: "ENOENT",
2909
+ syscall: `${syscall} ${original.command}`,
2910
+ path: original.command,
2911
+ spawnargs: original.args
2912
+ });
2913
+ }
2914
+ function hookChildProcess(cp, parsed) {
2915
+ if (!isWin) {
2916
+ return;
2917
+ }
2918
+ const originalEmit = cp.emit;
2919
+ cp.emit = function(name, arg1) {
2920
+ if (name === "exit") {
2921
+ const err = verifyENOENT(arg1, parsed);
2922
+ if (err) {
2923
+ return originalEmit.call(cp, "error", err);
2924
+ }
2925
+ }
2926
+ return originalEmit.apply(cp, arguments);
2927
+ };
2928
+ }
2929
+ function verifyENOENT(status, parsed) {
2930
+ if (isWin && status === 1 && !parsed.file) {
2931
+ return notFoundError(parsed.original, "spawn");
2932
+ }
2933
+ return null;
2934
+ }
2935
+ function verifyENOENTSync(status, parsed) {
2936
+ if (isWin && status === 1 && !parsed.file) {
2937
+ return notFoundError(parsed.original, "spawnSync");
2938
+ }
2939
+ return null;
2940
+ }
2941
+ module.exports = {
2942
+ hookChildProcess,
2943
+ verifyENOENT,
2944
+ verifyENOENTSync,
2945
+ notFoundError
2946
+ };
2947
+ });
2948
+
2949
+ // node_modules/cross-spawn/index.js
2950
+ var require_cross_spawn = __commonJS(function(exports, module) {
2951
+ var cp = __require("child_process");
2952
+ var parse = require_parse();
2953
+ var enoent = require_enoent();
2954
+ function spawn(command, args, options) {
2955
+ const parsed = parse(command, args, options);
2956
+ const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
2957
+ enoent.hookChildProcess(spawned, parsed);
2958
+ return spawned;
2959
+ }
2960
+ function spawnSync(command, args, options) {
2961
+ const parsed = parse(command, args, options);
2962
+ const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
2963
+ result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
2964
+ return result;
2965
+ }
2966
+ module.exports = spawn;
2967
+ module.exports.spawn = spawn;
2968
+ module.exports.sync = spawnSync;
2969
+ module.exports._parse = parse;
2970
+ module.exports._enoent = enoent;
2971
+ });
2972
+
2973
+ // src/utils/spawn.ts
2974
+ import { win32 as win32Path } from "path";
2525
2975
  function crossSpawn(command, args, options) {
2526
- return nodeSpawn(command, args, addWindowsShell(options ?? {}));
2976
+ return import_cross_spawn.default(command, args, options ?? {});
2977
+ }
2978
+ function crossSpawnSync(command, args, options) {
2979
+ return import_cross_spawn.default.sync(command, args, options ?? {});
2980
+ }
2981
+ function findWindowsGitBash(env, exists) {
2982
+ const systemRoot = (env.SystemRoot ?? env.SYSTEMROOT ?? "C:\\Windows").toLowerCase();
2983
+ const isWslLauncher = (dir) => {
2984
+ const lower = dir.toLowerCase().replace(/[\\/]+$/, "");
2985
+ return lower.startsWith(`${systemRoot}\\system32`) || lower.startsWith(`${systemRoot}\\sysnative`) || lower.endsWith("\\windowsapps");
2986
+ };
2987
+ const pathDirs = (env.PATH ?? env.Path ?? "").split(";").filter(Boolean);
2988
+ const candidates = [
2989
+ ...pathDirs.filter((dir) => !isWslLauncher(dir)).map((dir) => win32Path.join(dir, "bash.exe")),
2990
+ ...[env.ProgramFiles, env.ProgramW6432, env["ProgramFiles(x86)"]].filter((dir) => Boolean(dir)).map((dir) => win32Path.join(dir, "Git", "bin", "bash.exe")),
2991
+ ...env.LOCALAPPDATA ? [win32Path.join(env.LOCALAPPDATA, "Programs", "Git", "bin", "bash.exe")] : []
2992
+ ];
2993
+ return candidates.find((candidate) => exists(candidate)) ?? null;
2527
2994
  }
2528
- var isWindows;
2995
+ var import_cross_spawn;
2529
2996
  var init_spawn = __esm(() => {
2530
- isWindows = process.platform === "win32";
2997
+ import_cross_spawn = __toESM(require_cross_spawn(), 1);
2531
2998
  });
2532
2999
 
2533
3000
  // node_modules/semver/internal/constants.js
@@ -2970,7 +3437,7 @@ var require_semver = __commonJS(function(exports, module) {
2970
3437
  });
2971
3438
 
2972
3439
  // node_modules/semver/functions/parse.js
2973
- var require_parse = __commonJS(function(exports, module) {
3440
+ var require_parse2 = __commonJS(function(exports, module) {
2974
3441
  var SemVer = require_semver();
2975
3442
  var parse = (version, options, throwErrors = false) => {
2976
3443
  if (version instanceof SemVer) {
@@ -2990,7 +3457,7 @@ var require_parse = __commonJS(function(exports, module) {
2990
3457
 
2991
3458
  // node_modules/semver/functions/valid.js
2992
3459
  var require_valid = __commonJS(function(exports, module) {
2993
- var parse = require_parse();
3460
+ var parse = require_parse2();
2994
3461
  var valid = (version, options) => {
2995
3462
  const v = parse(version, options);
2996
3463
  return v ? v.version : null;
@@ -3000,7 +3467,7 @@ var require_valid = __commonJS(function(exports, module) {
3000
3467
 
3001
3468
  // node_modules/semver/functions/clean.js
3002
3469
  var require_clean = __commonJS(function(exports, module) {
3003
- var parse = require_parse();
3470
+ var parse = require_parse2();
3004
3471
  var clean = (version, options) => {
3005
3472
  const s = parse(version.trim().replace(/^[=v]+/, ""), options);
3006
3473
  return s ? s.version : null;
@@ -3028,7 +3495,7 @@ var require_inc = __commonJS(function(exports, module) {
3028
3495
 
3029
3496
  // node_modules/semver/functions/diff.js
3030
3497
  var require_diff = __commonJS(function(exports, module) {
3031
- var parse = require_parse();
3498
+ var parse = require_parse2();
3032
3499
  var diff = (version1, version2) => {
3033
3500
  const v1 = parse(version1, null, true);
3034
3501
  const v2 = parse(version2, null, true);
@@ -3090,7 +3557,7 @@ var require_patch = __commonJS(function(exports, module) {
3090
3557
 
3091
3558
  // node_modules/semver/functions/prerelease.js
3092
3559
  var require_prerelease = __commonJS(function(exports, module) {
3093
- var parse = require_parse();
3560
+ var parse = require_parse2();
3094
3561
  var prerelease = (version, options) => {
3095
3562
  const parsed = parse(version, options);
3096
3563
  return parsed && parsed.prerelease.length ? parsed.prerelease : null;
@@ -3236,7 +3703,7 @@ var require_cmp = __commonJS(function(exports, module) {
3236
3703
  // node_modules/semver/functions/coerce.js
3237
3704
  var require_coerce = __commonJS(function(exports, module) {
3238
3705
  var SemVer = require_semver();
3239
- var parse = require_parse();
3706
+ var parse = require_parse2();
3240
3707
  var { safeRe: re, t } = require_re();
3241
3708
  var coerce = (version, options) => {
3242
3709
  if (version instanceof SemVer) {
@@ -3278,7 +3745,7 @@ var require_coerce = __commonJS(function(exports, module) {
3278
3745
 
3279
3746
  // node_modules/semver/functions/truncate.js
3280
3747
  var require_truncate = __commonJS(function(exports, module) {
3281
- var parse = require_parse();
3748
+ var parse = require_parse2();
3282
3749
  var constants = require_constants();
3283
3750
  var SemVer = require_semver();
3284
3751
  var truncate = (version, truncation, options) => {
@@ -4286,7 +4753,7 @@ var require_semver2 = __commonJS(function(exports, module) {
4286
4753
  var constants = require_constants();
4287
4754
  var SemVer = require_semver();
4288
4755
  var identifiers = require_identifiers();
4289
- var parse = require_parse();
4756
+ var parse = require_parse2();
4290
4757
  var valid = require_valid();
4291
4758
  var clean = require_clean();
4292
4759
  var inc = require_inc();
@@ -55272,7 +55739,7 @@ import process8 from "node:process";
55272
55739
  import path9 from "node:path";
55273
55740
  import os4 from "node:os";
55274
55741
  import fs4 from "node:fs";
55275
- var isWindows2 = process8.platform === "win32";
55742
+ var isWindows = process8.platform === "win32";
55276
55743
  var readRc = (filePath) => {
55277
55744
  try {
55278
55745
  return import_ini.default.parse(fs4.readFileSync(filePath, "utf8")).prefix;
@@ -55280,7 +55747,7 @@ var readRc = (filePath) => {
55280
55747
  };
55281
55748
  var getEnvNpmPrefix = () => Object.keys(process8.env).reduce((prefix, name) => /^npm_config_prefix$/i.test(name) ? process8.env[name] : prefix, undefined);
55282
55749
  var getGlobalNpmrc = () => {
55283
- if (isWindows2 && process8.env.APPDATA) {
55750
+ if (isWindows && process8.env.APPDATA) {
55284
55751
  return path9.join(process8.env.APPDATA, "/npm/etc/npmrc");
55285
55752
  }
55286
55753
  if (process8.execPath.includes("/Cellar/node")) {
@@ -55293,7 +55760,7 @@ var getGlobalNpmrc = () => {
55293
55760
  }
55294
55761
  };
55295
55762
  var getDefaultNpmPrefix = () => {
55296
- if (isWindows2) {
55763
+ if (isWindows) {
55297
55764
  const { APPDATA } = process8.env;
55298
55765
  return APPDATA ? path9.join(APPDATA, "npm") : path9.dirname(process8.execPath);
55299
55766
  }
@@ -55319,7 +55786,7 @@ var getNpmPrefix = () => {
55319
55786
  };
55320
55787
  var npmPrefix = path9.resolve(getNpmPrefix());
55321
55788
  var getYarnWindowsDirectory = () => {
55322
- if (isWindows2 && process8.env.LOCALAPPDATA) {
55789
+ if (isWindows && process8.env.LOCALAPPDATA) {
55323
55790
  const dir = path9.join(process8.env.LOCALAPPDATA, "Yarn");
55324
55791
  if (fs4.existsSync(dir)) {
55325
55792
  return dir;
@@ -55348,8 +55815,8 @@ var getYarnPrefix = () => {
55348
55815
  var globalDirectory = {};
55349
55816
  globalDirectory.npm = {};
55350
55817
  globalDirectory.npm.prefix = npmPrefix;
55351
- globalDirectory.npm.packages = path9.join(npmPrefix, isWindows2 ? "node_modules" : "lib/node_modules");
55352
- globalDirectory.npm.binaries = isWindows2 ? npmPrefix : path9.join(npmPrefix, "bin");
55818
+ globalDirectory.npm.packages = path9.join(npmPrefix, isWindows ? "node_modules" : "lib/node_modules");
55819
+ globalDirectory.npm.binaries = isWindows ? npmPrefix : path9.join(npmPrefix, "bin");
55353
55820
  var yarnPrefix = path9.resolve(getYarnPrefix());
55354
55821
  globalDirectory.yarn = {};
55355
55822
  globalDirectory.yarn.prefix = yarnPrefix;
@@ -73708,7 +74175,7 @@ var isSharedWorker = typeof SharedWorkerGlobalScope !== "undefined" && globalThi
73708
74175
  var isServiceWorker = typeof ServiceWorkerGlobalScope !== "undefined" && globalThis instanceof ServiceWorkerGlobalScope;
73709
74176
  var platform = globalThis.navigator?.userAgentData?.platform;
73710
74177
  var isMacOs = platform === "macOS" || globalThis.navigator?.platform === "MacIntel" || globalThis.navigator?.userAgent?.includes(" Mac ") === true || globalThis.process?.platform === "darwin";
73711
- var isWindows3 = platform === "Windows" || globalThis.navigator?.platform === "Win32" || globalThis.process?.platform === "win32";
74178
+ var isWindows2 = platform === "Windows" || globalThis.navigator?.platform === "Win32" || globalThis.process?.platform === "win32";
73712
74179
  var isLinux = platform === "Linux" || globalThis.navigator?.platform?.startsWith("Linux") === true || globalThis.navigator?.userAgent?.includes(" Linux ") === true || globalThis.process?.platform === "linux";
73713
74180
  var isIos = platform === "iOS" || globalThis.navigator?.platform === "MacIntel" && globalThis.navigator?.maxTouchPoints > 1 || /iPad|iPhone|iPod/.test(globalThis.navigator?.platform);
73714
74181
  var isAndroid = platform === "Android" || globalThis.navigator?.platform === "Android" || globalThis.navigator?.userAgent?.includes(" Android ") === true || globalThis.process?.platform === "android";
@@ -73717,7 +74184,7 @@ var isAndroid = platform === "Android" || globalThis.navigator?.platform === "An
73717
74184
  var ESC = "\x1B[";
73718
74185
  var SEP = ";";
73719
74186
  var isTerminalApp = !isBrowser && process11.env.TERM_PROGRAM === "Apple_Terminal";
73720
- var isWindows4 = !isBrowser && process11.platform === "win32";
74187
+ var isWindows3 = !isBrowser && process11.platform === "win32";
73721
74188
  var isTmux = !isBrowser && (process11.env.TERM?.startsWith("screen") || process11.env.TERM?.startsWith("tmux") || process11.env.TMUX !== undefined);
73722
74189
  var cwdFunction = isBrowser ? () => {
73723
74190
  throw new Error("`process.cwd()` only works in Node.js, not the browser.");
@@ -73761,7 +74228,7 @@ var scrollUp = ESC + "S";
73761
74228
  var scrollDown = ESC + "T";
73762
74229
  var clearViewport = `${eraseScreen}${ESC}H`;
73763
74230
  var isOldWindows = () => {
73764
- if (isBrowser || !isWindows4) {
74231
+ if (isBrowser || !isWindows3) {
73765
74232
  return false;
73766
74233
  }
73767
74234
  const parts = os5.release().split(".");
@@ -86036,37 +86503,37 @@ class UpdateScheduler extends EventEmitter8 {
86036
86503
  }
86037
86504
 
86038
86505
  // src/auto-update/installer.ts
86506
+ init_spawn();
86039
86507
  init_state_home();
86040
- import { spawn as spawn4, spawnSync } from "child_process";
86041
86508
  import { existsSync as existsSync17, readFileSync as readFileSync12, mkdirSync as mkdirSync8 } from "fs";
86042
86509
  import { dirname as dirname9, resolve as resolve8 } from "path";
86043
86510
  import { homedir as homedir3 } from "os";
86044
86511
  init_logger();
86045
86512
  var log56 = createLogger("installer");
86046
86513
  function detectPackageManager() {
86047
- const npmCmd = process.platform === "win32" ? "npm.cmd" : "npm";
86514
+ const npmCmd = "npm";
86048
86515
  const originalInstaller = detectOriginalInstaller();
86049
86516
  if (originalInstaller) {
86050
86517
  log56.debug(`Detected original installer: ${originalInstaller}`);
86051
86518
  if (originalInstaller === "bun") {
86052
- const bunCheck = spawnSync("bun", ["--version"], { stdio: "ignore" });
86519
+ const bunCheck = crossSpawnSync("bun", ["--version"], { stdio: "ignore" });
86053
86520
  if (bunCheck.status === 0) {
86054
86521
  return { cmd: "bun", isBun: true };
86055
86522
  }
86056
86523
  log56.warn("Originally installed with bun, but bun not found. Falling back to npm.");
86057
86524
  } else {
86058
- const npmCheck = spawnSync(npmCmd, ["--version"], { stdio: "ignore" });
86525
+ const npmCheck = crossSpawnSync(npmCmd, ["--version"], { stdio: "ignore" });
86059
86526
  if (npmCheck.status === 0) {
86060
86527
  return { cmd: npmCmd, isBun: false };
86061
86528
  }
86062
86529
  log56.warn("Originally installed with npm, but npm not found. Falling back to bun.");
86063
86530
  }
86064
86531
  }
86065
- const bunCheck = spawnSync("bun", ["--version"], { stdio: "ignore" });
86532
+ const bunCheck = crossSpawnSync("bun", ["--version"], { stdio: "ignore" });
86066
86533
  if (bunCheck.status === 0) {
86067
86534
  return { cmd: "bun", isBun: true };
86068
86535
  }
86069
- const npmCheck = spawnSync(npmCmd, ["--version"], { stdio: "ignore" });
86536
+ const npmCheck = crossSpawnSync(npmCmd, ["--version"], { stdio: "ignore" });
86070
86537
  if (npmCheck.status === 0) {
86071
86538
  return { cmd: npmCmd, isBun: false };
86072
86539
  }
@@ -86085,13 +86552,12 @@ function detectOriginalInstaller() {
86085
86552
  if (scriptPath.startsWith(bunGlobalDir)) {
86086
86553
  return "bun";
86087
86554
  }
86088
- const npmCmd = process.platform === "win32" ? "npm.cmd" : "npm";
86089
- const npmPrefixResult = spawnSync(npmCmd, ["prefix", "-g"], {
86555
+ const npmPrefixResult = crossSpawnSync("npm", ["prefix", "-g"], {
86090
86556
  encoding: "utf-8",
86091
86557
  stdio: ["ignore", "pipe", "ignore"]
86092
86558
  });
86093
86559
  if (npmPrefixResult.status === 0 && npmPrefixResult.stdout) {
86094
- const npmPrefix = normalizePath(npmPrefixResult.stdout.trim());
86560
+ const npmPrefix = normalizePath(String(npmPrefixResult.stdout).trim());
86095
86561
  if (scriptPath.startsWith(npmPrefix)) {
86096
86562
  return "npm";
86097
86563
  }
@@ -86181,7 +86647,7 @@ async function installVersion(version) {
86181
86647
  const { cmd, isBun } = pm;
86182
86648
  const args = ["install", "-g", `${PACKAGE_NAME2}@${version}`];
86183
86649
  log56.debug(`Using ${isBun ? "bun" : "npm"} for installation`);
86184
- const child = spawn4(cmd, args, {
86650
+ const child = crossSpawn(cmd, args, {
86185
86651
  stdio: ["ignore", "pipe", "pipe"],
86186
86652
  env: {
86187
86653
  ...process.env,
@@ -86264,7 +86730,7 @@ class UpdateInstaller {
86264
86730
 
86265
86731
  // src/auto-update/respawn.ts
86266
86732
  init_logger();
86267
- import { spawn as spawn5 } from "child_process";
86733
+ init_spawn();
86268
86734
  import { existsSync as existsSync18, statSync as statSync5 } from "fs";
86269
86735
  import { delimiter, join as join18 } from "path";
86270
86736
  var log57 = createLogger("respawn");
@@ -86334,14 +86800,12 @@ function spawnReplacement(argv = process.argv.slice(2), binPath = resolveClaudeT
86334
86800
  const childEnv = { ...process.env };
86335
86801
  delete childEnv.CLAUDE_THREADS_BIN;
86336
86802
  delete childEnv.CLAUDE_THREADS_INTERACTIVE;
86337
- const useShell = process.platform === "win32";
86338
86803
  let child;
86339
86804
  try {
86340
- child = spawn5(binPath, argv, {
86805
+ child = crossSpawn(binPath, argv, {
86341
86806
  detached: true,
86342
86807
  stdio: "inherit",
86343
- env: childEnv,
86344
- shell: useShell
86808
+ env: childEnv
86345
86809
  });
86346
86810
  } catch (err) {
86347
86811
  log57.error(`spawn() threw: ${err instanceof Error ? err.message : String(err)}`);
@@ -86708,6 +87172,8 @@ async function main() {
86708
87172
  const { spawn } = await import("child_process");
86709
87173
  const { dirname, resolve } = await import("path");
86710
87174
  const { fileURLToPath } = await import("url");
87175
+ const { existsSync } = await import("fs");
87176
+ await Promise.resolve().then(() => init_spawn());
86711
87177
  const __filename2 = fileURLToPath(import.meta.url);
86712
87178
  const __dirname2 = dirname(__filename2);
86713
87179
  const daemonPath = resolve(__dirname2, "..", "bin", "claude-threads-daemon");
@@ -86717,7 +87183,14 @@ async function main() {
86717
87183
  const binPath = __filename2;
86718
87184
  let child;
86719
87185
  if (process.platform === "win32") {
86720
- child = spawn("bash", [daemonPath, "--restart-on-error", ...args], {
87186
+ const bashPath = findWindowsGitBash(process.env, existsSync);
87187
+ if (!bashPath) {
87188
+ console.error("Auto-restart requires Git for Windows (bash.exe). Starting without auto-restart...");
87189
+ console.error("");
87190
+ await startWithoutDaemon();
87191
+ return;
87192
+ }
87193
+ child = spawn(bashPath, [daemonPath, "--restart-on-error", ...args], {
86721
87194
  stdio: "inherit",
86722
87195
  env: {
86723
87196
  ...process.env,