viben 1.1.9 → 1.2.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.cjs CHANGED
@@ -2168,7 +2168,7 @@ __export(index_exports, {
2168
2168
  module.exports = __toCommonJS(index_exports);
2169
2169
 
2170
2170
  // ../../packages/core/dist/index.js
2171
- var os2 = __toESM(require("os"), 1);
2171
+ var os3 = __toESM(require("os"), 1);
2172
2172
  var import_os = __toESM(require("os"), 1);
2173
2173
  var path21 = __toESM(require("path"), 1);
2174
2174
  var import_path = __toESM(require("path"), 1);
@@ -12241,7 +12241,7 @@ function cleanOldTelemetryFiles(baseDir, retentionDays = 7) {
12241
12241
  }
12242
12242
  }
12243
12243
  function getDefaultTelemetryDir() {
12244
- const stateDir = process.env.VIBEN_STATE_DIR || path21.join(process.env.HOME || "~", ".viben");
12244
+ const stateDir = process.env.VIBEN_STATE_DIR || path21.join(os3.homedir(), ".viben");
12245
12245
  return path21.join(stateDir, "telemetry");
12246
12246
  }
12247
12247
  var init_telemetry = __esm({
@@ -24078,14 +24078,14 @@ var require_is_docker = __commonJS2({
24078
24078
  });
24079
24079
  var require_is_wsl = __commonJS2({
24080
24080
  "../../node_modules/.pnpm/is-wsl@2.2.0/node_modules/is-wsl/index.js"(exports2, module2) {
24081
- var os4 = __require("os");
24081
+ var os5 = __require("os");
24082
24082
  var fs23 = __require("fs");
24083
24083
  var isDocker = require_is_docker();
24084
24084
  var isWsl = () => {
24085
24085
  if (process.platform !== "linux") {
24086
24086
  return false;
24087
24087
  }
24088
- if (os4.release().toLowerCase().includes("microsoft")) {
24088
+ if (os5.release().toLowerCase().includes("microsoft")) {
24089
24089
  if (isDocker()) {
24090
24090
  return false;
24091
24091
  }
@@ -24112,7 +24112,7 @@ var require_utils2 = __commonJS2({
24112
24112
  var isWSL = require_is_wsl();
24113
24113
  var path24 = __require("path");
24114
24114
  var url2 = __require("url");
24115
- var os4 = __require("os");
24115
+ var os5 = __require("os");
24116
24116
  var fs23 = __require("fs");
24117
24117
  var net2 = __require("net");
24118
24118
  var BUFFER_SIZE = 1024;
@@ -24498,19 +24498,19 @@ var require_utils2 = __commonJS2({
24498
24498
  return options;
24499
24499
  };
24500
24500
  module2.exports.isMac = function() {
24501
- return os4.type() === "Darwin";
24501
+ return os5.type() === "Darwin";
24502
24502
  };
24503
24503
  module2.exports.isMountainLion = function() {
24504
- return os4.type() === "Darwin" && semver.satisfies(garanteeSemverFormat(os4.release()), ">=12.0.0");
24504
+ return os5.type() === "Darwin" && semver.satisfies(garanteeSemverFormat(os5.release()), ">=12.0.0");
24505
24505
  };
24506
24506
  module2.exports.isWin8 = function() {
24507
- return os4.type() === "Windows_NT" && semver.satisfies(garanteeSemverFormat(os4.release()), ">=6.2.9200");
24507
+ return os5.type() === "Windows_NT" && semver.satisfies(garanteeSemverFormat(os5.release()), ">=6.2.9200");
24508
24508
  };
24509
24509
  module2.exports.isWSL = function() {
24510
24510
  return isWSL;
24511
24511
  };
24512
24512
  module2.exports.isLessThanWin8 = function() {
24513
- return os4.type() === "Windows_NT" && semver.satisfies(garanteeSemverFormat(os4.release()), "<6.2.9200");
24513
+ return os5.type() === "Windows_NT" && semver.satisfies(garanteeSemverFormat(os5.release()), "<6.2.9200");
24514
24514
  };
24515
24515
  function garanteeSemverFormat(version2) {
24516
24516
  if (version2.split(".").length === 2) {
@@ -24762,7 +24762,7 @@ var require_which = __commonJS2({
24762
24762
  });
24763
24763
  var require_notifysend = __commonJS2({
24764
24764
  "../../node_modules/.pnpm/node-notifier@10.0.1/node_modules/node-notifier/notifiers/notifysend.js"(exports2, module2) {
24765
- var os4 = __require("os");
24765
+ var os5 = __require("os");
24766
24766
  var which3 = require_which();
24767
24767
  var utils = require_utils2();
24768
24768
  var EventEmitter14 = __require("events").EventEmitter;
@@ -24796,7 +24796,7 @@ var require_notifysend = __commonJS2({
24796
24796
  callback(new Error("Message is required."));
24797
24797
  return this;
24798
24798
  }
24799
- if (os4.type() !== "Linux" && !os4.type().match(/BSD$/)) {
24799
+ if (os5.type() !== "Linux" && !os5.type().match(/BSD$/)) {
24800
24800
  callback(new Error("Only supported on Linux and *BSD systems"));
24801
24801
  return this;
24802
24802
  }
@@ -25214,7 +25214,7 @@ var require_balloon = __commonJS2({
25214
25214
  var utils = require_utils2();
25215
25215
  var Toaster = require_toaster();
25216
25216
  var Growl = require_growl();
25217
- var os4 = __require("os");
25217
+ var os5 = __require("os");
25218
25218
  var EventEmitter14 = __require("events").EventEmitter;
25219
25219
  var util3 = __require("util");
25220
25220
  var hasGrowl;
@@ -25282,7 +25282,7 @@ var require_balloon = __commonJS2({
25282
25282
  });
25283
25283
  var allowedArguments = ["t", "d", "p", "m", "i", "e", "q", "w", "xp"];
25284
25284
  function doNotification(options, notifierOptions, callback) {
25285
- const is64Bit = os4.arch() === "x64";
25285
+ const is64Bit = os5.arch() === "x64";
25286
25286
  options = options || {};
25287
25287
  options = utils.mapToNotifu(options);
25288
25288
  options.p = options.p || "Node Notification:";
@@ -25638,7 +25638,7 @@ var require_toaster = __commonJS2({
25638
25638
  var notifier = path24.resolve(__dirname, "../vendor/snoreToast/snoretoast");
25639
25639
  var utils = require_utils2();
25640
25640
  var Balloon = require_balloon();
25641
- var os4 = __require("os");
25641
+ var os5 = __require("os");
25642
25642
  var { v4: uuid } = (init_esm_node(), __toCommonJS2(esm_node_exports));
25643
25643
  var EventEmitter14 = __require("events").EventEmitter;
25644
25644
  var util3 = __require("util");
@@ -25677,7 +25677,7 @@ var require_toaster = __commonJS2({
25677
25677
  function notifyRaw(options, callback) {
25678
25678
  options = utils.clone(options || {});
25679
25679
  callback = callback || noop2;
25680
- const is64Bit = os4.arch() === "x64";
25680
+ const is64Bit = os5.arch() === "x64";
25681
25681
  let resultBuffer;
25682
25682
  const server = {
25683
25683
  namedPipe: getPipeName()
@@ -25752,7 +25752,7 @@ var require_toaster = __commonJS2({
25752
25752
  });
25753
25753
  var require_node_notifier = __commonJS2({
25754
25754
  "../../node_modules/.pnpm/node-notifier@10.0.1/node_modules/node-notifier/index.js"(exports2, module2) {
25755
- var os4 = __require("os");
25755
+ var os5 = __require("os");
25756
25756
  var utils = require_utils2();
25757
25757
  var NotifySend = require_notifysend();
25758
25758
  var NotificationCenter = require_notificationcenter();
@@ -25760,7 +25760,7 @@ var require_node_notifier = __commonJS2({
25760
25760
  var Growl = require_growl();
25761
25761
  var WindowsBalloon = require_balloon();
25762
25762
  var options = { withFallback: true };
25763
- var osType = utils.isWSL() ? "WSL" : os4.type();
25763
+ var osType = utils.isWSL() ? "WSL" : os5.type();
25764
25764
  switch (osType) {
25765
25765
  case "Linux":
25766
25766
  module2.exports = new NotifySend(options);
@@ -25784,7 +25784,7 @@ var require_node_notifier = __commonJS2({
25784
25784
  module2.exports.Notification = WindowsToaster;
25785
25785
  break;
25786
25786
  default:
25787
- if (os4.type().match(/BSD$/)) {
25787
+ if (os5.type().match(/BSD$/)) {
25788
25788
  module2.exports = new NotifySend(options);
25789
25789
  module2.exports.Notification = NotifySend;
25790
25790
  } else {
@@ -36779,7 +36779,7 @@ var require_get_proto = __commonJS2({
36779
36779
  }
36780
36780
  });
36781
36781
  var require_hasown = __commonJS2({
36782
- "../../node_modules/.pnpm/hasown@2.0.2/node_modules/hasown/index.js"(exports2, module2) {
36782
+ "../../node_modules/.pnpm/hasown@2.0.3/node_modules/hasown/index.js"(exports2, module2) {
36783
36783
  var call = Function.prototype.call;
36784
36784
  var $hasOwn = Object.prototype.hasOwnProperty;
36785
36785
  var bind2 = require_function_bind();
@@ -38953,7 +38953,7 @@ var require_has_flag = __commonJS2({
38953
38953
  });
38954
38954
  var require_supports_color = __commonJS2({
38955
38955
  "../../node_modules/.pnpm/supports-color@8.1.1/node_modules/supports-color/index.js"(exports2, module2) {
38956
- var os4 = __require("os");
38956
+ var os5 = __require("os");
38957
38957
  var tty = __require("tty");
38958
38958
  var hasFlag = require_has_flag();
38959
38959
  var { env } = process;
@@ -39010,7 +39010,7 @@ var require_supports_color = __commonJS2({
39010
39010
  return min;
39011
39011
  }
39012
39012
  if (process.platform === "win32") {
39013
- const osRelease = os4.release().split(".");
39013
+ const osRelease = os5.release().split(".");
39014
39014
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
39015
39015
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
39016
39016
  }
@@ -42849,7 +42849,7 @@ var require_object_inspect = __commonJS2({
42849
42849
  }
42850
42850
  });
42851
42851
  var require_side_channel_list = __commonJS2({
42852
- "../../node_modules/.pnpm/side-channel-list@1.0.0/node_modules/side-channel-list/index.js"(exports2, module2) {
42852
+ "../../node_modules/.pnpm/side-channel-list@1.0.1/node_modules/side-channel-list/index.js"(exports2, module2) {
42853
42853
  var inspect2 = require_object_inspect();
42854
42854
  var $TypeError = require_type();
42855
42855
  var listGetNode = function(list2, key, isDelete) {
@@ -42908,9 +42908,8 @@ var require_side_channel_list = __commonJS2({
42908
42908
  }
42909
42909
  },
42910
42910
  "delete": function(key) {
42911
- var root = $o && $o.next;
42912
42911
  var deletedNode = listDelete($o, key);
42913
- if (deletedNode && root && root === deletedNode) {
42912
+ if (deletedNode && $o && !$o.next) {
42914
42913
  $o = void 0;
42915
42914
  }
42916
42915
  return !!deletedNode;
@@ -132529,9 +132528,9 @@ var init_session_store = __esm({
132529
132528
  }
132530
132529
  });
132531
132530
  async function sendNotification(options) {
132532
- const os4 = (0, import_os.platform)();
132531
+ const os5 = (0, import_os.platform)();
132533
132532
  try {
132534
- switch (os4) {
132533
+ switch (os5) {
132535
132534
  case "darwin":
132536
132535
  return await sendMacOSNotification(options);
132537
132536
  case "linux":
@@ -132539,7 +132538,7 @@ async function sendNotification(options) {
132539
132538
  case "win32":
132540
132539
  return await sendWindowsNotification(options);
132541
132540
  default:
132542
- console.warn(`[Notifications] Unsupported platform: ${os4}`);
132541
+ console.warn(`[Notifications] Unsupported platform: ${os5}`);
132543
132542
  return false;
132544
132543
  }
132545
132544
  } catch (error) {
@@ -135477,7 +135476,7 @@ async function getCodexPath() {
135477
135476
  // Local node_modules
135478
135477
  "./node_modules/.bin/codex",
135479
135478
  // User's npm bin
135480
- `${process.env.HOME}/.npm-global/bin/codex`,
135479
+ `${(0, import_os.homedir)()}/.npm-global/bin/codex`,
135481
135480
  // Homebrew on macOS
135482
135481
  "/opt/homebrew/bin/codex",
135483
135482
  "/usr/local/bin/codex"
@@ -135575,8 +135574,8 @@ Error: ${err.message}`,
135575
135574
  provider: { type: "codex", name: this.name }
135576
135575
  };
135577
135576
  }
135578
- const os4 = (0, import_os.platform)();
135579
- const sandboxSubcommand = os4 === "darwin" ? "macos" : "linux";
135577
+ const os5 = (0, import_os.platform)();
135578
+ const sandboxSubcommand = os5 === "darwin" ? "macos" : "linux";
135580
135579
  const spawnArgs = [
135581
135580
  "sandbox",
135582
135581
  sandboxSubcommand,
@@ -135645,7 +135644,7 @@ async function getSrtPath() {
135645
135644
  // Local node_modules
135646
135645
  "./node_modules/.bin/srt",
135647
135646
  // User's npm bin
135648
- `${process.env.HOME}/.npm-global/bin/srt`,
135647
+ `${(0, import_os.homedir)()}/.npm-global/bin/srt`,
135649
135648
  // Homebrew on macOS
135650
135649
  "/opt/homebrew/bin/srt",
135651
135650
  "/usr/local/bin/srt"
@@ -137276,8 +137275,7 @@ var init_mcp_monitor = __esm({
137276
137275
  }
137277
137276
  });
137278
137277
  function getMcpServersConfigPath() {
137279
- const homedir30 = process.env.HOME || process.env.USERPROFILE || "";
137280
- return path21.join(homedir30, ".viben", "mcp-servers.json");
137278
+ return path21.join((0, import_os.homedir)(), ".viben", "mcp-servers.json");
137281
137279
  }
137282
137280
  var log15;
137283
137281
  var ConfigWatcherService;
@@ -148707,7 +148705,7 @@ var startupConfig;
148707
148705
  var gatewayStartTime;
148708
148706
  var init_health = __esm({
148709
148707
  "src/gateway/routes/health.ts"() {
148710
- VERSION3 = "1.1.9";
148708
+ VERSION3 = "1.2.1";
148711
148709
  startupConfig = null;
148712
148710
  gatewayStartTime = Date.now();
148713
148711
  }
@@ -148716,7 +148714,7 @@ function encodeWorkspacePath(workspacePath) {
148716
148714
  return workspacePath.replace(/\//g, "-");
148717
148715
  }
148718
148716
  function getClaudeProjectsDir() {
148719
- return path21.join(os2.homedir(), ".claude", "projects");
148717
+ return path21.join(os3.homedir(), ".claude", "projects");
148720
148718
  }
148721
148719
  async function discoverClaudeCodeSessions(workspacePath) {
148722
148720
  const projectsDir = getClaudeProjectsDir();
@@ -148904,11 +148902,11 @@ function convertClaudeMessageToUI(msg) {
148904
148902
  }
148905
148903
  function getCodexSessionsDir() {
148906
148904
  if (process.platform === "darwin") {
148907
- return path21.join(os2.homedir(), "Library", "Application Support", "codex", "sessions");
148905
+ return path21.join(os3.homedir(), "Library", "Application Support", "codex", "sessions");
148908
148906
  } else if (process.platform === "win32") {
148909
148907
  return path21.join(process.env.APPDATA || "", "codex", "sessions");
148910
148908
  } else {
148911
- return path21.join(os2.homedir(), ".config", "codex", "sessions");
148909
+ return path21.join(os3.homedir(), ".config", "codex", "sessions");
148912
148910
  }
148913
148911
  }
148914
148912
  async function discoverCodexSessions(workspacePath) {
@@ -148999,10 +148997,10 @@ function convertCodexMessageToUI(msg) {
148999
148997
  }
149000
148998
  }
149001
148999
  function getExecutorConfigPaths(type2, workspacePath) {
149002
- const homedir30 = os2.homedir();
149000
+ const homedir34 = os3.homedir();
149003
149001
  switch (type2) {
149004
149002
  case "CLAUDE_CODE": {
149005
- const globalConfigDir = path21.join(homedir30, ".claude");
149003
+ const globalConfigDir = path21.join(homedir34, ".claude");
149006
149004
  const workspaceConfigDir = workspacePath ? path21.join(workspacePath, ".claude") : void 0;
149007
149005
  return {
149008
149006
  globalConfigPath: fs20.existsSync(globalConfigDir) ? globalConfigDir : void 0,
@@ -149014,11 +149012,11 @@ function getExecutorConfigPaths(type2, workspacePath) {
149014
149012
  case "CODEX": {
149015
149013
  let configDir;
149016
149014
  if (process.platform === "darwin") {
149017
- configDir = path21.join(homedir30, "Library", "Application Support", "codex");
149015
+ configDir = path21.join(homedir34, "Library", "Application Support", "codex");
149018
149016
  } else if (process.platform === "win32") {
149019
149017
  configDir = path21.join(process.env.APPDATA || "", "codex");
149020
149018
  } else {
149021
- configDir = path21.join(homedir30, ".config", "codex");
149019
+ configDir = path21.join(homedir34, ".config", "codex");
149022
149020
  }
149023
149021
  const workspaceConfigDir = workspacePath ? path21.join(workspacePath, ".codex") : void 0;
149024
149022
  return {
@@ -149031,11 +149029,11 @@ function getExecutorConfigPaths(type2, workspacePath) {
149031
149029
  case "CURSOR_AGENT": {
149032
149030
  let configDir;
149033
149031
  if (process.platform === "darwin") {
149034
- configDir = path21.join(homedir30, "Library", "Application Support", "Cursor", "User");
149032
+ configDir = path21.join(homedir34, "Library", "Application Support", "Cursor", "User");
149035
149033
  } else if (process.platform === "win32") {
149036
149034
  configDir = path21.join(process.env.APPDATA || "", "Cursor", "User");
149037
149035
  } else {
149038
- configDir = path21.join(homedir30, ".config", "Cursor", "User");
149036
+ configDir = path21.join(homedir34, ".config", "Cursor", "User");
149039
149037
  }
149040
149038
  const workspaceConfigDir = workspacePath ? path21.join(workspacePath, ".cursor") : void 0;
149041
149039
  return {
@@ -149046,7 +149044,7 @@ function getExecutorConfigPaths(type2, workspacePath) {
149046
149044
  };
149047
149045
  }
149048
149046
  case "GEMINI": {
149049
- const globalConfigDir = path21.join(homedir30, ".gemini");
149047
+ const globalConfigDir = path21.join(homedir34, ".gemini");
149050
149048
  const workspaceConfigDir = workspacePath ? path21.join(workspacePath, ".gemini") : void 0;
149051
149049
  return {
149052
149050
  globalConfigPath: fs20.existsSync(globalConfigDir) ? globalConfigDir : void 0,
@@ -149058,11 +149056,11 @@ function getExecutorConfigPaths(type2, workspacePath) {
149058
149056
  case "AMP": {
149059
149057
  let configDir;
149060
149058
  if (process.platform === "darwin") {
149061
- configDir = path21.join(homedir30, "Library", "Application Support", "amp");
149059
+ configDir = path21.join(homedir34, "Library", "Application Support", "amp");
149062
149060
  } else if (process.platform === "win32") {
149063
149061
  configDir = path21.join(process.env.APPDATA || "", "amp");
149064
149062
  } else {
149065
- configDir = path21.join(homedir30, ".config", "amp");
149063
+ configDir = path21.join(homedir34, ".config", "amp");
149066
149064
  }
149067
149065
  const workspaceConfigDir = workspacePath ? path21.join(workspacePath, ".amp") : void 0;
149068
149066
  return {
@@ -149073,7 +149071,7 @@ function getExecutorConfigPaths(type2, workspacePath) {
149073
149071
  };
149074
149072
  }
149075
149073
  case "OPENCLAW": {
149076
- const globalConfigDir = path21.join(homedir30, ".openclaw");
149074
+ const globalConfigDir = path21.join(homedir34, ".openclaw");
149077
149075
  const globalConfigFile = path21.join(globalConfigDir, "openclaw.json");
149078
149076
  const workspaceConfigDir = workspacePath ? path21.join(workspacePath, ".openclaw") : void 0;
149079
149077
  return {
@@ -149084,7 +149082,7 @@ function getExecutorConfigPaths(type2, workspacePath) {
149084
149082
  };
149085
149083
  }
149086
149084
  default: {
149087
- const globalConfigDir = path21.join(homedir30, ".viben");
149085
+ const globalConfigDir = path21.join(homedir34, ".viben");
149088
149086
  const workspaceConfigDir = workspacePath ? path21.join(workspacePath, ".viben") : void 0;
149089
149087
  return {
149090
149088
  globalConfigPath: fs20.existsSync(globalConfigDir) ? globalConfigDir : void 0,
@@ -149163,7 +149161,7 @@ function checkExecutorAvailability(type2, workspacePath) {
149163
149161
  supports_mcp: supportsMcp,
149164
149162
  capabilities,
149165
149163
  has_workspace_config: hasWorkspaceConfig,
149166
- workspace_path: workspacePath || os2.homedir()
149164
+ workspace_path: workspacePath || os3.homedir()
149167
149165
  };
149168
149166
  }
149169
149167
  function discoverExecutors(workspacePath) {
@@ -149229,7 +149227,7 @@ function registerExecutorRoutes(fastify2) {
149229
149227
  const executors = discoverExecutors(workspacePath);
149230
149228
  return {
149231
149229
  executors,
149232
- workspace_path: workspacePath || os2.homedir(),
149230
+ workspace_path: workspacePath || os3.homedir(),
149233
149231
  include_global: includeGlobal,
149234
149232
  total: executors.length
149235
149233
  };
@@ -149288,12 +149286,12 @@ function registerExecutorRoutes(fastify2) {
149288
149286
  return { messages, total: messages.length };
149289
149287
  });
149290
149288
  function getMcpConfigPath(workspacePath, executorType) {
149291
- const base = workspacePath || os2.homedir();
149289
+ const base = workspacePath || os3.homedir();
149292
149290
  switch (executorType) {
149293
149291
  case "CLAUDE_CODE":
149294
149292
  const projectMcp = path21.join(base, ".mcp.json");
149295
149293
  if (fs20.existsSync(projectMcp)) return projectMcp;
149296
- return path21.join(os2.homedir(), ".claude.json");
149294
+ return path21.join(os3.homedir(), ".claude.json");
149297
149295
  case "CURSOR_AGENT":
149298
149296
  return path21.join(base, ".cursor", "mcp.json");
149299
149297
  default:
@@ -149340,7 +149338,7 @@ function registerExecutorRoutes(fastify2) {
149340
149338
  return { servers, total: servers.length };
149341
149339
  });
149342
149340
  function getSkillsConfigPath(workspacePath, executorType) {
149343
- const base = workspacePath || os2.homedir();
149341
+ const base = workspacePath || os3.homedir();
149344
149342
  switch (executorType) {
149345
149343
  case "CLAUDE_CODE":
149346
149344
  return {
@@ -149436,7 +149434,7 @@ function registerExecutorRoutes(fastify2) {
149436
149434
  return { skills, total: skills.length };
149437
149435
  });
149438
149436
  function getSubagentsPath(workspacePath, executorType) {
149439
- const base = workspacePath || os2.homedir();
149437
+ const base = workspacePath || os3.homedir();
149440
149438
  switch (executorType) {
149441
149439
  case "CLAUDE_CODE":
149442
149440
  return path21.join(base, ".claude", "agents");
@@ -149527,7 +149525,7 @@ function registerExecutorRoutes(fastify2) {
149527
149525
  }
149528
149526
  });
149529
149527
  function getCommandsPath(workspacePath, executorType) {
149530
- const base = workspacePath || os2.homedir();
149528
+ const base = workspacePath || os3.homedir();
149531
149529
  switch (executorType) {
149532
149530
  case "CLAUDE_CODE":
149533
149531
  return path21.join(base, ".claude", "commands");
@@ -149634,7 +149632,7 @@ function registerExecutorRoutes(fastify2) {
149634
149632
  }
149635
149633
  });
149636
149634
  function getPromptsPath(workspacePath, executorType) {
149637
- const base = workspacePath || os2.homedir();
149635
+ const base = workspacePath || os3.homedir();
149638
149636
  switch (executorType) {
149639
149637
  case "CLAUDE_CODE":
149640
149638
  return path21.join(base, ".claude", "prompts");
@@ -150035,7 +150033,7 @@ function registerAgentRoutes(fastify2, state) {
150035
150033
  }, async (request) => {
150036
150034
  const { workspace_path, include_global } = request.query;
150037
150035
  const includeGlobal = include_global !== "false";
150038
- const homeDir = process.env.HOME || "/";
150036
+ const homeDir = (0, import_os.homedir)();
150039
150037
  const transformAgent = (a, sourceOverride, workspacePathOverride) => {
150040
150038
  if (!a) return null;
150041
150039
  const source = sourceOverride || (a.path && a.path.startsWith(homeDir) && a.path.includes("/.viben/agents/") ? "global" : "workspace");
@@ -150113,7 +150111,7 @@ function registerAgentRoutes(fastify2, state) {
150113
150111
  approvals: body.approvals
150114
150112
  });
150115
150113
  reply.code(201);
150116
- const homeDir = process.env.HOME || "/";
150114
+ const homeDir = (0, import_os.homedir)();
150117
150115
  const isGlobalAgent = agent.path && agent.path.startsWith(homeDir) && agent.path.includes("/.viben/agents/");
150118
150116
  const agentSource = isGlobalAgent ? "global" : "workspace";
150119
150117
  const agentWorkspacePath = !isGlobalAgent && agent.path ? agent.path.replace(/\/.viben\/agents\/[^/]+$/, "") : void 0;
@@ -150237,7 +150235,7 @@ function registerAgentRoutes(fastify2, state) {
150237
150235
  try {
150238
150236
  const agent = await agentManager.createFromTemplate(id, agent_id, { name, base_path }, template_workspace_path);
150239
150237
  reply.code(201);
150240
- const homeDir = process.env.HOME || "/";
150238
+ const homeDir = (0, import_os.homedir)();
150241
150239
  const isGlobalAgent = agent.path && agent.path.startsWith(homeDir) && agent.path.includes("/.viben/agents/");
150242
150240
  const agentSource = isGlobalAgent ? "global" : "workspace";
150243
150241
  const agentWorkspacePath = !isGlobalAgent && agent.path ? agent.path.replace(/\/.viben\/agents\/[^/]+$/, "") : void 0;
@@ -150488,7 +150486,7 @@ function registerAgentRoutes(fastify2, state) {
150488
150486
  "/api/agent/:id/availability",
150489
150487
  async (request, reply) => {
150490
150488
  const { id } = request.params;
150491
- const homeDir = process.env.HOME || "/";
150489
+ const homeDir = (0, import_os.homedir)();
150492
150490
  const executorTypes = [
150493
150491
  "CLAUDE_CODE",
150494
150492
  "CODEX",
@@ -150644,7 +150642,7 @@ function registerAgentRoutes(fastify2, state) {
150644
150642
  fastify2.get("/api/agent/:id", async (request, reply) => {
150645
150643
  const { id } = request.params;
150646
150644
  const { workspace_path } = request.query;
150647
- const homeDir = process.env.HOME || "/";
150645
+ const homeDir = (0, import_os.homedir)();
150648
150646
  let agent = null;
150649
150647
  let source = "global";
150650
150648
  if (workspace_path) {
@@ -150714,7 +150712,7 @@ function registerAgentRoutes(fastify2, state) {
150714
150712
  };
150715
150713
  try {
150716
150714
  const agent = await agentManager.updateAgent(id, updates, workspace_path);
150717
- const homeDir = process.env.HOME || "/";
150715
+ const homeDir = (0, import_os.homedir)();
150718
150716
  const isGlobalAgent = agent.path && agent.path.startsWith(homeDir) && agent.path.includes("/.viben/agents/");
150719
150717
  const agentSource = isGlobalAgent ? "global" : "workspace";
150720
150718
  const agentWorkspacePath = !isGlobalAgent && agent.path ? agent.path.replace(/\/.viben\/agents\/[^/]+$/, "") : void 0;
@@ -157577,7 +157575,7 @@ var init_history2 = __esm({
157577
157575
  }
157578
157576
  });
157579
157577
  function getDefaultShell() {
157580
- if (os2.platform() === "win32") {
157578
+ if (os3.platform() === "win32") {
157581
157579
  return process.env.COMSPEC || "cmd.exe";
157582
157580
  }
157583
157581
  return process.env.SHELL || "/bin/bash";
@@ -163172,11 +163170,46 @@ function getPythonCandidates() {
163172
163170
  );
163173
163171
  } else if (process.platform === "win32") {
163174
163172
  const localAppData = process.env.LOCALAPPDATA || (0, import_path.join)(home, "AppData/Local");
163173
+ candidates.push("py", "C:\\Windows\\py.exe");
163175
163174
  candidates.push(
163175
+ (0, import_path.join)(localAppData, "Programs/Python/Python314/python.exe"),
163176
163176
  (0, import_path.join)(localAppData, "Programs/Python/Python313/python.exe"),
163177
163177
  (0, import_path.join)(localAppData, "Programs/Python/Python312/python.exe"),
163178
163178
  (0, import_path.join)(localAppData, "Programs/Python/Python311/python.exe"),
163179
- (0, import_path.join)(localAppData, "Programs/Python/Python310/python.exe")
163179
+ (0, import_path.join)(localAppData, "Programs/Python/Python310/python.exe"),
163180
+ (0, import_path.join)(localAppData, "Programs/Python/Python39/python.exe")
163181
+ );
163182
+ candidates.push(
163183
+ (0, import_path.join)(localAppData, "Microsoft/WindowsApps/python.exe"),
163184
+ (0, import_path.join)(localAppData, "Microsoft/WindowsApps/python3.exe")
163185
+ );
163186
+ candidates.push(
163187
+ (0, import_path.join)(home, ".pyenv/pyenv-win/shims/python.exe"),
163188
+ (0, import_path.join)(home, ".pyenv/pyenv-win/shims/python3.exe")
163189
+ );
163190
+ candidates.push((0, import_path.join)(home, "scoop/apps/python/current/python.exe"));
163191
+ candidates.push(
163192
+ (0, import_path.join)(home, "miniconda3/python.exe"),
163193
+ (0, import_path.join)(home, "anaconda3/python.exe"),
163194
+ (0, import_path.join)(home, "Miniconda3/python.exe"),
163195
+ (0, import_path.join)(home, "Anaconda3/python.exe"),
163196
+ (0, import_path.join)(localAppData, "miniconda3/python.exe"),
163197
+ (0, import_path.join)(localAppData, "anaconda3/python.exe")
163198
+ );
163199
+ candidates.push(
163200
+ "C:\\ProgramData\\miniconda3\\python.exe",
163201
+ "C:\\ProgramData\\anaconda3\\python.exe",
163202
+ "C:\\ProgramData\\Miniconda3\\python.exe",
163203
+ "C:\\ProgramData\\Anaconda3\\python.exe",
163204
+ "C:\\miniconda3\\python.exe",
163205
+ "C:\\anaconda3\\python.exe"
163206
+ );
163207
+ candidates.push(
163208
+ "C:\\Python314\\python.exe",
163209
+ "C:\\Python313\\python.exe",
163210
+ "C:\\Python312\\python.exe",
163211
+ "C:\\Python311\\python.exe",
163212
+ "C:\\Python310\\python.exe"
163180
163213
  );
163181
163214
  } else {
163182
163215
  candidates.push(
@@ -163188,9 +163221,10 @@ function getPythonCandidates() {
163188
163221
  }
163189
163222
  return candidates;
163190
163223
  }
163191
- async function isExecutable(path24) {
163224
+ async function isExecutable(filePath) {
163192
163225
  try {
163193
- await (0, import_promises.access)(path24, import_promises.constants.X_OK);
163226
+ const mode = process.platform === "win32" ? import_promises.constants.F_OK : import_promises.constants.X_OK;
163227
+ await (0, import_promises.access)(filePath, mode);
163194
163228
  return true;
163195
163229
  } catch {
163196
163230
  return false;
@@ -163199,20 +163233,29 @@ async function isExecutable(path24) {
163199
163233
  async function checkPython(path24) {
163200
163234
  try {
163201
163235
  let actualPath = path24;
163202
- if (!path24.startsWith("/") && !path24.includes("\\")) {
163236
+ const isAbsolute6 = path24.startsWith("/") || /^[A-Za-z]:[\\/]/.test(path24);
163237
+ if (!isAbsolute6) {
163203
163238
  try {
163204
- const { stdout: stdout2 } = await execAsync5(`which ${path24}`);
163205
- actualPath = stdout2.trim();
163239
+ const whichCmd = process.platform === "win32" ? `where "${path24}"` : `which ${path24}`;
163240
+ const { stdout: stdout2 } = await execAsync5(whichCmd, { windowsHide: true });
163241
+ actualPath = stdout2.trim().split(/\r?\n/)[0].trim();
163206
163242
  } catch {
163207
163243
  }
163208
163244
  }
163209
- if (actualPath.startsWith("/") || actualPath.includes("\\")) {
163210
- if (!await isExecutable(actualPath)) {
163245
+ if (actualPath.startsWith("/") || /^[A-Za-z]:[\\/]/.test(actualPath)) {
163246
+ if (process.platform === "win32") {
163247
+ try {
163248
+ await (0, import_promises.access)(actualPath, import_promises.constants.F_OK);
163249
+ } catch {
163250
+ return null;
163251
+ }
163252
+ } else if (!await isExecutable(actualPath)) {
163211
163253
  return null;
163212
163254
  }
163213
163255
  }
163214
163256
  const { stdout, stderr } = await execAsync5(`"${actualPath}" --version`, {
163215
- timeout: 5e3
163257
+ timeout: 5e3,
163258
+ windowsHide: true
163216
163259
  });
163217
163260
  const versionOutput = stdout.trim() || stderr.trim();
163218
163261
  const versionMatch = versionOutput.match(/Python\s+(\d+\.\d+\.\d+)/);
@@ -163306,11 +163349,49 @@ function getCliToolCandidates(tool) {
163306
163349
  const programFiles = process.env.ProgramFiles || "C:\\Program Files";
163307
163350
  const programFilesX86 = process.env["ProgramFiles(x86)"] || "C:\\Program Files (x86)";
163308
163351
  if (tool === "python") {
163352
+ candidates.push("python", "python3", "py");
163353
+ candidates.push("C:\\Windows\\py.exe");
163309
163354
  candidates.push(
163355
+ (0, import_path.join)(localAppData, "Programs/Python/Python314/python.exe"),
163310
163356
  (0, import_path.join)(localAppData, "Programs/Python/Python313/python.exe"),
163311
163357
  (0, import_path.join)(localAppData, "Programs/Python/Python312/python.exe"),
163312
163358
  (0, import_path.join)(localAppData, "Programs/Python/Python311/python.exe"),
163313
- (0, import_path.join)(localAppData, "Programs/Python/Python310/python.exe")
163359
+ (0, import_path.join)(localAppData, "Programs/Python/Python310/python.exe"),
163360
+ (0, import_path.join)(localAppData, "Programs/Python/Python39/python.exe")
163361
+ );
163362
+ candidates.push(
163363
+ (0, import_path.join)(localAppData, "Microsoft/WindowsApps/python.exe"),
163364
+ (0, import_path.join)(localAppData, "Microsoft/WindowsApps/python3.exe")
163365
+ );
163366
+ candidates.push(
163367
+ (0, import_path.join)(home, ".pyenv/pyenv-win/shims/python.exe"),
163368
+ (0, import_path.join)(home, ".pyenv/pyenv-win/shims/python3.exe")
163369
+ );
163370
+ candidates.push(
163371
+ (0, import_path.join)(home, "scoop/apps/python/current/python.exe")
163372
+ );
163373
+ candidates.push(
163374
+ (0, import_path.join)(home, "miniconda3/python.exe"),
163375
+ (0, import_path.join)(home, "anaconda3/python.exe"),
163376
+ (0, import_path.join)(home, "Miniconda3/python.exe"),
163377
+ (0, import_path.join)(home, "Anaconda3/python.exe"),
163378
+ (0, import_path.join)(localAppData, "miniconda3/python.exe"),
163379
+ (0, import_path.join)(localAppData, "anaconda3/python.exe")
163380
+ );
163381
+ candidates.push(
163382
+ "C:\\ProgramData\\miniconda3\\python.exe",
163383
+ "C:\\ProgramData\\anaconda3\\python.exe",
163384
+ "C:\\ProgramData\\Miniconda3\\python.exe",
163385
+ "C:\\ProgramData\\Anaconda3\\python.exe",
163386
+ "C:\\miniconda3\\python.exe",
163387
+ "C:\\anaconda3\\python.exe"
163388
+ );
163389
+ candidates.push(
163390
+ "C:\\Python314\\python.exe",
163391
+ "C:\\Python313\\python.exe",
163392
+ "C:\\Python312\\python.exe",
163393
+ "C:\\Python311\\python.exe",
163394
+ "C:\\Python310\\python.exe"
163314
163395
  );
163315
163396
  } else if (tool === "git") {
163316
163397
  candidates.push(
@@ -163380,7 +163461,8 @@ async function detectCliToolVersion(toolPath, tool) {
163380
163461
  const versionArg = config.versionArg || "--version";
163381
163462
  try {
163382
163463
  const { stdout, stderr } = await execAsync5(`"${toolPath}" ${versionArg}`, {
163383
- timeout: 5e3
163464
+ timeout: 5e3,
163465
+ windowsHide: true
163384
163466
  });
163385
163467
  const output2 = stdout.trim() || stderr.trim();
163386
163468
  let version2 = null;
@@ -163468,12 +163550,12 @@ async function detectCliTool(tool, userConfigPath) {
163468
163550
  }
163469
163551
  }
163470
163552
  }
163471
- const toolCmd = tool === "python" ? "python3" : tool;
163553
+ const toolCmd = tool === "python" ? process.platform === "win32" ? "python" : "python3" : tool;
163472
163554
  try {
163473
163555
  const whichCmd = process.platform === "win32" ? "where" : "which";
163474
- const { stdout } = await execAsync5(`${whichCmd} ${toolCmd}`, { timeout: 5e3 });
163475
- const toolPath = stdout.trim().split("\n")[0];
163476
- if (toolPath) {
163556
+ const { stdout } = await execAsync5(`${whichCmd} ${toolCmd}`, { timeout: 5e3, windowsHide: true });
163557
+ const toolPaths = stdout.trim().split(/\r?\n/).map((l) => l.trim()).filter(Boolean);
163558
+ for (const toolPath of toolPaths) {
163477
163559
  const { version: version2, valid } = await detectCliToolVersion(toolPath, tool);
163478
163560
  if (valid) {
163479
163561
  await addPath(toolPath, version2 || void 0, getToolSource(toolPath));
@@ -163481,6 +163563,77 @@ async function detectCliTool(tool, userConfigPath) {
163481
163563
  }
163482
163564
  } catch {
163483
163565
  }
163566
+ let condaBaseDir = null;
163567
+ if (tool === "python" && process.platform === "win32") {
163568
+ try {
163569
+ const { stdout: condaStdout } = await execAsync5("where conda", { timeout: 3e3, windowsHide: true });
163570
+ const condaExe = condaStdout.trim().split(/\r?\n/)[0].trim();
163571
+ if (condaExe) {
163572
+ condaBaseDir = (0, import_path.join)((0, import_path.dirname)(condaExe), "..");
163573
+ const pythonFromConda = (0, import_path.join)(condaBaseDir, "python.exe");
163574
+ if (await isExecutable(pythonFromConda)) {
163575
+ const { version: version2, valid } = await detectCliToolVersion(pythonFromConda, tool);
163576
+ if (valid) {
163577
+ await addPath(pythonFromConda, version2 || void 0, "system-path");
163578
+ }
163579
+ }
163580
+ }
163581
+ } catch {
163582
+ }
163583
+ }
163584
+ if (tool === "python") {
163585
+ const localAppData = process.env.LOCALAPPDATA || (0, import_path.join)(home, "AppData/Local");
163586
+ const condaBases = [];
163587
+ if (condaBaseDir) condaBases.push(condaBaseDir);
163588
+ if (process.platform === "win32") {
163589
+ condaBases.push(
163590
+ "C:\\ProgramData\\miniconda3",
163591
+ "C:\\ProgramData\\anaconda3",
163592
+ "C:\\ProgramData\\Miniconda3",
163593
+ "C:\\ProgramData\\Anaconda3",
163594
+ (0, import_path.join)(home, "miniconda3"),
163595
+ (0, import_path.join)(home, "anaconda3"),
163596
+ (0, import_path.join)(home, "Miniconda3"),
163597
+ (0, import_path.join)(home, "Anaconda3"),
163598
+ (0, import_path.join)(localAppData, "miniconda3"),
163599
+ (0, import_path.join)(localAppData, "anaconda3")
163600
+ );
163601
+ } else {
163602
+ condaBases.push(
163603
+ (0, import_path.join)(home, "miniconda3"),
163604
+ (0, import_path.join)(home, "anaconda3"),
163605
+ "/opt/miniconda3",
163606
+ "/opt/anaconda3"
163607
+ );
163608
+ }
163609
+ for (const existing of allPaths) {
163610
+ const parentDir = (0, import_path.dirname)(existing.path);
163611
+ if (!condaBases.includes(parentDir)) {
163612
+ condaBases.push(parentDir);
163613
+ }
163614
+ }
163615
+ const pythonInEnvSuffix = process.platform === "win32" ? "python.exe" : (0, import_path.join)("bin", "python");
163616
+ const seenEnvsDirs = /* @__PURE__ */ new Set();
163617
+ for (const base of condaBases) {
163618
+ const envsDir = (0, import_path.join)(base, "envs");
163619
+ if (seenEnvsDirs.has(envsDir)) continue;
163620
+ seenEnvsDirs.add(envsDir);
163621
+ try {
163622
+ const envEntries = await (0, import_promises.readdir)(envsDir, { withFileTypes: true });
163623
+ for (const envEntry of envEntries) {
163624
+ if (!envEntry.isDirectory()) continue;
163625
+ const pythonInEnv = (0, import_path.join)(envsDir, envEntry.name, pythonInEnvSuffix);
163626
+ if (await isExecutable(pythonInEnv)) {
163627
+ const { version: version2, valid } = await detectCliToolVersion(pythonInEnv, tool);
163628
+ if (valid) {
163629
+ await addPath(pythonInEnv, version2 || void 0, "system-path");
163630
+ }
163631
+ }
163632
+ }
163633
+ } catch {
163634
+ }
163635
+ }
163636
+ }
163484
163637
  if (config.detectMethod === "npm-global" && process.platform !== "win32") {
163485
163638
  const nvmVersionsDir = (0, import_path.join)(home, ".nvm/versions/node");
163486
163639
  try {
@@ -163610,7 +163763,7 @@ async function checkPackageInstalled(pythonPath, packageName) {
163610
163763
  const pipCommand = `"${pythonPath}" -m pip show ${packageName}`;
163611
163764
  log35.debug({ pipCommand }, "Checking package with pip");
163612
163765
  try {
163613
- const { stdout, stderr } = await execAsync5(pipCommand, { timeout: 1e4 });
163766
+ const { stdout, stderr } = await execAsync5(pipCommand, { timeout: 1e4, windowsHide: true });
163614
163767
  log35.debug({ stdout: stdout.slice(0, 200) }, "pip show stdout");
163615
163768
  if (stderr) {
163616
163769
  log35.debug({ stderr: stderr.slice(0, 200) }, "pip show stderr");
@@ -163630,7 +163783,7 @@ async function checkPackageInstalled(pythonPath, packageName) {
163630
163783
  const importCommand = `"${pythonPath}" -c "import ${moduleName2}; print(getattr(${moduleName2}, '__version__', 'unknown'))"`;
163631
163784
  log35.debug({ importCommand }, "Trying import");
163632
163785
  try {
163633
- const { stdout: importStdout } = await execAsync5(importCommand, { timeout: 1e4 });
163786
+ const { stdout: importStdout } = await execAsync5(importCommand, { timeout: 1e4, windowsHide: true });
163634
163787
  const version2 = importStdout.trim() || "unknown";
163635
163788
  log35.debug({ packageName, version: version2 }, "Package found via import");
163636
163789
  return {
@@ -163644,7 +163797,7 @@ async function checkPackageInstalled(pythonPath, packageName) {
163644
163797
  const moduleCommand = `"${pythonPath}" -m ${moduleName2} --version`;
163645
163798
  log35.debug({ moduleCommand }, "Trying module version");
163646
163799
  try {
163647
- const { stdout: modStdout } = await execAsync5(moduleCommand, { timeout: 1e4 });
163800
+ const { stdout: modStdout } = await execAsync5(moduleCommand, { timeout: 1e4, windowsHide: true });
163648
163801
  const versionMatch = modStdout.match(/(\d+\.\d+\.\d+)/);
163649
163802
  const version2 = versionMatch ? versionMatch[1] : "installed";
163650
163803
  log35.debug({ packageName, version: version2 }, "Package found via module");
@@ -182222,8 +182375,15 @@ async function startGateway(ctx, options) {
182222
182375
  });
182223
182376
  fs20.closeSync(logFd);
182224
182377
  child.unref();
182225
- await new Promise((resolve28) => setTimeout(resolve28, 500));
182226
- const pid = findProcessOnPort(port);
182378
+ let pid = null;
182379
+ const pollStart = Date.now();
182380
+ const pollMaxMs = 15e3;
182381
+ const pollInterval = 500;
182382
+ while (Date.now() - pollStart < pollMaxMs) {
182383
+ await new Promise((resolve28) => setTimeout(resolve28, pollInterval));
182384
+ pid = findProcessOnPort(port);
182385
+ if (pid !== null) break;
182386
+ }
182227
182387
  if (pid !== null) {
182228
182388
  output(
182229
182389
  ctx,
@@ -183800,7 +183960,7 @@ ${import_chalk.default.bold("Telemetry \u7EDF\u8BA1")}:
183800
183960
  init_lib();
183801
183961
  init_update();
183802
183962
  var execAsync11 = (0, import_util.promisify)(import_child_process.exec);
183803
- var CURRENT_VERSION = "1.1.9";
183963
+ var CURRENT_VERSION = "1.2.1";
183804
183964
  var GITHUB_REPO = "LinXueyuanStdio/viben";
183805
183965
  var NPM_PACKAGE = "viben";
183806
183966
  function compareSemver(a, b) {
@@ -192076,7 +192236,7 @@ function registerCommands(program) {
192076
192236
  registerPageCommand(program);
192077
192237
  registerAccountCommand(program);
192078
192238
  }
192079
- var VERSION4 = "1.1.9";
192239
+ var VERSION4 = "1.2.1";
192080
192240
  function createProgram() {
192081
192241
  const program = new import_commander.Command();
192082
192242
  program.name("viben").description("Viben - Agent Swarm \xD7 Code Evolution").version(VERSION4, "-v, --version", "Output the version number");