viben 1.1.9 → 1.2.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
@@ -2160,8 +2160,8 @@ var require_lib2 = __commonJS({
2160
2160
  });
2161
2161
 
2162
2162
  // ../../packages/core/dist/index.js
2163
- import * as os2 from "os";
2164
- import os2__default, { homedir as homedir2, platform as platform2, type, release, hostname, arch, tmpdir } from "os";
2163
+ import * as os3 from "os";
2164
+ import os3__default, { homedir as homedir2, platform as platform2, type, release, hostname, arch, tmpdir } from "os";
2165
2165
  import * as path21 from "path";
2166
2166
  import path21__default, { join as join2, dirname as dirname2, basename as basename2, isAbsolute, resolve as resolve2, parse as parse$1, sep as sep2, delimiter, extname as extname2, relative as relative2 } from "path";
2167
2167
  import * as fs15 from "fs/promises";
@@ -12232,7 +12232,7 @@ function cleanOldTelemetryFiles(baseDir, retentionDays = 7) {
12232
12232
  }
12233
12233
  }
12234
12234
  function getDefaultTelemetryDir() {
12235
- const stateDir = process.env.VIBEN_STATE_DIR || path21.join(process.env.HOME || "~", ".viben");
12235
+ const stateDir = process.env.VIBEN_STATE_DIR || path21.join(os3.homedir(), ".viben");
12236
12236
  return path21.join(stateDir, "telemetry");
12237
12237
  }
12238
12238
  var init_telemetry = __esm({
@@ -19839,13 +19839,13 @@ __export(config_exports2, {
19839
19839
  function resolveStateDir() {
19840
19840
  const override = process.env.OPENCLAW_STATE_DIR?.trim() || process.env.CLAWDBOT_STATE_DIR?.trim();
19841
19841
  if (override) {
19842
- return override.startsWith("~") ? path21__default.resolve(override.replace(/^~(?=$|[\\/])/, os2__default.homedir())) : path21__default.resolve(override);
19842
+ return override.startsWith("~") ? path21__default.resolve(override.replace(/^~(?=$|[\\/])/, os3__default.homedir())) : path21__default.resolve(override);
19843
19843
  }
19844
19844
  if (fs20__default.existsSync(DEFAULT_STATE_DIR)) {
19845
19845
  return DEFAULT_STATE_DIR;
19846
19846
  }
19847
19847
  const legacyDirs = [".clawdbot", ".moltbot", ".moldbot"].map(
19848
- (dir) => path21__default.join(os2__default.homedir(), dir)
19848
+ (dir) => path21__default.join(os3__default.homedir(), dir)
19849
19849
  );
19850
19850
  const existing = legacyDirs.find((dir) => {
19851
19851
  try {
@@ -19859,7 +19859,7 @@ function resolveStateDir() {
19859
19859
  function findConfigPath() {
19860
19860
  const override = process.env.OPENCLAW_CONFIG_PATH?.trim();
19861
19861
  if (override) {
19862
- return override.startsWith("~") ? path21__default.resolve(override.replace(/^~(?=$|[\\/])/, os2__default.homedir())) : path21__default.resolve(override);
19862
+ return override.startsWith("~") ? path21__default.resolve(override.replace(/^~(?=$|[\\/])/, os3__default.homedir())) : path21__default.resolve(override);
19863
19863
  }
19864
19864
  const stateDir = resolveStateDir();
19865
19865
  const candidates = [CONFIG_FILENAME, ...LEGACY_CONFIG_FILENAMES].map(
@@ -19919,7 +19919,7 @@ var LEGACY_CONFIG_FILENAMES;
19919
19919
  var init_config3 = __esm({
19920
19920
  "src/executors/engines/openclaw/config.ts"() {
19921
19921
  init_types11();
19922
- DEFAULT_STATE_DIR = path21__default.join(os2__default.homedir(), ".openclaw");
19922
+ DEFAULT_STATE_DIR = path21__default.join(os3__default.homedir(), ".openclaw");
19923
19923
  CONFIG_FILENAME = "openclaw.json";
19924
19924
  LEGACY_CONFIG_FILENAMES = ["clawdbot.json", "moltbot.json", "moldbot.json"];
19925
19925
  }
@@ -24069,14 +24069,14 @@ var require_is_docker = __commonJS2({
24069
24069
  });
24070
24070
  var require_is_wsl = __commonJS2({
24071
24071
  "../../node_modules/.pnpm/is-wsl@2.2.0/node_modules/is-wsl/index.js"(exports2, module2) {
24072
- var os4 = __require2("os");
24072
+ var os5 = __require2("os");
24073
24073
  var fs23 = __require2("fs");
24074
24074
  var isDocker = require_is_docker();
24075
24075
  var isWsl = () => {
24076
24076
  if (process.platform !== "linux") {
24077
24077
  return false;
24078
24078
  }
24079
- if (os4.release().toLowerCase().includes("microsoft")) {
24079
+ if (os5.release().toLowerCase().includes("microsoft")) {
24080
24080
  if (isDocker()) {
24081
24081
  return false;
24082
24082
  }
@@ -24103,7 +24103,7 @@ var require_utils2 = __commonJS2({
24103
24103
  var isWSL = require_is_wsl();
24104
24104
  var path24 = __require2("path");
24105
24105
  var url2 = __require2("url");
24106
- var os4 = __require2("os");
24106
+ var os5 = __require2("os");
24107
24107
  var fs23 = __require2("fs");
24108
24108
  var net2 = __require2("net");
24109
24109
  var BUFFER_SIZE = 1024;
@@ -24489,19 +24489,19 @@ var require_utils2 = __commonJS2({
24489
24489
  return options;
24490
24490
  };
24491
24491
  module2.exports.isMac = function() {
24492
- return os4.type() === "Darwin";
24492
+ return os5.type() === "Darwin";
24493
24493
  };
24494
24494
  module2.exports.isMountainLion = function() {
24495
- return os4.type() === "Darwin" && semver.satisfies(garanteeSemverFormat(os4.release()), ">=12.0.0");
24495
+ return os5.type() === "Darwin" && semver.satisfies(garanteeSemverFormat(os5.release()), ">=12.0.0");
24496
24496
  };
24497
24497
  module2.exports.isWin8 = function() {
24498
- return os4.type() === "Windows_NT" && semver.satisfies(garanteeSemverFormat(os4.release()), ">=6.2.9200");
24498
+ return os5.type() === "Windows_NT" && semver.satisfies(garanteeSemverFormat(os5.release()), ">=6.2.9200");
24499
24499
  };
24500
24500
  module2.exports.isWSL = function() {
24501
24501
  return isWSL;
24502
24502
  };
24503
24503
  module2.exports.isLessThanWin8 = function() {
24504
- return os4.type() === "Windows_NT" && semver.satisfies(garanteeSemverFormat(os4.release()), "<6.2.9200");
24504
+ return os5.type() === "Windows_NT" && semver.satisfies(garanteeSemverFormat(os5.release()), "<6.2.9200");
24505
24505
  };
24506
24506
  function garanteeSemverFormat(version2) {
24507
24507
  if (version2.split(".").length === 2) {
@@ -24753,7 +24753,7 @@ var require_which = __commonJS2({
24753
24753
  });
24754
24754
  var require_notifysend = __commonJS2({
24755
24755
  "../../node_modules/.pnpm/node-notifier@10.0.1/node_modules/node-notifier/notifiers/notifysend.js"(exports2, module2) {
24756
- var os4 = __require2("os");
24756
+ var os5 = __require2("os");
24757
24757
  var which3 = require_which();
24758
24758
  var utils = require_utils2();
24759
24759
  var EventEmitter14 = __require2("events").EventEmitter;
@@ -24787,7 +24787,7 @@ var require_notifysend = __commonJS2({
24787
24787
  callback(new Error("Message is required."));
24788
24788
  return this;
24789
24789
  }
24790
- if (os4.type() !== "Linux" && !os4.type().match(/BSD$/)) {
24790
+ if (os5.type() !== "Linux" && !os5.type().match(/BSD$/)) {
24791
24791
  callback(new Error("Only supported on Linux and *BSD systems"));
24792
24792
  return this;
24793
24793
  }
@@ -25205,7 +25205,7 @@ var require_balloon = __commonJS2({
25205
25205
  var utils = require_utils2();
25206
25206
  var Toaster = require_toaster();
25207
25207
  var Growl = require_growl();
25208
- var os4 = __require2("os");
25208
+ var os5 = __require2("os");
25209
25209
  var EventEmitter14 = __require2("events").EventEmitter;
25210
25210
  var util3 = __require2("util");
25211
25211
  var hasGrowl;
@@ -25273,7 +25273,7 @@ var require_balloon = __commonJS2({
25273
25273
  });
25274
25274
  var allowedArguments = ["t", "d", "p", "m", "i", "e", "q", "w", "xp"];
25275
25275
  function doNotification(options, notifierOptions, callback) {
25276
- const is64Bit = os4.arch() === "x64";
25276
+ const is64Bit = os5.arch() === "x64";
25277
25277
  options = options || {};
25278
25278
  options = utils.mapToNotifu(options);
25279
25279
  options.p = options.p || "Node Notification:";
@@ -25629,7 +25629,7 @@ var require_toaster = __commonJS2({
25629
25629
  var notifier = path24.resolve(__dirname, "../vendor/snoreToast/snoretoast");
25630
25630
  var utils = require_utils2();
25631
25631
  var Balloon = require_balloon();
25632
- var os4 = __require2("os");
25632
+ var os5 = __require2("os");
25633
25633
  var { v4: uuid } = (init_esm_node(), __toCommonJS(esm_node_exports));
25634
25634
  var EventEmitter14 = __require2("events").EventEmitter;
25635
25635
  var util3 = __require2("util");
@@ -25668,7 +25668,7 @@ var require_toaster = __commonJS2({
25668
25668
  function notifyRaw(options, callback) {
25669
25669
  options = utils.clone(options || {});
25670
25670
  callback = callback || noop2;
25671
- const is64Bit = os4.arch() === "x64";
25671
+ const is64Bit = os5.arch() === "x64";
25672
25672
  let resultBuffer;
25673
25673
  const server = {
25674
25674
  namedPipe: getPipeName()
@@ -25743,7 +25743,7 @@ var require_toaster = __commonJS2({
25743
25743
  });
25744
25744
  var require_node_notifier = __commonJS2({
25745
25745
  "../../node_modules/.pnpm/node-notifier@10.0.1/node_modules/node-notifier/index.js"(exports2, module2) {
25746
- var os4 = __require2("os");
25746
+ var os5 = __require2("os");
25747
25747
  var utils = require_utils2();
25748
25748
  var NotifySend = require_notifysend();
25749
25749
  var NotificationCenter = require_notificationcenter();
@@ -25751,7 +25751,7 @@ var require_node_notifier = __commonJS2({
25751
25751
  var Growl = require_growl();
25752
25752
  var WindowsBalloon = require_balloon();
25753
25753
  var options = { withFallback: true };
25754
- var osType = utils.isWSL() ? "WSL" : os4.type();
25754
+ var osType = utils.isWSL() ? "WSL" : os5.type();
25755
25755
  switch (osType) {
25756
25756
  case "Linux":
25757
25757
  module2.exports = new NotifySend(options);
@@ -25775,7 +25775,7 @@ var require_node_notifier = __commonJS2({
25775
25775
  module2.exports.Notification = WindowsToaster;
25776
25776
  break;
25777
25777
  default:
25778
- if (os4.type().match(/BSD$/)) {
25778
+ if (os5.type().match(/BSD$/)) {
25779
25779
  module2.exports = new NotifySend(options);
25780
25780
  module2.exports.Notification = NotifySend;
25781
25781
  } else {
@@ -38944,7 +38944,7 @@ var require_has_flag = __commonJS2({
38944
38944
  });
38945
38945
  var require_supports_color = __commonJS2({
38946
38946
  "../../node_modules/.pnpm/supports-color@8.1.1/node_modules/supports-color/index.js"(exports2, module2) {
38947
- var os4 = __require2("os");
38947
+ var os5 = __require2("os");
38948
38948
  var tty = __require2("tty");
38949
38949
  var hasFlag = require_has_flag();
38950
38950
  var { env } = process;
@@ -39001,7 +39001,7 @@ var require_supports_color = __commonJS2({
39001
39001
  return min;
39002
39002
  }
39003
39003
  if (process.platform === "win32") {
39004
- const osRelease = os4.release().split(".");
39004
+ const osRelease = os5.release().split(".");
39005
39005
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
39006
39006
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
39007
39007
  }
@@ -132520,9 +132520,9 @@ var init_session_store = __esm({
132520
132520
  }
132521
132521
  });
132522
132522
  async function sendNotification(options) {
132523
- const os4 = platform2();
132523
+ const os5 = platform2();
132524
132524
  try {
132525
- switch (os4) {
132525
+ switch (os5) {
132526
132526
  case "darwin":
132527
132527
  return await sendMacOSNotification(options);
132528
132528
  case "linux":
@@ -132530,7 +132530,7 @@ async function sendNotification(options) {
132530
132530
  case "win32":
132531
132531
  return await sendWindowsNotification(options);
132532
132532
  default:
132533
- console.warn(`[Notifications] Unsupported platform: ${os4}`);
132533
+ console.warn(`[Notifications] Unsupported platform: ${os5}`);
132534
132534
  return false;
132535
132535
  }
132536
132536
  } catch (error) {
@@ -135468,7 +135468,7 @@ async function getCodexPath() {
135468
135468
  // Local node_modules
135469
135469
  "./node_modules/.bin/codex",
135470
135470
  // User's npm bin
135471
- `${process.env.HOME}/.npm-global/bin/codex`,
135471
+ `${homedir2()}/.npm-global/bin/codex`,
135472
135472
  // Homebrew on macOS
135473
135473
  "/opt/homebrew/bin/codex",
135474
135474
  "/usr/local/bin/codex"
@@ -135566,8 +135566,8 @@ Error: ${err.message}`,
135566
135566
  provider: { type: "codex", name: this.name }
135567
135567
  };
135568
135568
  }
135569
- const os4 = platform2();
135570
- const sandboxSubcommand = os4 === "darwin" ? "macos" : "linux";
135569
+ const os5 = platform2();
135570
+ const sandboxSubcommand = os5 === "darwin" ? "macos" : "linux";
135571
135571
  const spawnArgs = [
135572
135572
  "sandbox",
135573
135573
  sandboxSubcommand,
@@ -135636,7 +135636,7 @@ async function getSrtPath() {
135636
135636
  // Local node_modules
135637
135637
  "./node_modules/.bin/srt",
135638
135638
  // User's npm bin
135639
- `${process.env.HOME}/.npm-global/bin/srt`,
135639
+ `${homedir2()}/.npm-global/bin/srt`,
135640
135640
  // Homebrew on macOS
135641
135641
  "/opt/homebrew/bin/srt",
135642
135642
  "/usr/local/bin/srt"
@@ -137267,8 +137267,7 @@ var init_mcp_monitor = __esm({
137267
137267
  }
137268
137268
  });
137269
137269
  function getMcpServersConfigPath() {
137270
- const homedir30 = process.env.HOME || process.env.USERPROFILE || "";
137271
- return path21.join(homedir30, ".viben", "mcp-servers.json");
137270
+ return path21.join(homedir2(), ".viben", "mcp-servers.json");
137272
137271
  }
137273
137272
  var log15;
137274
137273
  var ConfigWatcherService;
@@ -148698,7 +148697,7 @@ var startupConfig;
148698
148697
  var gatewayStartTime;
148699
148698
  var init_health = __esm({
148700
148699
  "src/gateway/routes/health.ts"() {
148701
- VERSION3 = "1.1.9";
148700
+ VERSION3 = "1.2.0";
148702
148701
  startupConfig = null;
148703
148702
  gatewayStartTime = Date.now();
148704
148703
  }
@@ -148707,7 +148706,7 @@ function encodeWorkspacePath(workspacePath) {
148707
148706
  return workspacePath.replace(/\//g, "-");
148708
148707
  }
148709
148708
  function getClaudeProjectsDir() {
148710
- return path21.join(os2.homedir(), ".claude", "projects");
148709
+ return path21.join(os3.homedir(), ".claude", "projects");
148711
148710
  }
148712
148711
  async function discoverClaudeCodeSessions(workspacePath) {
148713
148712
  const projectsDir = getClaudeProjectsDir();
@@ -148895,11 +148894,11 @@ function convertClaudeMessageToUI(msg) {
148895
148894
  }
148896
148895
  function getCodexSessionsDir() {
148897
148896
  if (process.platform === "darwin") {
148898
- return path21.join(os2.homedir(), "Library", "Application Support", "codex", "sessions");
148897
+ return path21.join(os3.homedir(), "Library", "Application Support", "codex", "sessions");
148899
148898
  } else if (process.platform === "win32") {
148900
148899
  return path21.join(process.env.APPDATA || "", "codex", "sessions");
148901
148900
  } else {
148902
- return path21.join(os2.homedir(), ".config", "codex", "sessions");
148901
+ return path21.join(os3.homedir(), ".config", "codex", "sessions");
148903
148902
  }
148904
148903
  }
148905
148904
  async function discoverCodexSessions(workspacePath) {
@@ -148990,10 +148989,10 @@ function convertCodexMessageToUI(msg) {
148990
148989
  }
148991
148990
  }
148992
148991
  function getExecutorConfigPaths(type2, workspacePath) {
148993
- const homedir30 = os2.homedir();
148992
+ const homedir34 = os3.homedir();
148994
148993
  switch (type2) {
148995
148994
  case "CLAUDE_CODE": {
148996
- const globalConfigDir = path21.join(homedir30, ".claude");
148995
+ const globalConfigDir = path21.join(homedir34, ".claude");
148997
148996
  const workspaceConfigDir = workspacePath ? path21.join(workspacePath, ".claude") : void 0;
148998
148997
  return {
148999
148998
  globalConfigPath: fs20.existsSync(globalConfigDir) ? globalConfigDir : void 0,
@@ -149005,11 +149004,11 @@ function getExecutorConfigPaths(type2, workspacePath) {
149005
149004
  case "CODEX": {
149006
149005
  let configDir;
149007
149006
  if (process.platform === "darwin") {
149008
- configDir = path21.join(homedir30, "Library", "Application Support", "codex");
149007
+ configDir = path21.join(homedir34, "Library", "Application Support", "codex");
149009
149008
  } else if (process.platform === "win32") {
149010
149009
  configDir = path21.join(process.env.APPDATA || "", "codex");
149011
149010
  } else {
149012
- configDir = path21.join(homedir30, ".config", "codex");
149011
+ configDir = path21.join(homedir34, ".config", "codex");
149013
149012
  }
149014
149013
  const workspaceConfigDir = workspacePath ? path21.join(workspacePath, ".codex") : void 0;
149015
149014
  return {
@@ -149022,11 +149021,11 @@ function getExecutorConfigPaths(type2, workspacePath) {
149022
149021
  case "CURSOR_AGENT": {
149023
149022
  let configDir;
149024
149023
  if (process.platform === "darwin") {
149025
- configDir = path21.join(homedir30, "Library", "Application Support", "Cursor", "User");
149024
+ configDir = path21.join(homedir34, "Library", "Application Support", "Cursor", "User");
149026
149025
  } else if (process.platform === "win32") {
149027
149026
  configDir = path21.join(process.env.APPDATA || "", "Cursor", "User");
149028
149027
  } else {
149029
- configDir = path21.join(homedir30, ".config", "Cursor", "User");
149028
+ configDir = path21.join(homedir34, ".config", "Cursor", "User");
149030
149029
  }
149031
149030
  const workspaceConfigDir = workspacePath ? path21.join(workspacePath, ".cursor") : void 0;
149032
149031
  return {
@@ -149037,7 +149036,7 @@ function getExecutorConfigPaths(type2, workspacePath) {
149037
149036
  };
149038
149037
  }
149039
149038
  case "GEMINI": {
149040
- const globalConfigDir = path21.join(homedir30, ".gemini");
149039
+ const globalConfigDir = path21.join(homedir34, ".gemini");
149041
149040
  const workspaceConfigDir = workspacePath ? path21.join(workspacePath, ".gemini") : void 0;
149042
149041
  return {
149043
149042
  globalConfigPath: fs20.existsSync(globalConfigDir) ? globalConfigDir : void 0,
@@ -149049,11 +149048,11 @@ function getExecutorConfigPaths(type2, workspacePath) {
149049
149048
  case "AMP": {
149050
149049
  let configDir;
149051
149050
  if (process.platform === "darwin") {
149052
- configDir = path21.join(homedir30, "Library", "Application Support", "amp");
149051
+ configDir = path21.join(homedir34, "Library", "Application Support", "amp");
149053
149052
  } else if (process.platform === "win32") {
149054
149053
  configDir = path21.join(process.env.APPDATA || "", "amp");
149055
149054
  } else {
149056
- configDir = path21.join(homedir30, ".config", "amp");
149055
+ configDir = path21.join(homedir34, ".config", "amp");
149057
149056
  }
149058
149057
  const workspaceConfigDir = workspacePath ? path21.join(workspacePath, ".amp") : void 0;
149059
149058
  return {
@@ -149064,7 +149063,7 @@ function getExecutorConfigPaths(type2, workspacePath) {
149064
149063
  };
149065
149064
  }
149066
149065
  case "OPENCLAW": {
149067
- const globalConfigDir = path21.join(homedir30, ".openclaw");
149066
+ const globalConfigDir = path21.join(homedir34, ".openclaw");
149068
149067
  const globalConfigFile = path21.join(globalConfigDir, "openclaw.json");
149069
149068
  const workspaceConfigDir = workspacePath ? path21.join(workspacePath, ".openclaw") : void 0;
149070
149069
  return {
@@ -149075,7 +149074,7 @@ function getExecutorConfigPaths(type2, workspacePath) {
149075
149074
  };
149076
149075
  }
149077
149076
  default: {
149078
- const globalConfigDir = path21.join(homedir30, ".viben");
149077
+ const globalConfigDir = path21.join(homedir34, ".viben");
149079
149078
  const workspaceConfigDir = workspacePath ? path21.join(workspacePath, ".viben") : void 0;
149080
149079
  return {
149081
149080
  globalConfigPath: fs20.existsSync(globalConfigDir) ? globalConfigDir : void 0,
@@ -149154,7 +149153,7 @@ function checkExecutorAvailability(type2, workspacePath) {
149154
149153
  supports_mcp: supportsMcp,
149155
149154
  capabilities,
149156
149155
  has_workspace_config: hasWorkspaceConfig,
149157
- workspace_path: workspacePath || os2.homedir()
149156
+ workspace_path: workspacePath || os3.homedir()
149158
149157
  };
149159
149158
  }
149160
149159
  function discoverExecutors(workspacePath) {
@@ -149220,7 +149219,7 @@ function registerExecutorRoutes(fastify2) {
149220
149219
  const executors = discoverExecutors(workspacePath);
149221
149220
  return {
149222
149221
  executors,
149223
- workspace_path: workspacePath || os2.homedir(),
149222
+ workspace_path: workspacePath || os3.homedir(),
149224
149223
  include_global: includeGlobal,
149225
149224
  total: executors.length
149226
149225
  };
@@ -149279,12 +149278,12 @@ function registerExecutorRoutes(fastify2) {
149279
149278
  return { messages, total: messages.length };
149280
149279
  });
149281
149280
  function getMcpConfigPath(workspacePath, executorType) {
149282
- const base = workspacePath || os2.homedir();
149281
+ const base = workspacePath || os3.homedir();
149283
149282
  switch (executorType) {
149284
149283
  case "CLAUDE_CODE":
149285
149284
  const projectMcp = path21.join(base, ".mcp.json");
149286
149285
  if (fs20.existsSync(projectMcp)) return projectMcp;
149287
- return path21.join(os2.homedir(), ".claude.json");
149286
+ return path21.join(os3.homedir(), ".claude.json");
149288
149287
  case "CURSOR_AGENT":
149289
149288
  return path21.join(base, ".cursor", "mcp.json");
149290
149289
  default:
@@ -149331,7 +149330,7 @@ function registerExecutorRoutes(fastify2) {
149331
149330
  return { servers, total: servers.length };
149332
149331
  });
149333
149332
  function getSkillsConfigPath(workspacePath, executorType) {
149334
- const base = workspacePath || os2.homedir();
149333
+ const base = workspacePath || os3.homedir();
149335
149334
  switch (executorType) {
149336
149335
  case "CLAUDE_CODE":
149337
149336
  return {
@@ -149427,7 +149426,7 @@ function registerExecutorRoutes(fastify2) {
149427
149426
  return { skills, total: skills.length };
149428
149427
  });
149429
149428
  function getSubagentsPath(workspacePath, executorType) {
149430
- const base = workspacePath || os2.homedir();
149429
+ const base = workspacePath || os3.homedir();
149431
149430
  switch (executorType) {
149432
149431
  case "CLAUDE_CODE":
149433
149432
  return path21.join(base, ".claude", "agents");
@@ -149518,7 +149517,7 @@ function registerExecutorRoutes(fastify2) {
149518
149517
  }
149519
149518
  });
149520
149519
  function getCommandsPath(workspacePath, executorType) {
149521
- const base = workspacePath || os2.homedir();
149520
+ const base = workspacePath || os3.homedir();
149522
149521
  switch (executorType) {
149523
149522
  case "CLAUDE_CODE":
149524
149523
  return path21.join(base, ".claude", "commands");
@@ -149625,7 +149624,7 @@ function registerExecutorRoutes(fastify2) {
149625
149624
  }
149626
149625
  });
149627
149626
  function getPromptsPath(workspacePath, executorType) {
149628
- const base = workspacePath || os2.homedir();
149627
+ const base = workspacePath || os3.homedir();
149629
149628
  switch (executorType) {
149630
149629
  case "CLAUDE_CODE":
149631
149630
  return path21.join(base, ".claude", "prompts");
@@ -150026,7 +150025,7 @@ function registerAgentRoutes(fastify2, state) {
150026
150025
  }, async (request) => {
150027
150026
  const { workspace_path, include_global } = request.query;
150028
150027
  const includeGlobal = include_global !== "false";
150029
- const homeDir = process.env.HOME || "/";
150028
+ const homeDir = homedir2();
150030
150029
  const transformAgent = (a, sourceOverride, workspacePathOverride) => {
150031
150030
  if (!a) return null;
150032
150031
  const source = sourceOverride || (a.path && a.path.startsWith(homeDir) && a.path.includes("/.viben/agents/") ? "global" : "workspace");
@@ -150104,7 +150103,7 @@ function registerAgentRoutes(fastify2, state) {
150104
150103
  approvals: body.approvals
150105
150104
  });
150106
150105
  reply.code(201);
150107
- const homeDir = process.env.HOME || "/";
150106
+ const homeDir = homedir2();
150108
150107
  const isGlobalAgent = agent.path && agent.path.startsWith(homeDir) && agent.path.includes("/.viben/agents/");
150109
150108
  const agentSource = isGlobalAgent ? "global" : "workspace";
150110
150109
  const agentWorkspacePath = !isGlobalAgent && agent.path ? agent.path.replace(/\/.viben\/agents\/[^/]+$/, "") : void 0;
@@ -150228,7 +150227,7 @@ function registerAgentRoutes(fastify2, state) {
150228
150227
  try {
150229
150228
  const agent = await agentManager.createFromTemplate(id, agent_id, { name, base_path }, template_workspace_path);
150230
150229
  reply.code(201);
150231
- const homeDir = process.env.HOME || "/";
150230
+ const homeDir = homedir2();
150232
150231
  const isGlobalAgent = agent.path && agent.path.startsWith(homeDir) && agent.path.includes("/.viben/agents/");
150233
150232
  const agentSource = isGlobalAgent ? "global" : "workspace";
150234
150233
  const agentWorkspacePath = !isGlobalAgent && agent.path ? agent.path.replace(/\/.viben\/agents\/[^/]+$/, "") : void 0;
@@ -150479,7 +150478,7 @@ function registerAgentRoutes(fastify2, state) {
150479
150478
  "/api/agent/:id/availability",
150480
150479
  async (request, reply) => {
150481
150480
  const { id } = request.params;
150482
- const homeDir = process.env.HOME || "/";
150481
+ const homeDir = homedir2();
150483
150482
  const executorTypes = [
150484
150483
  "CLAUDE_CODE",
150485
150484
  "CODEX",
@@ -150635,7 +150634,7 @@ function registerAgentRoutes(fastify2, state) {
150635
150634
  fastify2.get("/api/agent/:id", async (request, reply) => {
150636
150635
  const { id } = request.params;
150637
150636
  const { workspace_path } = request.query;
150638
- const homeDir = process.env.HOME || "/";
150637
+ const homeDir = homedir2();
150639
150638
  let agent = null;
150640
150639
  let source = "global";
150641
150640
  if (workspace_path) {
@@ -150705,7 +150704,7 @@ function registerAgentRoutes(fastify2, state) {
150705
150704
  };
150706
150705
  try {
150707
150706
  const agent = await agentManager.updateAgent(id, updates, workspace_path);
150708
- const homeDir = process.env.HOME || "/";
150707
+ const homeDir = homedir2();
150709
150708
  const isGlobalAgent = agent.path && agent.path.startsWith(homeDir) && agent.path.includes("/.viben/agents/");
150710
150709
  const agentSource = isGlobalAgent ? "global" : "workspace";
150711
150710
  const agentWorkspacePath = !isGlobalAgent && agent.path ? agent.path.replace(/\/.viben\/agents\/[^/]+$/, "") : void 0;
@@ -157568,7 +157567,7 @@ var init_history2 = __esm({
157568
157567
  }
157569
157568
  });
157570
157569
  function getDefaultShell() {
157571
- if (os2.platform() === "win32") {
157570
+ if (os3.platform() === "win32") {
157572
157571
  return process.env.COMSPEC || "cmd.exe";
157573
157572
  }
157574
157573
  return process.env.SHELL || "/bin/bash";
@@ -163163,11 +163162,46 @@ function getPythonCandidates() {
163163
163162
  );
163164
163163
  } else if (process.platform === "win32") {
163165
163164
  const localAppData = process.env.LOCALAPPDATA || join2(home, "AppData/Local");
163165
+ candidates.push("py", "C:\\Windows\\py.exe");
163166
163166
  candidates.push(
163167
+ join2(localAppData, "Programs/Python/Python314/python.exe"),
163167
163168
  join2(localAppData, "Programs/Python/Python313/python.exe"),
163168
163169
  join2(localAppData, "Programs/Python/Python312/python.exe"),
163169
163170
  join2(localAppData, "Programs/Python/Python311/python.exe"),
163170
- join2(localAppData, "Programs/Python/Python310/python.exe")
163171
+ join2(localAppData, "Programs/Python/Python310/python.exe"),
163172
+ join2(localAppData, "Programs/Python/Python39/python.exe")
163173
+ );
163174
+ candidates.push(
163175
+ join2(localAppData, "Microsoft/WindowsApps/python.exe"),
163176
+ join2(localAppData, "Microsoft/WindowsApps/python3.exe")
163177
+ );
163178
+ candidates.push(
163179
+ join2(home, ".pyenv/pyenv-win/shims/python.exe"),
163180
+ join2(home, ".pyenv/pyenv-win/shims/python3.exe")
163181
+ );
163182
+ candidates.push(join2(home, "scoop/apps/python/current/python.exe"));
163183
+ candidates.push(
163184
+ join2(home, "miniconda3/python.exe"),
163185
+ join2(home, "anaconda3/python.exe"),
163186
+ join2(home, "Miniconda3/python.exe"),
163187
+ join2(home, "Anaconda3/python.exe"),
163188
+ join2(localAppData, "miniconda3/python.exe"),
163189
+ join2(localAppData, "anaconda3/python.exe")
163190
+ );
163191
+ candidates.push(
163192
+ "C:\\ProgramData\\miniconda3\\python.exe",
163193
+ "C:\\ProgramData\\anaconda3\\python.exe",
163194
+ "C:\\ProgramData\\Miniconda3\\python.exe",
163195
+ "C:\\ProgramData\\Anaconda3\\python.exe",
163196
+ "C:\\miniconda3\\python.exe",
163197
+ "C:\\anaconda3\\python.exe"
163198
+ );
163199
+ candidates.push(
163200
+ "C:\\Python314\\python.exe",
163201
+ "C:\\Python313\\python.exe",
163202
+ "C:\\Python312\\python.exe",
163203
+ "C:\\Python311\\python.exe",
163204
+ "C:\\Python310\\python.exe"
163171
163205
  );
163172
163206
  } else {
163173
163207
  candidates.push(
@@ -163179,9 +163213,10 @@ function getPythonCandidates() {
163179
163213
  }
163180
163214
  return candidates;
163181
163215
  }
163182
- async function isExecutable(path24) {
163216
+ async function isExecutable(filePath) {
163183
163217
  try {
163184
- await access2(path24, constants.X_OK);
163218
+ const mode = process.platform === "win32" ? constants.F_OK : constants.X_OK;
163219
+ await access2(filePath, mode);
163185
163220
  return true;
163186
163221
  } catch {
163187
163222
  return false;
@@ -163190,20 +163225,29 @@ async function isExecutable(path24) {
163190
163225
  async function checkPython(path24) {
163191
163226
  try {
163192
163227
  let actualPath = path24;
163193
- if (!path24.startsWith("/") && !path24.includes("\\")) {
163228
+ const isAbsolute6 = path24.startsWith("/") || /^[A-Za-z]:[\\/]/.test(path24);
163229
+ if (!isAbsolute6) {
163194
163230
  try {
163195
- const { stdout: stdout2 } = await execAsync5(`which ${path24}`);
163196
- actualPath = stdout2.trim();
163231
+ const whichCmd = process.platform === "win32" ? `where "${path24}"` : `which ${path24}`;
163232
+ const { stdout: stdout2 } = await execAsync5(whichCmd, { windowsHide: true });
163233
+ actualPath = stdout2.trim().split(/\r?\n/)[0].trim();
163197
163234
  } catch {
163198
163235
  }
163199
163236
  }
163200
- if (actualPath.startsWith("/") || actualPath.includes("\\")) {
163201
- if (!await isExecutable(actualPath)) {
163237
+ if (actualPath.startsWith("/") || /^[A-Za-z]:[\\/]/.test(actualPath)) {
163238
+ if (process.platform === "win32") {
163239
+ try {
163240
+ await access2(actualPath, constants.F_OK);
163241
+ } catch {
163242
+ return null;
163243
+ }
163244
+ } else if (!await isExecutable(actualPath)) {
163202
163245
  return null;
163203
163246
  }
163204
163247
  }
163205
163248
  const { stdout, stderr } = await execAsync5(`"${actualPath}" --version`, {
163206
- timeout: 5e3
163249
+ timeout: 5e3,
163250
+ windowsHide: true
163207
163251
  });
163208
163252
  const versionOutput = stdout.trim() || stderr.trim();
163209
163253
  const versionMatch = versionOutput.match(/Python\s+(\d+\.\d+\.\d+)/);
@@ -163297,11 +163341,49 @@ function getCliToolCandidates(tool) {
163297
163341
  const programFiles = process.env.ProgramFiles || "C:\\Program Files";
163298
163342
  const programFilesX86 = process.env["ProgramFiles(x86)"] || "C:\\Program Files (x86)";
163299
163343
  if (tool === "python") {
163344
+ candidates.push("python", "python3", "py");
163345
+ candidates.push("C:\\Windows\\py.exe");
163300
163346
  candidates.push(
163347
+ join2(localAppData, "Programs/Python/Python314/python.exe"),
163301
163348
  join2(localAppData, "Programs/Python/Python313/python.exe"),
163302
163349
  join2(localAppData, "Programs/Python/Python312/python.exe"),
163303
163350
  join2(localAppData, "Programs/Python/Python311/python.exe"),
163304
- join2(localAppData, "Programs/Python/Python310/python.exe")
163351
+ join2(localAppData, "Programs/Python/Python310/python.exe"),
163352
+ join2(localAppData, "Programs/Python/Python39/python.exe")
163353
+ );
163354
+ candidates.push(
163355
+ join2(localAppData, "Microsoft/WindowsApps/python.exe"),
163356
+ join2(localAppData, "Microsoft/WindowsApps/python3.exe")
163357
+ );
163358
+ candidates.push(
163359
+ join2(home, ".pyenv/pyenv-win/shims/python.exe"),
163360
+ join2(home, ".pyenv/pyenv-win/shims/python3.exe")
163361
+ );
163362
+ candidates.push(
163363
+ join2(home, "scoop/apps/python/current/python.exe")
163364
+ );
163365
+ candidates.push(
163366
+ join2(home, "miniconda3/python.exe"),
163367
+ join2(home, "anaconda3/python.exe"),
163368
+ join2(home, "Miniconda3/python.exe"),
163369
+ join2(home, "Anaconda3/python.exe"),
163370
+ join2(localAppData, "miniconda3/python.exe"),
163371
+ join2(localAppData, "anaconda3/python.exe")
163372
+ );
163373
+ candidates.push(
163374
+ "C:\\ProgramData\\miniconda3\\python.exe",
163375
+ "C:\\ProgramData\\anaconda3\\python.exe",
163376
+ "C:\\ProgramData\\Miniconda3\\python.exe",
163377
+ "C:\\ProgramData\\Anaconda3\\python.exe",
163378
+ "C:\\miniconda3\\python.exe",
163379
+ "C:\\anaconda3\\python.exe"
163380
+ );
163381
+ candidates.push(
163382
+ "C:\\Python314\\python.exe",
163383
+ "C:\\Python313\\python.exe",
163384
+ "C:\\Python312\\python.exe",
163385
+ "C:\\Python311\\python.exe",
163386
+ "C:\\Python310\\python.exe"
163305
163387
  );
163306
163388
  } else if (tool === "git") {
163307
163389
  candidates.push(
@@ -163371,7 +163453,8 @@ async function detectCliToolVersion(toolPath, tool) {
163371
163453
  const versionArg = config.versionArg || "--version";
163372
163454
  try {
163373
163455
  const { stdout, stderr } = await execAsync5(`"${toolPath}" ${versionArg}`, {
163374
- timeout: 5e3
163456
+ timeout: 5e3,
163457
+ windowsHide: true
163375
163458
  });
163376
163459
  const output2 = stdout.trim() || stderr.trim();
163377
163460
  let version2 = null;
@@ -163459,12 +163542,12 @@ async function detectCliTool(tool, userConfigPath) {
163459
163542
  }
163460
163543
  }
163461
163544
  }
163462
- const toolCmd = tool === "python" ? "python3" : tool;
163545
+ const toolCmd = tool === "python" ? process.platform === "win32" ? "python" : "python3" : tool;
163463
163546
  try {
163464
163547
  const whichCmd = process.platform === "win32" ? "where" : "which";
163465
- const { stdout } = await execAsync5(`${whichCmd} ${toolCmd}`, { timeout: 5e3 });
163466
- const toolPath = stdout.trim().split("\n")[0];
163467
- if (toolPath) {
163548
+ const { stdout } = await execAsync5(`${whichCmd} ${toolCmd}`, { timeout: 5e3, windowsHide: true });
163549
+ const toolPaths = stdout.trim().split(/\r?\n/).map((l) => l.trim()).filter(Boolean);
163550
+ for (const toolPath of toolPaths) {
163468
163551
  const { version: version2, valid } = await detectCliToolVersion(toolPath, tool);
163469
163552
  if (valid) {
163470
163553
  await addPath(toolPath, version2 || void 0, getToolSource(toolPath));
@@ -163472,6 +163555,77 @@ async function detectCliTool(tool, userConfigPath) {
163472
163555
  }
163473
163556
  } catch {
163474
163557
  }
163558
+ let condaBaseDir = null;
163559
+ if (tool === "python" && process.platform === "win32") {
163560
+ try {
163561
+ const { stdout: condaStdout } = await execAsync5("where conda", { timeout: 3e3, windowsHide: true });
163562
+ const condaExe = condaStdout.trim().split(/\r?\n/)[0].trim();
163563
+ if (condaExe) {
163564
+ condaBaseDir = join2(dirname2(condaExe), "..");
163565
+ const pythonFromConda = join2(condaBaseDir, "python.exe");
163566
+ if (await isExecutable(pythonFromConda)) {
163567
+ const { version: version2, valid } = await detectCliToolVersion(pythonFromConda, tool);
163568
+ if (valid) {
163569
+ await addPath(pythonFromConda, version2 || void 0, "system-path");
163570
+ }
163571
+ }
163572
+ }
163573
+ } catch {
163574
+ }
163575
+ }
163576
+ if (tool === "python") {
163577
+ const localAppData = process.env.LOCALAPPDATA || join2(home, "AppData/Local");
163578
+ const condaBases = [];
163579
+ if (condaBaseDir) condaBases.push(condaBaseDir);
163580
+ if (process.platform === "win32") {
163581
+ condaBases.push(
163582
+ "C:\\ProgramData\\miniconda3",
163583
+ "C:\\ProgramData\\anaconda3",
163584
+ "C:\\ProgramData\\Miniconda3",
163585
+ "C:\\ProgramData\\Anaconda3",
163586
+ join2(home, "miniconda3"),
163587
+ join2(home, "anaconda3"),
163588
+ join2(home, "Miniconda3"),
163589
+ join2(home, "Anaconda3"),
163590
+ join2(localAppData, "miniconda3"),
163591
+ join2(localAppData, "anaconda3")
163592
+ );
163593
+ } else {
163594
+ condaBases.push(
163595
+ join2(home, "miniconda3"),
163596
+ join2(home, "anaconda3"),
163597
+ "/opt/miniconda3",
163598
+ "/opt/anaconda3"
163599
+ );
163600
+ }
163601
+ for (const existing of allPaths) {
163602
+ const parentDir = dirname2(existing.path);
163603
+ if (!condaBases.includes(parentDir)) {
163604
+ condaBases.push(parentDir);
163605
+ }
163606
+ }
163607
+ const pythonInEnvSuffix = process.platform === "win32" ? "python.exe" : join2("bin", "python");
163608
+ const seenEnvsDirs = /* @__PURE__ */ new Set();
163609
+ for (const base of condaBases) {
163610
+ const envsDir = join2(base, "envs");
163611
+ if (seenEnvsDirs.has(envsDir)) continue;
163612
+ seenEnvsDirs.add(envsDir);
163613
+ try {
163614
+ const envEntries = await readdir2(envsDir, { withFileTypes: true });
163615
+ for (const envEntry of envEntries) {
163616
+ if (!envEntry.isDirectory()) continue;
163617
+ const pythonInEnv = join2(envsDir, envEntry.name, pythonInEnvSuffix);
163618
+ if (await isExecutable(pythonInEnv)) {
163619
+ const { version: version2, valid } = await detectCliToolVersion(pythonInEnv, tool);
163620
+ if (valid) {
163621
+ await addPath(pythonInEnv, version2 || void 0, "system-path");
163622
+ }
163623
+ }
163624
+ }
163625
+ } catch {
163626
+ }
163627
+ }
163628
+ }
163475
163629
  if (config.detectMethod === "npm-global" && process.platform !== "win32") {
163476
163630
  const nvmVersionsDir = join2(home, ".nvm/versions/node");
163477
163631
  try {
@@ -163601,7 +163755,7 @@ async function checkPackageInstalled(pythonPath, packageName) {
163601
163755
  const pipCommand = `"${pythonPath}" -m pip show ${packageName}`;
163602
163756
  log35.debug({ pipCommand }, "Checking package with pip");
163603
163757
  try {
163604
- const { stdout, stderr } = await execAsync5(pipCommand, { timeout: 1e4 });
163758
+ const { stdout, stderr } = await execAsync5(pipCommand, { timeout: 1e4, windowsHide: true });
163605
163759
  log35.debug({ stdout: stdout.slice(0, 200) }, "pip show stdout");
163606
163760
  if (stderr) {
163607
163761
  log35.debug({ stderr: stderr.slice(0, 200) }, "pip show stderr");
@@ -163621,7 +163775,7 @@ async function checkPackageInstalled(pythonPath, packageName) {
163621
163775
  const importCommand = `"${pythonPath}" -c "import ${moduleName2}; print(getattr(${moduleName2}, '__version__', 'unknown'))"`;
163622
163776
  log35.debug({ importCommand }, "Trying import");
163623
163777
  try {
163624
- const { stdout: importStdout } = await execAsync5(importCommand, { timeout: 1e4 });
163778
+ const { stdout: importStdout } = await execAsync5(importCommand, { timeout: 1e4, windowsHide: true });
163625
163779
  const version2 = importStdout.trim() || "unknown";
163626
163780
  log35.debug({ packageName, version: version2 }, "Package found via import");
163627
163781
  return {
@@ -163635,7 +163789,7 @@ async function checkPackageInstalled(pythonPath, packageName) {
163635
163789
  const moduleCommand = `"${pythonPath}" -m ${moduleName2} --version`;
163636
163790
  log35.debug({ moduleCommand }, "Trying module version");
163637
163791
  try {
163638
- const { stdout: modStdout } = await execAsync5(moduleCommand, { timeout: 1e4 });
163792
+ const { stdout: modStdout } = await execAsync5(moduleCommand, { timeout: 1e4, windowsHide: true });
163639
163793
  const versionMatch = modStdout.match(/(\d+\.\d+\.\d+)/);
163640
163794
  const version2 = versionMatch ? versionMatch[1] : "installed";
163641
163795
  log35.debug({ packageName, version: version2 }, "Package found via module");
@@ -182213,8 +182367,15 @@ async function startGateway(ctx, options) {
182213
182367
  });
182214
182368
  fs20.closeSync(logFd);
182215
182369
  child.unref();
182216
- await new Promise((resolve28) => setTimeout(resolve28, 500));
182217
- const pid = findProcessOnPort(port);
182370
+ let pid = null;
182371
+ const pollStart = Date.now();
182372
+ const pollMaxMs = 15e3;
182373
+ const pollInterval = 500;
182374
+ while (Date.now() - pollStart < pollMaxMs) {
182375
+ await new Promise((resolve28) => setTimeout(resolve28, pollInterval));
182376
+ pid = findProcessOnPort(port);
182377
+ if (pid !== null) break;
182378
+ }
182218
182379
  if (pid !== null) {
182219
182380
  output(
182220
182381
  ctx,
@@ -183791,7 +183952,7 @@ ${chalk22.bold("Telemetry \u7EDF\u8BA1")}:
183791
183952
  init_lib();
183792
183953
  init_update();
183793
183954
  var execAsync11 = promisify(exec);
183794
- var CURRENT_VERSION = "1.1.9";
183955
+ var CURRENT_VERSION = "1.2.0";
183795
183956
  var GITHUB_REPO = "LinXueyuanStdio/viben";
183796
183957
  var NPM_PACKAGE = "viben";
183797
183958
  function compareSemver(a, b) {
@@ -192067,7 +192228,7 @@ function registerCommands(program) {
192067
192228
  registerPageCommand(program);
192068
192229
  registerAccountCommand(program);
192069
192230
  }
192070
- var VERSION4 = "1.1.9";
192231
+ var VERSION4 = "1.2.0";
192071
192232
  function createProgram() {
192072
192233
  const program = new Command();
192073
192234
  program.name("viben").description("Viben - Agent Swarm \xD7 Code Evolution").version(VERSION4, "-v, --version", "Output the version number");