@hasna/connectors 1.4.3 → 1.4.4

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/bin/index.js CHANGED
@@ -1909,7 +1909,7 @@ var package_default;
1909
1909
  var init_package = __esm(() => {
1910
1910
  package_default = {
1911
1911
  name: "@hasna/connectors",
1912
- version: "1.4.3",
1912
+ version: "1.4.4",
1913
1913
  description: "Open source connector library - Install API connectors with a single command",
1914
1914
  type: "module",
1915
1915
  bin: {
@@ -40436,7 +40436,7 @@ var init_powershell_utils = __esm(() => {
40436
40436
  executePowerShell.escapeArgument = (value) => `'${String(value).replaceAll("'", "''")}'`;
40437
40437
  });
40438
40438
 
40439
- // ../../node_modules/.bun/wsl-utils@0.3.1/node_modules/wsl-utils/utilities.js
40439
+ // ../../node_modules/.bun/wsl-utils@1.0.0/node_modules/wsl-utils/utilities.js
40440
40440
  function parseMountPointFromConfig(content) {
40441
40441
  for (const line of content.split(`
40442
40442
  `)) {
@@ -40451,7 +40451,8 @@ function parseMountPointFromConfig(content) {
40451
40451
  }
40452
40452
  }
40453
40453
 
40454
- // ../../node_modules/.bun/wsl-utils@0.3.1/node_modules/wsl-utils/index.js
40454
+ // ../../node_modules/.bun/wsl-utils@1.0.0/node_modules/wsl-utils/index.js
40455
+ import path from "path";
40455
40456
  import { promisify as promisify2 } from "util";
40456
40457
  import childProcess2 from "child_process";
40457
40458
  import fs4, { constants as fsConstants } from "fs/promises";
@@ -40472,18 +40473,33 @@ var execFile2, wslDrivesMountPoint, powerShellPathFromWsl = async () => {
40472
40473
  }, wslDefaultBrowser = async () => {
40473
40474
  const psPath = await powerShellPath2();
40474
40475
  const command = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
40475
- const { stdout } = await executePowerShell(command, { powerShellPath: psPath });
40476
+ const { stdout } = await executePowerShell(command, {
40477
+ powerShellPath: psPath,
40478
+ cwd: path.dirname(psPath)
40479
+ });
40476
40480
  return stdout.trim();
40477
- }, convertWslPathToWindows = async (path) => {
40478
- if (/^[a-z]+:\/\//i.test(path)) {
40479
- return path;
40480
- }
40481
- try {
40482
- const { stdout } = await execFile2("wslpath", ["-aw", path], { encoding: "utf8" });
40483
- return stdout.trim();
40484
- } catch {
40485
- return path;
40481
+ }, isUrl = (path2) => /^[a-z]+:\/\//i.test(path2), convertWslPathToWindows = async (paths) => {
40482
+ const isBatch = Array.isArray(paths);
40483
+ const pathArray = isBatch ? paths : [paths];
40484
+ const indicesToConvert = [];
40485
+ const pathsToConvert = [];
40486
+ for (const [index, path2] of pathArray.entries()) {
40487
+ if (!isUrl(path2)) {
40488
+ indicesToConvert.push(index);
40489
+ pathsToConvert.push(path2);
40490
+ }
40491
+ }
40492
+ const results = [...pathArray];
40493
+ if (pathsToConvert.length > 0) {
40494
+ try {
40495
+ const { stdout } = await execFile2("wslpath", ["-aw", ...pathsToConvert], { encoding: "utf8" });
40496
+ const convertedPaths = stdout.split(/\r?\n/).filter(Boolean);
40497
+ for (const [index, originalIndex] of indicesToConvert.entries()) {
40498
+ results[originalIndex] = convertedPaths[index] ?? pathArray[originalIndex];
40499
+ }
40500
+ } catch {}
40486
40501
  }
40502
+ return isBatch ? results : results[0];
40487
40503
  };
40488
40504
  var init_wsl_utils = __esm(() => {
40489
40505
  init_is_wsl();
@@ -40519,6 +40535,36 @@ var init_wsl_utils = __esm(() => {
40519
40535
  powerShellPath2 = is_wsl_default ? powerShellPathFromWsl : powerShellPath;
40520
40536
  });
40521
40537
 
40538
+ // ../../node_modules/.bun/powershell-utils@0.2.0/node_modules/powershell-utils/index.js
40539
+ import process5 from "process";
40540
+ import { Buffer as Buffer4 } from "buffer";
40541
+ import { promisify as promisify3 } from "util";
40542
+ import childProcess3 from "child_process";
40543
+ var execFile3, powerShellPath3 = () => `${process5.env.SYSTEMROOT || process5.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`, argumentsPrefix, encodeCommand = (command) => Buffer4.from(command, "utf16le").toString("base64"), escapeArgument = (value) => `'${String(value).replaceAll("'", "''")}'`, createArguments = (command) => [...argumentsPrefix, encodeCommand(command)], executePowerShell2 = async (command, options = {}) => {
40544
+ const {
40545
+ powerShellPath: psPath,
40546
+ ...execFileOptions
40547
+ } = options;
40548
+ return execFile3(psPath ?? powerShellPath3(), createArguments(command), {
40549
+ encoding: "utf8",
40550
+ ...execFileOptions
40551
+ });
40552
+ };
40553
+ var init_powershell_utils2 = __esm(() => {
40554
+ execFile3 = promisify3(childProcess3.execFile);
40555
+ argumentsPrefix = [
40556
+ "-NoProfile",
40557
+ "-NonInteractive",
40558
+ "-ExecutionPolicy",
40559
+ "Bypass",
40560
+ "-EncodedCommand"
40561
+ ];
40562
+ executePowerShell2.argumentsPrefix = argumentsPrefix;
40563
+ executePowerShell2.encodeCommand = encodeCommand;
40564
+ executePowerShell2.escapeArgument = escapeArgument;
40565
+ executePowerShell2.createArguments = createArguments;
40566
+ });
40567
+
40522
40568
  // ../../node_modules/.bun/define-lazy-prop@3.0.0/node_modules/define-lazy-prop/index.js
40523
40569
  function defineLazyProperty(object4, propertyName, valueGetter) {
40524
40570
  const define = (value) => Object.defineProperty(object4, propertyName, { value, enumerable: true, writable: true });
@@ -40538,11 +40584,11 @@ function defineLazyProperty(object4, propertyName, valueGetter) {
40538
40584
  }
40539
40585
 
40540
40586
  // ../../node_modules/.bun/default-browser-id@5.0.1/node_modules/default-browser-id/index.js
40541
- import { promisify as promisify3 } from "util";
40542
- import process5 from "process";
40543
- import { execFile as execFile3 } from "child_process";
40587
+ import { promisify as promisify4 } from "util";
40588
+ import process6 from "process";
40589
+ import { execFile as execFile4 } from "child_process";
40544
40590
  async function defaultBrowserId() {
40545
- if (process5.platform !== "darwin") {
40591
+ if (process6.platform !== "darwin") {
40546
40592
  throw new Error("macOS only");
40547
40593
  }
40548
40594
  const { stdout } = await execFileAsync("defaults", ["read", "com.apple.LaunchServices/com.apple.launchservices.secure", "LSHandlers"]);
@@ -40555,15 +40601,15 @@ async function defaultBrowserId() {
40555
40601
  }
40556
40602
  var execFileAsync;
40557
40603
  var init_default_browser_id = __esm(() => {
40558
- execFileAsync = promisify3(execFile3);
40604
+ execFileAsync = promisify4(execFile4);
40559
40605
  });
40560
40606
 
40561
40607
  // ../../node_modules/.bun/run-applescript@7.1.0/node_modules/run-applescript/index.js
40562
- import process6 from "process";
40563
- import { promisify as promisify4 } from "util";
40564
- import { execFile as execFile4, execFileSync } from "child_process";
40608
+ import process7 from "process";
40609
+ import { promisify as promisify5 } from "util";
40610
+ import { execFile as execFile5, execFileSync } from "child_process";
40565
40611
  async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
40566
- if (process6.platform !== "darwin") {
40612
+ if (process7.platform !== "darwin") {
40567
40613
  throw new Error("macOS only");
40568
40614
  }
40569
40615
  const outputArguments = humanReadableOutput ? [] : ["-ss"];
@@ -40576,7 +40622,7 @@ async function runAppleScript(script, { humanReadableOutput = true, signal } = {
40576
40622
  }
40577
40623
  var execFileAsync2;
40578
40624
  var init_run_applescript = __esm(() => {
40579
- execFileAsync2 = promisify4(execFile4);
40625
+ execFileAsync2 = promisify5(execFile5);
40580
40626
  });
40581
40627
 
40582
40628
  // ../../node_modules/.bun/bundle-name@4.1.0/node_modules/bundle-name/index.js
@@ -40588,11 +40634,13 @@ var init_bundle_name = __esm(() => {
40588
40634
  init_run_applescript();
40589
40635
  });
40590
40636
 
40591
- // ../../node_modules/.bun/default-browser@5.5.0/node_modules/default-browser/windows.js
40592
- import { promisify as promisify5 } from "util";
40593
- import { execFile as execFile5 } from "child_process";
40637
+ // ../../node_modules/.bun/default-browser@5.5.1/node_modules/default-browser/windows.js
40638
+ import process8 from "process";
40639
+ import { promisify as promisify6 } from "util";
40640
+ import { execFile as execFile6 } from "child_process";
40594
40641
  async function defaultBrowser(_execFileAsync = execFileAsync3) {
40595
- const { stdout } = await _execFileAsync("reg", [
40642
+ const regPath = `${process8.env.SYSTEMROOT ?? process8.env.windir ?? "C:\\Windows"}\\System32\\reg.exe`;
40643
+ const { stdout } = await _execFileAsync(regPath, [
40596
40644
  "QUERY",
40597
40645
  " HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice",
40598
40646
  "/v",
@@ -40611,7 +40659,7 @@ async function defaultBrowser(_execFileAsync = execFileAsync3) {
40611
40659
  }
40612
40660
  var execFileAsync3, windowsBrowserProgIds, _windowsBrowserProgIdMap, UnknownBrowserError;
40613
40661
  var init_windows = __esm(() => {
40614
- execFileAsync3 = promisify5(execFile5);
40662
+ execFileAsync3 = promisify6(execFile6);
40615
40663
  windowsBrowserProgIds = {
40616
40664
  MSEdgeHTM: { name: "Edge", id: "com.microsoft.edge" },
40617
40665
  MSEdgeBHTML: { name: "Edge Beta", id: "com.microsoft.edge.beta" },
@@ -40635,23 +40683,23 @@ var init_windows = __esm(() => {
40635
40683
  };
40636
40684
  });
40637
40685
 
40638
- // ../../node_modules/.bun/default-browser@5.5.0/node_modules/default-browser/index.js
40639
- import { promisify as promisify6 } from "util";
40640
- import process7 from "process";
40641
- import { execFile as execFile6 } from "child_process";
40686
+ // ../../node_modules/.bun/default-browser@5.5.1/node_modules/default-browser/index.js
40687
+ import { promisify as promisify7 } from "util";
40688
+ import process9 from "process";
40689
+ import { execFile as execFile7 } from "child_process";
40642
40690
  async function defaultBrowser2() {
40643
- if (process7.platform === "darwin") {
40691
+ if (process9.platform === "darwin") {
40644
40692
  const id = await defaultBrowserId();
40645
40693
  const name = await bundleName(id);
40646
40694
  return { name, id };
40647
40695
  }
40648
- if (process7.platform === "linux") {
40696
+ if (process9.platform === "linux") {
40649
40697
  const { stdout } = await execFileAsync4("xdg-mime", ["query", "default", "x-scheme-handler/http"]);
40650
40698
  const id = stdout.trim();
40651
40699
  const name = titleize(id.replace(/.desktop$/, "").replace("-", " "));
40652
40700
  return { name, id };
40653
40701
  }
40654
- if (process7.platform === "win32") {
40702
+ if (process9.platform === "win32") {
40655
40703
  return defaultBrowser();
40656
40704
  }
40657
40705
  throw new Error("Only macOS, Linux, and Windows are supported");
@@ -40662,22 +40710,22 @@ var init_default_browser = __esm(() => {
40662
40710
  init_bundle_name();
40663
40711
  init_windows();
40664
40712
  init_windows();
40665
- execFileAsync4 = promisify6(execFile6);
40713
+ execFileAsync4 = promisify7(execFile7);
40666
40714
  });
40667
40715
 
40668
40716
  // ../../node_modules/.bun/is-in-ssh@1.0.0/node_modules/is-in-ssh/index.js
40669
- import process8 from "process";
40717
+ import process10 from "process";
40670
40718
  var isInSsh, is_in_ssh_default;
40671
40719
  var init_is_in_ssh = __esm(() => {
40672
- isInSsh = Boolean(process8.env.SSH_CONNECTION || process8.env.SSH_CLIENT || process8.env.SSH_TTY);
40720
+ isInSsh = Boolean(process10.env.SSH_CONNECTION || process10.env.SSH_CLIENT || process10.env.SSH_TTY);
40673
40721
  is_in_ssh_default = isInSsh;
40674
40722
  });
40675
40723
 
40676
- // ../../node_modules/.bun/open@11.0.0/node_modules/open/index.js
40677
- import process9 from "process";
40678
- import path from "path";
40724
+ // ../../node_modules/.bun/open@11.0.1/node_modules/open/index.js
40725
+ import process11 from "process";
40726
+ import path2 from "path";
40679
40727
  import { fileURLToPath as fileURLToPath6 } from "url";
40680
- import childProcess3 from "child_process";
40728
+ import childProcess4 from "child_process";
40681
40729
  import fs5, { constants as fsConstants2 } from "fs/promises";
40682
40730
  function detectArchBinary(binary) {
40683
40731
  if (typeof binary === "string" || Array.isArray(binary)) {
@@ -40808,7 +40856,7 @@ var fallbackAttemptSymbol, __dirname6, localXdgOpenPath, platform, arch, tryEach
40808
40856
  }
40809
40857
  } else if (platform === "win32" || shouldUseWindowsInWsl) {
40810
40858
  command = await powerShellPath2();
40811
- cliArguments.push(...executePowerShell.argumentsPrefix);
40859
+ cliArguments.push(...executePowerShell2.argumentsPrefix);
40812
40860
  if (!is_wsl_default) {
40813
40861
  childProcessOptions.windowsVerbatimArguments = true;
40814
40862
  }
@@ -40820,21 +40868,24 @@ var fallbackAttemptSymbol, __dirname6, localXdgOpenPath, platform, arch, tryEach
40820
40868
  encodedArguments.push("-Wait");
40821
40869
  }
40822
40870
  if (app) {
40823
- encodedArguments.push(executePowerShell.escapeArgument(app));
40871
+ encodedArguments.push(executePowerShell2.escapeArgument(app));
40824
40872
  if (options.target) {
40825
40873
  appArguments.push(options.target);
40826
40874
  }
40827
40875
  } else if (options.target) {
40828
- encodedArguments.push(executePowerShell.escapeArgument(options.target));
40876
+ encodedArguments.push(executePowerShell2.escapeArgument(options.target));
40829
40877
  }
40830
40878
  if (appArguments.length > 0) {
40831
- appArguments = appArguments.map((argument) => executePowerShell.escapeArgument(argument));
40879
+ appArguments = appArguments.map((argument) => executePowerShell2.escapeArgument(argument));
40832
40880
  encodedArguments.push("-ArgumentList", appArguments.join(","));
40833
40881
  }
40834
- options.target = executePowerShell.encodeCommand(encodedArguments.join(" "));
40882
+ options.target = executePowerShell2.encodeCommand(encodedArguments.join(" "));
40835
40883
  if (!options.wait) {
40836
40884
  childProcessOptions.stdio = "ignore";
40837
40885
  }
40886
+ if (is_wsl_default) {
40887
+ childProcessOptions.cwd = path2.dirname(command);
40888
+ }
40838
40889
  } else {
40839
40890
  if (app) {
40840
40891
  command = app;
@@ -40845,7 +40896,7 @@ var fallbackAttemptSymbol, __dirname6, localXdgOpenPath, platform, arch, tryEach
40845
40896
  await fs5.access(localXdgOpenPath, fsConstants2.X_OK);
40846
40897
  exeLocalXdgOpen = true;
40847
40898
  } catch {}
40848
- const useSystemXdgOpen = process9.versions.electron ?? (platform === "android" || isBundled || !exeLocalXdgOpen);
40899
+ const useSystemXdgOpen = process11.versions.electron ?? (platform === "android" || isBundled || !exeLocalXdgOpen);
40849
40900
  command = useSystemXdgOpen ? "xdg-open" : localXdgOpenPath;
40850
40901
  }
40851
40902
  if (appArguments.length > 0) {
@@ -40862,7 +40913,7 @@ var fallbackAttemptSymbol, __dirname6, localXdgOpenPath, platform, arch, tryEach
40862
40913
  if (options.target) {
40863
40914
  cliArguments.push(options.target);
40864
40915
  }
40865
- const subprocess = childProcess3.spawn(command, cliArguments, childProcessOptions);
40916
+ const subprocess = childProcess4.spawn(command, cliArguments, childProcessOptions);
40866
40917
  if (options.wait) {
40867
40918
  return new Promise((resolve, reject) => {
40868
40919
  subprocess.once("error", reject);
@@ -40910,14 +40961,14 @@ var fallbackAttemptSymbol, __dirname6, localXdgOpenPath, platform, arch, tryEach
40910
40961
  }, apps, open_default;
40911
40962
  var init_open = __esm(() => {
40912
40963
  init_wsl_utils();
40913
- init_powershell_utils();
40964
+ init_powershell_utils2();
40914
40965
  init_default_browser();
40915
40966
  init_is_inside_container();
40916
40967
  init_is_in_ssh();
40917
40968
  fallbackAttemptSymbol = Symbol("fallbackAttempt");
40918
- __dirname6 = import.meta.url ? path.dirname(fileURLToPath6(import.meta.url)) : "";
40919
- localXdgOpenPath = path.join(__dirname6, "xdg-open");
40920
- ({ platform, arch } = process9);
40969
+ __dirname6 = import.meta.url ? path2.dirname(fileURLToPath6(import.meta.url)) : "";
40970
+ localXdgOpenPath = path2.join(__dirname6, "xdg-open");
40971
+ ({ platform, arch } = process11);
40921
40972
  apps = {
40922
40973
  browser: "browser",
40923
40974
  browserPrivate: "browserPrivate"
@@ -41150,12 +41201,12 @@ Dashboard not found at: ${dashboardDir}`);
41150
41201
  port,
41151
41202
  async fetch(req) {
41152
41203
  const url2 = new URL(req.url);
41153
- const path2 = url2.pathname;
41204
+ const path3 = url2.pathname;
41154
41205
  const method = req.method;
41155
41206
  const mcpResponse = await handleMcpHttpRequest(req);
41156
41207
  if (mcpResponse)
41157
41208
  return mcpResponse;
41158
- if (path2 === "/api/connectors" && method === "GET") {
41209
+ if (path3 === "/api/connectors" && method === "GET") {
41159
41210
  const compact = url2.searchParams.get("compact") === "true";
41160
41211
  const fieldsParam = url2.searchParams.get("fields");
41161
41212
  const fields = fieldsParam ? new Set(fieldsParam.split(",").map((f) => f.trim())) : null;
@@ -41175,7 +41226,7 @@ Dashboard not found at: ${dashboardDir}`);
41175
41226
  }
41176
41227
  return jsonStripped(data, 200, port);
41177
41228
  }
41178
- if (path2 === "/api/connectors/manifest" && method === "GET") {
41229
+ if (path3 === "/api/connectors/manifest" && method === "GET") {
41179
41230
  const connectorNames = url2.searchParams.get("connectors")?.split(",").map((name) => name.trim()).filter(Boolean);
41180
41231
  const includeOperations = url2.searchParams.get("includeOperations") === "true";
41181
41232
  const manifest = await getConnectorCapabilityManifest({
@@ -41184,7 +41235,7 @@ Dashboard not found at: ${dashboardDir}`);
41184
41235
  });
41185
41236
  return json(manifest, 200, port);
41186
41237
  }
41187
- const singleMatch = path2.match(/^\/api\/connectors\/([^/]+)$/);
41238
+ const singleMatch = path3.match(/^\/api\/connectors\/([^/]+)$/);
41188
41239
  if (singleMatch && method === "GET") {
41189
41240
  const name = singleMatch[1];
41190
41241
  if (!isValidConnectorName(name))
@@ -41204,7 +41255,7 @@ Dashboard not found at: ${dashboardDir}`);
41204
41255
  overview: docs?.overview || null
41205
41256
  }, 200, port);
41206
41257
  }
41207
- const operationsMatch = path2.match(/^\/api\/connectors\/([^/]+)\/operations$/);
41258
+ const operationsMatch = path3.match(/^\/api\/connectors\/([^/]+)\/operations$/);
41208
41259
  if (operationsMatch && method === "GET") {
41209
41260
  const name = operationsMatch[1];
41210
41261
  if (!isValidConnectorName(name))
@@ -41225,7 +41276,7 @@ Dashboard not found at: ${dashboardDir}`);
41225
41276
  helpText: ops.helpText
41226
41277
  }, 200, port);
41227
41278
  }
41228
- const operationHelpMatch = path2.match(/^\/api\/connectors\/([^/]+)\/operations\/([^/]+)$/);
41279
+ const operationHelpMatch = path3.match(/^\/api\/connectors\/([^/]+)\/operations\/([^/]+)$/);
41229
41280
  if (operationHelpMatch && method === "GET") {
41230
41281
  const name = operationHelpMatch[1];
41231
41282
  const command = decodeURIComponent(operationHelpMatch[2]);
@@ -41240,7 +41291,7 @@ Dashboard not found at: ${dashboardDir}`);
41240
41291
  const help = await getConnectorCommandHelp(name, command);
41241
41292
  return json({ connector: name, displayName: meta.displayName, command, help }, 200, port);
41242
41293
  }
41243
- const operationRunMatch = path2.match(/^\/api\/connectors\/([^/]+)\/operations\/run$/);
41294
+ const operationRunMatch = path3.match(/^\/api\/connectors\/([^/]+)\/operations\/run$/);
41244
41295
  if (operationRunMatch && method === "POST") {
41245
41296
  const name = operationRunMatch[1];
41246
41297
  if (!isValidConnectorName(name))
@@ -41304,7 +41355,7 @@ ${result.stderr}`;
41304
41355
  }, 500, port);
41305
41356
  }
41306
41357
  }
41307
- const keyMatch = path2.match(/^\/api\/connectors\/([^/]+)\/key$/);
41358
+ const keyMatch = path3.match(/^\/api\/connectors\/([^/]+)\/key$/);
41308
41359
  if (keyMatch && method === "POST") {
41309
41360
  const name = keyMatch[1];
41310
41361
  if (!isValidConnectorName(name))
@@ -41323,7 +41374,7 @@ ${result.stderr}`;
41323
41374
  return json({ error: e instanceof Error ? e.message : "Failed to save key" }, 500, port);
41324
41375
  }
41325
41376
  }
41326
- const refreshMatch = path2.match(/^\/api\/connectors\/([^/]+)\/refresh$/);
41377
+ const refreshMatch = path3.match(/^\/api\/connectors\/([^/]+)\/refresh$/);
41327
41378
  if (refreshMatch && method === "POST") {
41328
41379
  const name = refreshMatch[1];
41329
41380
  if (!isValidConnectorName(name))
@@ -41336,7 +41387,7 @@ ${result.stderr}`;
41336
41387
  return json({ success: false, error: e instanceof Error ? e.message : "Failed to refresh" }, 500, port);
41337
41388
  }
41338
41389
  }
41339
- const installMatch = path2.match(/^\/api\/connectors\/([^/]+)\/install$/);
41390
+ const installMatch = path3.match(/^\/api\/connectors\/([^/]+)\/install$/);
41340
41391
  if (installMatch && method === "POST") {
41341
41392
  const name = installMatch[1];
41342
41393
  if (!isValidConnectorName(name))
@@ -41355,7 +41406,7 @@ ${result.stderr}`;
41355
41406
  return json({ error: e instanceof Error ? e.message : "Failed to install connector" }, 500, port);
41356
41407
  }
41357
41408
  }
41358
- const uninstallMatch = path2.match(/^\/api\/connectors\/([^/]+)\/uninstall$/);
41409
+ const uninstallMatch = path3.match(/^\/api\/connectors\/([^/]+)\/uninstall$/);
41359
41410
  if (uninstallMatch && method === "POST") {
41360
41411
  const name = uninstallMatch[1];
41361
41412
  if (!isValidConnectorName(name))
@@ -41371,7 +41422,7 @@ ${result.stderr}`;
41371
41422
  return json({ error: e instanceof Error ? e.message : "Failed to uninstall connector" }, 500, port);
41372
41423
  }
41373
41424
  }
41374
- if (path2 === "/api/update" && method === "POST") {
41425
+ if (path3 === "/api/update" && method === "POST") {
41375
41426
  try {
41376
41427
  const installed = getInstalledConnectors();
41377
41428
  if (installed.length === 0) {
@@ -41387,10 +41438,10 @@ ${result.stderr}`;
41387
41438
  return json({ error: e instanceof Error ? e.message : "Failed to update" }, 500, port);
41388
41439
  }
41389
41440
  }
41390
- if (path2 === "/api/activity" && method === "GET") {
41441
+ if (path3 === "/api/activity" && method === "GET") {
41391
41442
  return json(activityLog, 200, port);
41392
41443
  }
41393
- if (path2 === "/api/hot" && method === "GET") {
41444
+ if (path3 === "/api/hot" && method === "GET") {
41394
41445
  const { getTopConnectors: getTopConnectors2 } = await Promise.resolve().then(() => (init_usage(), exports_usage));
41395
41446
  const { getPromotedConnectors: getPromotedConnectors2 } = await Promise.resolve().then(() => (init_promotions(), exports_promotions));
41396
41447
  const limit = parseInt(url2.searchParams.get("limit") || "10", 10);
@@ -41400,7 +41451,7 @@ ${result.stderr}`;
41400
41451
  const promoted = new Set(getPromotedConnectors2(db));
41401
41452
  return json(top.map((t) => ({ ...t, promoted: promoted.has(t.connector) })), 200, port);
41402
41453
  }
41403
- const promoteMatch = path2.match(/^\/api\/connectors\/([^/]+)\/promote$/);
41454
+ const promoteMatch = path3.match(/^\/api\/connectors\/([^/]+)\/promote$/);
41404
41455
  if (promoteMatch && method === "POST") {
41405
41456
  const name = promoteMatch[1];
41406
41457
  if (!getConnector(name))
@@ -41414,13 +41465,13 @@ ${result.stderr}`;
41414
41465
  const removed = demoteConnector2(promoteMatch[1], getDatabase3());
41415
41466
  return json({ success: removed, connector: promoteMatch[1] }, 200, port);
41416
41467
  }
41417
- if (path2 === "/api/llm" && method === "GET") {
41468
+ if (path3 === "/api/llm" && method === "GET") {
41418
41469
  const config2 = getLlmConfig();
41419
41470
  if (!config2)
41420
41471
  return json({ configured: false }, 200, port);
41421
41472
  return json({ configured: true, provider: config2.provider, model: config2.model, key: maskKey(config2.api_key), strip: config2.strip }, 200, port);
41422
41473
  }
41423
- if (path2 === "/api/llm" && method === "POST") {
41474
+ if (path3 === "/api/llm" && method === "POST") {
41424
41475
  const body = await req.json().catch(() => ({}));
41425
41476
  const validProviders = ["cerebras", "groq", "openai", "anthropic"];
41426
41477
  const provider = body.provider;
@@ -41434,7 +41485,7 @@ ${result.stderr}`;
41434
41485
  saveLlmConfig({ provider, model, api_key, strip });
41435
41486
  return json({ success: true, provider, model, strip }, 200, port);
41436
41487
  }
41437
- if (path2 === "/api/llm/test" && method === "POST") {
41488
+ if (path3 === "/api/llm/test" && method === "POST") {
41438
41489
  const config2 = getLlmConfig();
41439
41490
  if (!config2)
41440
41491
  return json({ error: "No LLM configured" }, 400, port);
@@ -41446,17 +41497,17 @@ ${result.stderr}`;
41446
41497
  return json({ success: false, error: e instanceof Error ? e.message : String(e) }, 500, port);
41447
41498
  }
41448
41499
  }
41449
- if (path2 === "/api/jobs" && method === "GET") {
41500
+ if (path3 === "/api/jobs" && method === "GET") {
41450
41501
  return json(listJobs(getDatabase3()), 200, port);
41451
41502
  }
41452
- if (path2 === "/api/jobs" && method === "POST") {
41503
+ if (path3 === "/api/jobs" && method === "POST") {
41453
41504
  const body = await req.json().catch(() => ({}));
41454
41505
  if (!body.name || !body.connector || !body.command || !body.cron)
41455
41506
  return json({ error: "name, connector, command, cron required" }, 400, port);
41456
41507
  const job = createJob({ name: body.name, connector: body.connector, command: body.command, args: body.args ?? [], cron: body.cron, strip: !!body.strip }, getDatabase3());
41457
41508
  return json(job, 201, port);
41458
41509
  }
41459
- const jobMatch = path2.match(/^\/api\/jobs\/([^/]+)$/);
41510
+ const jobMatch = path3.match(/^\/api\/jobs\/([^/]+)$/);
41460
41511
  if (jobMatch) {
41461
41512
  const db = getDatabase3();
41462
41513
  const job = getJobByName(jobMatch[1]) ?? getDatabase3().query("SELECT * FROM connector_jobs WHERE id = ?").get(jobMatch[1]);
@@ -41478,7 +41529,7 @@ ${result.stderr}`;
41478
41529
  return json(updated, 200, port);
41479
41530
  }
41480
41531
  }
41481
- const jobRunMatch = path2.match(/^\/api\/jobs\/([^/]+)\/run$/);
41532
+ const jobRunMatch = path3.match(/^\/api\/jobs\/([^/]+)\/run$/);
41482
41533
  if (jobRunMatch && method === "POST") {
41483
41534
  const db = getDatabase3();
41484
41535
  const job = getJobByName(jobRunMatch[1], db);
@@ -41487,17 +41538,17 @@ ${result.stderr}`;
41487
41538
  const result = await triggerJob(job, db);
41488
41539
  return json(result, 200, port);
41489
41540
  }
41490
- if (path2 === "/api/workflows" && method === "GET") {
41541
+ if (path3 === "/api/workflows" && method === "GET") {
41491
41542
  return json(listWorkflows(getDatabase3()), 200, port);
41492
41543
  }
41493
- if (path2 === "/api/workflows" && method === "POST") {
41544
+ if (path3 === "/api/workflows" && method === "POST") {
41494
41545
  const body = await req.json().catch(() => ({}));
41495
41546
  if (!body.name || !body.steps)
41496
41547
  return json({ error: "name and steps required" }, 400, port);
41497
41548
  const wf = createWorkflow({ name: body.name, steps: body.steps }, getDatabase3());
41498
41549
  return json(wf, 201, port);
41499
41550
  }
41500
- const wfMatch = path2.match(/^\/api\/workflows\/([^/]+)$/);
41551
+ const wfMatch = path3.match(/^\/api\/workflows\/([^/]+)$/);
41501
41552
  if (wfMatch) {
41502
41553
  const db = getDatabase3();
41503
41554
  const wf = getWorkflowByName(wfMatch[1], db);
@@ -41510,7 +41561,7 @@ ${result.stderr}`;
41510
41561
  return json({ success: true }, 200, port);
41511
41562
  }
41512
41563
  }
41513
- const wfRunMatch = path2.match(/^\/api\/workflows\/([^/]+)\/run$/);
41564
+ const wfRunMatch = path3.match(/^\/api\/workflows\/([^/]+)\/run$/);
41514
41565
  if (wfRunMatch && method === "POST") {
41515
41566
  const wf = getWorkflowByName(wfRunMatch[1], getDatabase3());
41516
41567
  if (!wf)
@@ -41518,10 +41569,10 @@ ${result.stderr}`;
41518
41569
  const result = await runWorkflow(wf);
41519
41570
  return json(result, 200, port);
41520
41571
  }
41521
- if (path2 === "/api/agents" && method === "GET") {
41572
+ if (path3 === "/api/agents" && method === "GET") {
41522
41573
  return json(listAgents(), 200, port);
41523
41574
  }
41524
- if (path2 === "/api/agents/register" && method === "POST") {
41575
+ if (path3 === "/api/agents/register" && method === "POST") {
41525
41576
  const body = await req.json().catch(() => ({}));
41526
41577
  const name = typeof body.name === "string" ? body.name : null;
41527
41578
  if (!name)
@@ -41535,15 +41586,15 @@ ${result.stderr}`;
41535
41586
  return json(result, 409, port);
41536
41587
  return json(result, 200, port);
41537
41588
  }
41538
- if (path2.startsWith("/api/agents/") && method === "DELETE") {
41539
- const agentName = path2.slice("/api/agents/".length);
41589
+ if (path3.startsWith("/api/agents/") && method === "DELETE") {
41590
+ const agentName = path3.slice("/api/agents/".length);
41540
41591
  const agent = getAgentByName(agentName);
41541
41592
  if (!agent)
41542
41593
  return json({ error: "Agent not found" }, 404, port);
41543
41594
  deleteAgent(agent.id);
41544
41595
  return json({ success: true }, 200, port);
41545
41596
  }
41546
- const rateMatch = path2.match(/^\/api\/rate\/([^/]+)\/([^/]+)$/);
41597
+ const rateMatch = path3.match(/^\/api\/rate\/([^/]+)\/([^/]+)$/);
41547
41598
  if (rateMatch && method === "GET") {
41548
41599
  const [, agentId, connector] = rateMatch;
41549
41600
  const limit = parseInt(url2.searchParams.get("limit") || "60", 10);
@@ -41551,7 +41602,7 @@ ${result.stderr}`;
41551
41602
  const result = consume ? checkRateBudget(agentId, connector, limit) : getRateBudget(agentId, connector, limit);
41552
41603
  return json(result, 200, port);
41553
41604
  }
41554
- const profilesMatch = path2.match(/^\/api\/connectors\/([^/]+)\/profiles$/);
41605
+ const profilesMatch = path3.match(/^\/api\/connectors\/([^/]+)\/profiles$/);
41555
41606
  if (profilesMatch && method === "GET") {
41556
41607
  const name = profilesMatch[1];
41557
41608
  if (!isValidConnectorName(name))
@@ -41573,7 +41624,7 @@ ${result.stderr}`;
41573
41624
  return json({ error: e instanceof Error ? e.message : "Failed to list profiles" }, 500, port);
41574
41625
  }
41575
41626
  }
41576
- const profileSwitchMatch = path2.match(/^\/api\/connectors\/([^/]+)\/profiles\/switch$/);
41627
+ const profileSwitchMatch = path3.match(/^\/api\/connectors\/([^/]+)\/profiles\/switch$/);
41577
41628
  if (profileSwitchMatch && method === "POST") {
41578
41629
  const name = profileSwitchMatch[1];
41579
41630
  if (!isValidConnectorName(name))
@@ -41592,7 +41643,7 @@ ${result.stderr}`;
41592
41643
  return json({ error: e instanceof Error ? e.message : "Failed to switch profile" }, 500, port);
41593
41644
  }
41594
41645
  }
41595
- const profileDeleteMatch = path2.match(/^\/api\/connectors\/([^/]+)\/profiles\/([^/]+)$/);
41646
+ const profileDeleteMatch = path3.match(/^\/api\/connectors\/([^/]+)\/profiles\/([^/]+)$/);
41596
41647
  if (profileDeleteMatch && method === "DELETE") {
41597
41648
  const name = profileDeleteMatch[1];
41598
41649
  const profile = profileDeleteMatch[2];
@@ -41610,7 +41661,7 @@ ${result.stderr}`;
41610
41661
  return json({ error: e instanceof Error ? e.message : "Failed to delete profile" }, 500, port);
41611
41662
  }
41612
41663
  }
41613
- if (path2 === "/api/export" && method === "GET") {
41664
+ if (path3 === "/api/export" && method === "GET") {
41614
41665
  try {
41615
41666
  const connectDir = getConnectorsHome();
41616
41667
  const result = {};
@@ -41660,7 +41711,7 @@ ${result.stderr}`;
41660
41711
  return json({ error: e instanceof Error ? e.message : "Failed to export credentials" }, 500, port);
41661
41712
  }
41662
41713
  }
41663
- if (path2 === "/api/import" && method === "POST") {
41714
+ if (path3 === "/api/import" && method === "POST") {
41664
41715
  try {
41665
41716
  const contentLength = parseInt(req.headers.get("content-length") || "0", 10);
41666
41717
  if (contentLength > MAX_BODY_SIZE)
@@ -41693,7 +41744,7 @@ ${result.stderr}`;
41693
41744
  return json({ error: e instanceof Error ? e.message : "Failed to import credentials" }, 500, port);
41694
41745
  }
41695
41746
  }
41696
- const oauthStartMatch = path2.match(/^\/oauth\/([^/]+)\/start$/);
41747
+ const oauthStartMatch = path3.match(/^\/oauth\/([^/]+)\/start$/);
41697
41748
  if (oauthStartMatch && method === "GET") {
41698
41749
  const name = oauthStartMatch[1];
41699
41750
  const redirectUri = `http://localhost:${port}/oauth/${name}/callback`;
@@ -41703,7 +41754,7 @@ ${result.stderr}`;
41703
41754
  }
41704
41755
  return Response.redirect(authUrl, 302);
41705
41756
  }
41706
- const oauthCallbackMatch = path2.match(/^\/oauth\/([^/]+)\/callback$/);
41757
+ const oauthCallbackMatch = path3.match(/^\/oauth\/([^/]+)\/callback$/);
41707
41758
  if (oauthCallbackMatch && method === "GET") {
41708
41759
  const name = oauthCallbackMatch[1];
41709
41760
  const code = url2.searchParams.get("code");
@@ -41737,8 +41788,8 @@ ${result.stderr}`;
41737
41788
  });
41738
41789
  }
41739
41790
  if (dashboardExists && (method === "GET" || method === "HEAD")) {
41740
- if (path2 !== "/") {
41741
- const filePath = join15(dashboardDir, path2);
41791
+ if (path3 !== "/") {
41792
+ const filePath = join15(dashboardDir, path3);
41742
41793
  const rel = relative2(dashboardDir, resolve(filePath));
41743
41794
  if (!rel.startsWith("..") && !rel.includes(`..${sep}`) && rel !== "") {
41744
41795
  const res2 = serveStaticFile(filePath);
@@ -45746,7 +45797,7 @@ Testing connector credentials...
45746
45797
  break;
45747
45798
  }
45748
45799
  }
45749
- const tokensFile = connectorConfigDirs.map((dir) => join18(dir, "profiles", currentProfile, "tokens.json")).find((path2) => existsSync18(path2));
45800
+ const tokensFile = connectorConfigDirs.map((dir) => join18(dir, "profiles", currentProfile, "tokens.json")).find((path3) => existsSync18(path3));
45750
45801
  if (tokensFile) {
45751
45802
  try {
45752
45803
  const tokens = JSON.parse(readFileSync12(tokensFile, "utf-8"));
package/bin/mcp.js CHANGED
@@ -5804,7 +5804,7 @@ var package_default;
5804
5804
  var init_package = __esm(() => {
5805
5805
  package_default = {
5806
5806
  name: "@hasna/connectors",
5807
- version: "1.4.3",
5807
+ version: "1.4.4",
5808
5808
  description: "Open source connector library - Install API connectors with a single command",
5809
5809
  type: "module",
5810
5810
  bin: {
package/bin/serve.js CHANGED
@@ -6433,7 +6433,7 @@ var package_default;
6433
6433
  var init_package = __esm(() => {
6434
6434
  package_default = {
6435
6435
  name: "@hasna/connectors",
6436
- version: "1.4.3",
6436
+ version: "1.4.4",
6437
6437
  description: "Open source connector library - Install API connectors with a single command",
6438
6438
  type: "module",
6439
6439
  bin: {
@@ -16720,7 +16720,7 @@ var init_powershell_utils = __esm(() => {
16720
16720
  executePowerShell.escapeArgument = (value) => `'${String(value).replaceAll("'", "''")}'`;
16721
16721
  });
16722
16722
 
16723
- // ../../node_modules/.bun/wsl-utils@0.3.1/node_modules/wsl-utils/utilities.js
16723
+ // ../../node_modules/.bun/wsl-utils@1.0.0/node_modules/wsl-utils/utilities.js
16724
16724
  function parseMountPointFromConfig(content) {
16725
16725
  for (const line of content.split(`
16726
16726
  `)) {
@@ -16735,7 +16735,8 @@ function parseMountPointFromConfig(content) {
16735
16735
  }
16736
16736
  }
16737
16737
 
16738
- // ../../node_modules/.bun/wsl-utils@0.3.1/node_modules/wsl-utils/index.js
16738
+ // ../../node_modules/.bun/wsl-utils@1.0.0/node_modules/wsl-utils/index.js
16739
+ import path from "path";
16739
16740
  import { promisify as promisify2 } from "util";
16740
16741
  import childProcess2 from "child_process";
16741
16742
  import fs4, { constants as fsConstants } from "fs/promises";
@@ -16756,18 +16757,33 @@ var execFile2, wslDrivesMountPoint, powerShellPathFromWsl = async () => {
16756
16757
  }, wslDefaultBrowser = async () => {
16757
16758
  const psPath = await powerShellPath2();
16758
16759
  const command = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
16759
- const { stdout } = await executePowerShell(command, { powerShellPath: psPath });
16760
+ const { stdout } = await executePowerShell(command, {
16761
+ powerShellPath: psPath,
16762
+ cwd: path.dirname(psPath)
16763
+ });
16760
16764
  return stdout.trim();
16761
- }, convertWslPathToWindows = async (path) => {
16762
- if (/^[a-z]+:\/\//i.test(path)) {
16763
- return path;
16764
- }
16765
- try {
16766
- const { stdout } = await execFile2("wslpath", ["-aw", path], { encoding: "utf8" });
16767
- return stdout.trim();
16768
- } catch {
16769
- return path;
16765
+ }, isUrl = (path2) => /^[a-z]+:\/\//i.test(path2), convertWslPathToWindows = async (paths) => {
16766
+ const isBatch = Array.isArray(paths);
16767
+ const pathArray = isBatch ? paths : [paths];
16768
+ const indicesToConvert = [];
16769
+ const pathsToConvert = [];
16770
+ for (const [index, path2] of pathArray.entries()) {
16771
+ if (!isUrl(path2)) {
16772
+ indicesToConvert.push(index);
16773
+ pathsToConvert.push(path2);
16774
+ }
16775
+ }
16776
+ const results = [...pathArray];
16777
+ if (pathsToConvert.length > 0) {
16778
+ try {
16779
+ const { stdout } = await execFile2("wslpath", ["-aw", ...pathsToConvert], { encoding: "utf8" });
16780
+ const convertedPaths = stdout.split(/\r?\n/).filter(Boolean);
16781
+ for (const [index, originalIndex] of indicesToConvert.entries()) {
16782
+ results[originalIndex] = convertedPaths[index] ?? pathArray[originalIndex];
16783
+ }
16784
+ } catch {}
16770
16785
  }
16786
+ return isBatch ? results : results[0];
16771
16787
  };
16772
16788
  var init_wsl_utils = __esm(() => {
16773
16789
  init_is_wsl();
@@ -16803,6 +16819,36 @@ var init_wsl_utils = __esm(() => {
16803
16819
  powerShellPath2 = is_wsl_default ? powerShellPathFromWsl : powerShellPath;
16804
16820
  });
16805
16821
 
16822
+ // ../../node_modules/.bun/powershell-utils@0.2.0/node_modules/powershell-utils/index.js
16823
+ import process4 from "process";
16824
+ import { Buffer as Buffer4 } from "buffer";
16825
+ import { promisify as promisify3 } from "util";
16826
+ import childProcess3 from "child_process";
16827
+ var execFile3, powerShellPath3 = () => `${process4.env.SYSTEMROOT || process4.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`, argumentsPrefix, encodeCommand = (command) => Buffer4.from(command, "utf16le").toString("base64"), escapeArgument = (value) => `'${String(value).replaceAll("'", "''")}'`, createArguments = (command) => [...argumentsPrefix, encodeCommand(command)], executePowerShell2 = async (command, options = {}) => {
16828
+ const {
16829
+ powerShellPath: psPath,
16830
+ ...execFileOptions
16831
+ } = options;
16832
+ return execFile3(psPath ?? powerShellPath3(), createArguments(command), {
16833
+ encoding: "utf8",
16834
+ ...execFileOptions
16835
+ });
16836
+ };
16837
+ var init_powershell_utils2 = __esm(() => {
16838
+ execFile3 = promisify3(childProcess3.execFile);
16839
+ argumentsPrefix = [
16840
+ "-NoProfile",
16841
+ "-NonInteractive",
16842
+ "-ExecutionPolicy",
16843
+ "Bypass",
16844
+ "-EncodedCommand"
16845
+ ];
16846
+ executePowerShell2.argumentsPrefix = argumentsPrefix;
16847
+ executePowerShell2.encodeCommand = encodeCommand;
16848
+ executePowerShell2.escapeArgument = escapeArgument;
16849
+ executePowerShell2.createArguments = createArguments;
16850
+ });
16851
+
16806
16852
  // ../../node_modules/.bun/define-lazy-prop@3.0.0/node_modules/define-lazy-prop/index.js
16807
16853
  function defineLazyProperty(object4, propertyName, valueGetter) {
16808
16854
  const define = (value) => Object.defineProperty(object4, propertyName, { value, enumerable: true, writable: true });
@@ -16822,11 +16868,11 @@ function defineLazyProperty(object4, propertyName, valueGetter) {
16822
16868
  }
16823
16869
 
16824
16870
  // ../../node_modules/.bun/default-browser-id@5.0.1/node_modules/default-browser-id/index.js
16825
- import { promisify as promisify3 } from "util";
16826
- import process4 from "process";
16827
- import { execFile as execFile3 } from "child_process";
16871
+ import { promisify as promisify4 } from "util";
16872
+ import process5 from "process";
16873
+ import { execFile as execFile4 } from "child_process";
16828
16874
  async function defaultBrowserId() {
16829
- if (process4.platform !== "darwin") {
16875
+ if (process5.platform !== "darwin") {
16830
16876
  throw new Error("macOS only");
16831
16877
  }
16832
16878
  const { stdout } = await execFileAsync("defaults", ["read", "com.apple.LaunchServices/com.apple.launchservices.secure", "LSHandlers"]);
@@ -16839,15 +16885,15 @@ async function defaultBrowserId() {
16839
16885
  }
16840
16886
  var execFileAsync;
16841
16887
  var init_default_browser_id = __esm(() => {
16842
- execFileAsync = promisify3(execFile3);
16888
+ execFileAsync = promisify4(execFile4);
16843
16889
  });
16844
16890
 
16845
16891
  // ../../node_modules/.bun/run-applescript@7.1.0/node_modules/run-applescript/index.js
16846
- import process5 from "process";
16847
- import { promisify as promisify4 } from "util";
16848
- import { execFile as execFile4, execFileSync } from "child_process";
16892
+ import process6 from "process";
16893
+ import { promisify as promisify5 } from "util";
16894
+ import { execFile as execFile5, execFileSync } from "child_process";
16849
16895
  async function runAppleScript(script, { humanReadableOutput = true, signal } = {}) {
16850
- if (process5.platform !== "darwin") {
16896
+ if (process6.platform !== "darwin") {
16851
16897
  throw new Error("macOS only");
16852
16898
  }
16853
16899
  const outputArguments = humanReadableOutput ? [] : ["-ss"];
@@ -16860,7 +16906,7 @@ async function runAppleScript(script, { humanReadableOutput = true, signal } = {
16860
16906
  }
16861
16907
  var execFileAsync2;
16862
16908
  var init_run_applescript = __esm(() => {
16863
- execFileAsync2 = promisify4(execFile4);
16909
+ execFileAsync2 = promisify5(execFile5);
16864
16910
  });
16865
16911
 
16866
16912
  // ../../node_modules/.bun/bundle-name@4.1.0/node_modules/bundle-name/index.js
@@ -16872,11 +16918,13 @@ var init_bundle_name = __esm(() => {
16872
16918
  init_run_applescript();
16873
16919
  });
16874
16920
 
16875
- // ../../node_modules/.bun/default-browser@5.5.0/node_modules/default-browser/windows.js
16876
- import { promisify as promisify5 } from "util";
16877
- import { execFile as execFile5 } from "child_process";
16921
+ // ../../node_modules/.bun/default-browser@5.5.1/node_modules/default-browser/windows.js
16922
+ import process7 from "process";
16923
+ import { promisify as promisify6 } from "util";
16924
+ import { execFile as execFile6 } from "child_process";
16878
16925
  async function defaultBrowser(_execFileAsync = execFileAsync3) {
16879
- const { stdout } = await _execFileAsync("reg", [
16926
+ const regPath = `${process7.env.SYSTEMROOT ?? process7.env.windir ?? "C:\\Windows"}\\System32\\reg.exe`;
16927
+ const { stdout } = await _execFileAsync(regPath, [
16880
16928
  "QUERY",
16881
16929
  " HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice",
16882
16930
  "/v",
@@ -16895,7 +16943,7 @@ async function defaultBrowser(_execFileAsync = execFileAsync3) {
16895
16943
  }
16896
16944
  var execFileAsync3, windowsBrowserProgIds, _windowsBrowserProgIdMap, UnknownBrowserError;
16897
16945
  var init_windows = __esm(() => {
16898
- execFileAsync3 = promisify5(execFile5);
16946
+ execFileAsync3 = promisify6(execFile6);
16899
16947
  windowsBrowserProgIds = {
16900
16948
  MSEdgeHTM: { name: "Edge", id: "com.microsoft.edge" },
16901
16949
  MSEdgeBHTML: { name: "Edge Beta", id: "com.microsoft.edge.beta" },
@@ -16919,23 +16967,23 @@ var init_windows = __esm(() => {
16919
16967
  };
16920
16968
  });
16921
16969
 
16922
- // ../../node_modules/.bun/default-browser@5.5.0/node_modules/default-browser/index.js
16923
- import { promisify as promisify6 } from "util";
16924
- import process6 from "process";
16925
- import { execFile as execFile6 } from "child_process";
16970
+ // ../../node_modules/.bun/default-browser@5.5.1/node_modules/default-browser/index.js
16971
+ import { promisify as promisify7 } from "util";
16972
+ import process8 from "process";
16973
+ import { execFile as execFile7 } from "child_process";
16926
16974
  async function defaultBrowser2() {
16927
- if (process6.platform === "darwin") {
16975
+ if (process8.platform === "darwin") {
16928
16976
  const id = await defaultBrowserId();
16929
16977
  const name = await bundleName(id);
16930
16978
  return { name, id };
16931
16979
  }
16932
- if (process6.platform === "linux") {
16980
+ if (process8.platform === "linux") {
16933
16981
  const { stdout } = await execFileAsync4("xdg-mime", ["query", "default", "x-scheme-handler/http"]);
16934
16982
  const id = stdout.trim();
16935
16983
  const name = titleize(id.replace(/.desktop$/, "").replace("-", " "));
16936
16984
  return { name, id };
16937
16985
  }
16938
- if (process6.platform === "win32") {
16986
+ if (process8.platform === "win32") {
16939
16987
  return defaultBrowser();
16940
16988
  }
16941
16989
  throw new Error("Only macOS, Linux, and Windows are supported");
@@ -16946,22 +16994,22 @@ var init_default_browser = __esm(() => {
16946
16994
  init_bundle_name();
16947
16995
  init_windows();
16948
16996
  init_windows();
16949
- execFileAsync4 = promisify6(execFile6);
16997
+ execFileAsync4 = promisify7(execFile7);
16950
16998
  });
16951
16999
 
16952
17000
  // ../../node_modules/.bun/is-in-ssh@1.0.0/node_modules/is-in-ssh/index.js
16953
- import process7 from "process";
17001
+ import process9 from "process";
16954
17002
  var isInSsh, is_in_ssh_default;
16955
17003
  var init_is_in_ssh = __esm(() => {
16956
- isInSsh = Boolean(process7.env.SSH_CONNECTION || process7.env.SSH_CLIENT || process7.env.SSH_TTY);
17004
+ isInSsh = Boolean(process9.env.SSH_CONNECTION || process9.env.SSH_CLIENT || process9.env.SSH_TTY);
16957
17005
  is_in_ssh_default = isInSsh;
16958
17006
  });
16959
17007
 
16960
- // ../../node_modules/.bun/open@11.0.0/node_modules/open/index.js
16961
- import process8 from "process";
16962
- import path from "path";
17008
+ // ../../node_modules/.bun/open@11.0.1/node_modules/open/index.js
17009
+ import process10 from "process";
17010
+ import path2 from "path";
16963
17011
  import { fileURLToPath as fileURLToPath6 } from "url";
16964
- import childProcess3 from "child_process";
17012
+ import childProcess4 from "child_process";
16965
17013
  import fs5, { constants as fsConstants2 } from "fs/promises";
16966
17014
  function detectArchBinary(binary) {
16967
17015
  if (typeof binary === "string" || Array.isArray(binary)) {
@@ -17092,7 +17140,7 @@ var fallbackAttemptSymbol, __dirname6, localXdgOpenPath, platform, arch, tryEach
17092
17140
  }
17093
17141
  } else if (platform === "win32" || shouldUseWindowsInWsl) {
17094
17142
  command = await powerShellPath2();
17095
- cliArguments.push(...executePowerShell.argumentsPrefix);
17143
+ cliArguments.push(...executePowerShell2.argumentsPrefix);
17096
17144
  if (!is_wsl_default) {
17097
17145
  childProcessOptions.windowsVerbatimArguments = true;
17098
17146
  }
@@ -17104,21 +17152,24 @@ var fallbackAttemptSymbol, __dirname6, localXdgOpenPath, platform, arch, tryEach
17104
17152
  encodedArguments.push("-Wait");
17105
17153
  }
17106
17154
  if (app) {
17107
- encodedArguments.push(executePowerShell.escapeArgument(app));
17155
+ encodedArguments.push(executePowerShell2.escapeArgument(app));
17108
17156
  if (options.target) {
17109
17157
  appArguments.push(options.target);
17110
17158
  }
17111
17159
  } else if (options.target) {
17112
- encodedArguments.push(executePowerShell.escapeArgument(options.target));
17160
+ encodedArguments.push(executePowerShell2.escapeArgument(options.target));
17113
17161
  }
17114
17162
  if (appArguments.length > 0) {
17115
- appArguments = appArguments.map((argument) => executePowerShell.escapeArgument(argument));
17163
+ appArguments = appArguments.map((argument) => executePowerShell2.escapeArgument(argument));
17116
17164
  encodedArguments.push("-ArgumentList", appArguments.join(","));
17117
17165
  }
17118
- options.target = executePowerShell.encodeCommand(encodedArguments.join(" "));
17166
+ options.target = executePowerShell2.encodeCommand(encodedArguments.join(" "));
17119
17167
  if (!options.wait) {
17120
17168
  childProcessOptions.stdio = "ignore";
17121
17169
  }
17170
+ if (is_wsl_default) {
17171
+ childProcessOptions.cwd = path2.dirname(command);
17172
+ }
17122
17173
  } else {
17123
17174
  if (app) {
17124
17175
  command = app;
@@ -17129,7 +17180,7 @@ var fallbackAttemptSymbol, __dirname6, localXdgOpenPath, platform, arch, tryEach
17129
17180
  await fs5.access(localXdgOpenPath, fsConstants2.X_OK);
17130
17181
  exeLocalXdgOpen = true;
17131
17182
  } catch {}
17132
- const useSystemXdgOpen = process8.versions.electron ?? (platform === "android" || isBundled || !exeLocalXdgOpen);
17183
+ const useSystemXdgOpen = process10.versions.electron ?? (platform === "android" || isBundled || !exeLocalXdgOpen);
17133
17184
  command = useSystemXdgOpen ? "xdg-open" : localXdgOpenPath;
17134
17185
  }
17135
17186
  if (appArguments.length > 0) {
@@ -17146,7 +17197,7 @@ var fallbackAttemptSymbol, __dirname6, localXdgOpenPath, platform, arch, tryEach
17146
17197
  if (options.target) {
17147
17198
  cliArguments.push(options.target);
17148
17199
  }
17149
- const subprocess = childProcess3.spawn(command, cliArguments, childProcessOptions);
17200
+ const subprocess = childProcess4.spawn(command, cliArguments, childProcessOptions);
17150
17201
  if (options.wait) {
17151
17202
  return new Promise((resolve, reject) => {
17152
17203
  subprocess.once("error", reject);
@@ -17194,14 +17245,14 @@ var fallbackAttemptSymbol, __dirname6, localXdgOpenPath, platform, arch, tryEach
17194
17245
  }, apps, open_default;
17195
17246
  var init_open = __esm(() => {
17196
17247
  init_wsl_utils();
17197
- init_powershell_utils();
17248
+ init_powershell_utils2();
17198
17249
  init_default_browser();
17199
17250
  init_is_inside_container();
17200
17251
  init_is_in_ssh();
17201
17252
  fallbackAttemptSymbol = Symbol("fallbackAttempt");
17202
- __dirname6 = import.meta.url ? path.dirname(fileURLToPath6(import.meta.url)) : "";
17203
- localXdgOpenPath = path.join(__dirname6, "xdg-open");
17204
- ({ platform, arch } = process8);
17253
+ __dirname6 = import.meta.url ? path2.dirname(fileURLToPath6(import.meta.url)) : "";
17254
+ localXdgOpenPath = path2.join(__dirname6, "xdg-open");
17255
+ ({ platform, arch } = process10);
17205
17256
  apps = {
17206
17257
  browser: "browser",
17207
17258
  browserPrivate: "browserPrivate"
@@ -37155,12 +37206,12 @@ Dashboard not found at: ${dashboardDir}`);
37155
37206
  port,
37156
37207
  async fetch(req) {
37157
37208
  const url2 = new URL(req.url);
37158
- const path2 = url2.pathname;
37209
+ const path3 = url2.pathname;
37159
37210
  const method = req.method;
37160
37211
  const mcpResponse = await handleMcpHttpRequest(req);
37161
37212
  if (mcpResponse)
37162
37213
  return mcpResponse;
37163
- if (path2 === "/api/connectors" && method === "GET") {
37214
+ if (path3 === "/api/connectors" && method === "GET") {
37164
37215
  const compact = url2.searchParams.get("compact") === "true";
37165
37216
  const fieldsParam = url2.searchParams.get("fields");
37166
37217
  const fields = fieldsParam ? new Set(fieldsParam.split(",").map((f) => f.trim())) : null;
@@ -37180,7 +37231,7 @@ Dashboard not found at: ${dashboardDir}`);
37180
37231
  }
37181
37232
  return jsonStripped(data, 200, port);
37182
37233
  }
37183
- if (path2 === "/api/connectors/manifest" && method === "GET") {
37234
+ if (path3 === "/api/connectors/manifest" && method === "GET") {
37184
37235
  const connectorNames = url2.searchParams.get("connectors")?.split(",").map((name) => name.trim()).filter(Boolean);
37185
37236
  const includeOperations = url2.searchParams.get("includeOperations") === "true";
37186
37237
  const manifest = await getConnectorCapabilityManifest({
@@ -37189,7 +37240,7 @@ Dashboard not found at: ${dashboardDir}`);
37189
37240
  });
37190
37241
  return json(manifest, 200, port);
37191
37242
  }
37192
- const singleMatch = path2.match(/^\/api\/connectors\/([^/]+)$/);
37243
+ const singleMatch = path3.match(/^\/api\/connectors\/([^/]+)$/);
37193
37244
  if (singleMatch && method === "GET") {
37194
37245
  const name = singleMatch[1];
37195
37246
  if (!isValidConnectorName(name))
@@ -37209,7 +37260,7 @@ Dashboard not found at: ${dashboardDir}`);
37209
37260
  overview: docs?.overview || null
37210
37261
  }, 200, port);
37211
37262
  }
37212
- const operationsMatch = path2.match(/^\/api\/connectors\/([^/]+)\/operations$/);
37263
+ const operationsMatch = path3.match(/^\/api\/connectors\/([^/]+)\/operations$/);
37213
37264
  if (operationsMatch && method === "GET") {
37214
37265
  const name = operationsMatch[1];
37215
37266
  if (!isValidConnectorName(name))
@@ -37230,7 +37281,7 @@ Dashboard not found at: ${dashboardDir}`);
37230
37281
  helpText: ops.helpText
37231
37282
  }, 200, port);
37232
37283
  }
37233
- const operationHelpMatch = path2.match(/^\/api\/connectors\/([^/]+)\/operations\/([^/]+)$/);
37284
+ const operationHelpMatch = path3.match(/^\/api\/connectors\/([^/]+)\/operations\/([^/]+)$/);
37234
37285
  if (operationHelpMatch && method === "GET") {
37235
37286
  const name = operationHelpMatch[1];
37236
37287
  const command = decodeURIComponent(operationHelpMatch[2]);
@@ -37245,7 +37296,7 @@ Dashboard not found at: ${dashboardDir}`);
37245
37296
  const help = await getConnectorCommandHelp(name, command);
37246
37297
  return json({ connector: name, displayName: meta.displayName, command, help }, 200, port);
37247
37298
  }
37248
- const operationRunMatch = path2.match(/^\/api\/connectors\/([^/]+)\/operations\/run$/);
37299
+ const operationRunMatch = path3.match(/^\/api\/connectors\/([^/]+)\/operations\/run$/);
37249
37300
  if (operationRunMatch && method === "POST") {
37250
37301
  const name = operationRunMatch[1];
37251
37302
  if (!isValidConnectorName(name))
@@ -37309,7 +37360,7 @@ ${result.stderr}`;
37309
37360
  }, 500, port);
37310
37361
  }
37311
37362
  }
37312
- const keyMatch = path2.match(/^\/api\/connectors\/([^/]+)\/key$/);
37363
+ const keyMatch = path3.match(/^\/api\/connectors\/([^/]+)\/key$/);
37313
37364
  if (keyMatch && method === "POST") {
37314
37365
  const name = keyMatch[1];
37315
37366
  if (!isValidConnectorName(name))
@@ -37328,7 +37379,7 @@ ${result.stderr}`;
37328
37379
  return json({ error: e instanceof Error ? e.message : "Failed to save key" }, 500, port);
37329
37380
  }
37330
37381
  }
37331
- const refreshMatch = path2.match(/^\/api\/connectors\/([^/]+)\/refresh$/);
37382
+ const refreshMatch = path3.match(/^\/api\/connectors\/([^/]+)\/refresh$/);
37332
37383
  if (refreshMatch && method === "POST") {
37333
37384
  const name = refreshMatch[1];
37334
37385
  if (!isValidConnectorName(name))
@@ -37341,7 +37392,7 @@ ${result.stderr}`;
37341
37392
  return json({ success: false, error: e instanceof Error ? e.message : "Failed to refresh" }, 500, port);
37342
37393
  }
37343
37394
  }
37344
- const installMatch = path2.match(/^\/api\/connectors\/([^/]+)\/install$/);
37395
+ const installMatch = path3.match(/^\/api\/connectors\/([^/]+)\/install$/);
37345
37396
  if (installMatch && method === "POST") {
37346
37397
  const name = installMatch[1];
37347
37398
  if (!isValidConnectorName(name))
@@ -37360,7 +37411,7 @@ ${result.stderr}`;
37360
37411
  return json({ error: e instanceof Error ? e.message : "Failed to install connector" }, 500, port);
37361
37412
  }
37362
37413
  }
37363
- const uninstallMatch = path2.match(/^\/api\/connectors\/([^/]+)\/uninstall$/);
37414
+ const uninstallMatch = path3.match(/^\/api\/connectors\/([^/]+)\/uninstall$/);
37364
37415
  if (uninstallMatch && method === "POST") {
37365
37416
  const name = uninstallMatch[1];
37366
37417
  if (!isValidConnectorName(name))
@@ -37376,7 +37427,7 @@ ${result.stderr}`;
37376
37427
  return json({ error: e instanceof Error ? e.message : "Failed to uninstall connector" }, 500, port);
37377
37428
  }
37378
37429
  }
37379
- if (path2 === "/api/update" && method === "POST") {
37430
+ if (path3 === "/api/update" && method === "POST") {
37380
37431
  try {
37381
37432
  const installed = getInstalledConnectors();
37382
37433
  if (installed.length === 0) {
@@ -37392,10 +37443,10 @@ ${result.stderr}`;
37392
37443
  return json({ error: e instanceof Error ? e.message : "Failed to update" }, 500, port);
37393
37444
  }
37394
37445
  }
37395
- if (path2 === "/api/activity" && method === "GET") {
37446
+ if (path3 === "/api/activity" && method === "GET") {
37396
37447
  return json(activityLog, 200, port);
37397
37448
  }
37398
- if (path2 === "/api/hot" && method === "GET") {
37449
+ if (path3 === "/api/hot" && method === "GET") {
37399
37450
  const { getTopConnectors: getTopConnectors2 } = await Promise.resolve().then(() => (init_usage(), exports_usage));
37400
37451
  const { getPromotedConnectors: getPromotedConnectors2 } = await Promise.resolve().then(() => (init_promotions(), exports_promotions));
37401
37452
  const limit = parseInt(url2.searchParams.get("limit") || "10", 10);
@@ -37405,7 +37456,7 @@ ${result.stderr}`;
37405
37456
  const promoted = new Set(getPromotedConnectors2(db));
37406
37457
  return json(top.map((t) => ({ ...t, promoted: promoted.has(t.connector) })), 200, port);
37407
37458
  }
37408
- const promoteMatch = path2.match(/^\/api\/connectors\/([^/]+)\/promote$/);
37459
+ const promoteMatch = path3.match(/^\/api\/connectors\/([^/]+)\/promote$/);
37409
37460
  if (promoteMatch && method === "POST") {
37410
37461
  const name = promoteMatch[1];
37411
37462
  if (!getConnector(name))
@@ -37419,13 +37470,13 @@ ${result.stderr}`;
37419
37470
  const removed = demoteConnector2(promoteMatch[1], getDatabase3());
37420
37471
  return json({ success: removed, connector: promoteMatch[1] }, 200, port);
37421
37472
  }
37422
- if (path2 === "/api/llm" && method === "GET") {
37473
+ if (path3 === "/api/llm" && method === "GET") {
37423
37474
  const config2 = getLlmConfig();
37424
37475
  if (!config2)
37425
37476
  return json({ configured: false }, 200, port);
37426
37477
  return json({ configured: true, provider: config2.provider, model: config2.model, key: maskKey(config2.api_key), strip: config2.strip }, 200, port);
37427
37478
  }
37428
- if (path2 === "/api/llm" && method === "POST") {
37479
+ if (path3 === "/api/llm" && method === "POST") {
37429
37480
  const body = await req.json().catch(() => ({}));
37430
37481
  const validProviders = ["cerebras", "groq", "openai", "anthropic"];
37431
37482
  const provider = body.provider;
@@ -37439,7 +37490,7 @@ ${result.stderr}`;
37439
37490
  saveLlmConfig({ provider, model, api_key, strip });
37440
37491
  return json({ success: true, provider, model, strip }, 200, port);
37441
37492
  }
37442
- if (path2 === "/api/llm/test" && method === "POST") {
37493
+ if (path3 === "/api/llm/test" && method === "POST") {
37443
37494
  const config2 = getLlmConfig();
37444
37495
  if (!config2)
37445
37496
  return json({ error: "No LLM configured" }, 400, port);
@@ -37451,17 +37502,17 @@ ${result.stderr}`;
37451
37502
  return json({ success: false, error: e instanceof Error ? e.message : String(e) }, 500, port);
37452
37503
  }
37453
37504
  }
37454
- if (path2 === "/api/jobs" && method === "GET") {
37505
+ if (path3 === "/api/jobs" && method === "GET") {
37455
37506
  return json(listJobs(getDatabase3()), 200, port);
37456
37507
  }
37457
- if (path2 === "/api/jobs" && method === "POST") {
37508
+ if (path3 === "/api/jobs" && method === "POST") {
37458
37509
  const body = await req.json().catch(() => ({}));
37459
37510
  if (!body.name || !body.connector || !body.command || !body.cron)
37460
37511
  return json({ error: "name, connector, command, cron required" }, 400, port);
37461
37512
  const job = createJob({ name: body.name, connector: body.connector, command: body.command, args: body.args ?? [], cron: body.cron, strip: !!body.strip }, getDatabase3());
37462
37513
  return json(job, 201, port);
37463
37514
  }
37464
- const jobMatch = path2.match(/^\/api\/jobs\/([^/]+)$/);
37515
+ const jobMatch = path3.match(/^\/api\/jobs\/([^/]+)$/);
37465
37516
  if (jobMatch) {
37466
37517
  const db = getDatabase3();
37467
37518
  const job = getJobByName(jobMatch[1]) ?? getDatabase3().query("SELECT * FROM connector_jobs WHERE id = ?").get(jobMatch[1]);
@@ -37483,7 +37534,7 @@ ${result.stderr}`;
37483
37534
  return json(updated, 200, port);
37484
37535
  }
37485
37536
  }
37486
- const jobRunMatch = path2.match(/^\/api\/jobs\/([^/]+)\/run$/);
37537
+ const jobRunMatch = path3.match(/^\/api\/jobs\/([^/]+)\/run$/);
37487
37538
  if (jobRunMatch && method === "POST") {
37488
37539
  const db = getDatabase3();
37489
37540
  const job = getJobByName(jobRunMatch[1], db);
@@ -37492,17 +37543,17 @@ ${result.stderr}`;
37492
37543
  const result = await triggerJob(job, db);
37493
37544
  return json(result, 200, port);
37494
37545
  }
37495
- if (path2 === "/api/workflows" && method === "GET") {
37546
+ if (path3 === "/api/workflows" && method === "GET") {
37496
37547
  return json(listWorkflows(getDatabase3()), 200, port);
37497
37548
  }
37498
- if (path2 === "/api/workflows" && method === "POST") {
37549
+ if (path3 === "/api/workflows" && method === "POST") {
37499
37550
  const body = await req.json().catch(() => ({}));
37500
37551
  if (!body.name || !body.steps)
37501
37552
  return json({ error: "name and steps required" }, 400, port);
37502
37553
  const wf = createWorkflow({ name: body.name, steps: body.steps }, getDatabase3());
37503
37554
  return json(wf, 201, port);
37504
37555
  }
37505
- const wfMatch = path2.match(/^\/api\/workflows\/([^/]+)$/);
37556
+ const wfMatch = path3.match(/^\/api\/workflows\/([^/]+)$/);
37506
37557
  if (wfMatch) {
37507
37558
  const db = getDatabase3();
37508
37559
  const wf = getWorkflowByName(wfMatch[1], db);
@@ -37515,7 +37566,7 @@ ${result.stderr}`;
37515
37566
  return json({ success: true }, 200, port);
37516
37567
  }
37517
37568
  }
37518
- const wfRunMatch = path2.match(/^\/api\/workflows\/([^/]+)\/run$/);
37569
+ const wfRunMatch = path3.match(/^\/api\/workflows\/([^/]+)\/run$/);
37519
37570
  if (wfRunMatch && method === "POST") {
37520
37571
  const wf = getWorkflowByName(wfRunMatch[1], getDatabase3());
37521
37572
  if (!wf)
@@ -37523,10 +37574,10 @@ ${result.stderr}`;
37523
37574
  const result = await runWorkflow(wf);
37524
37575
  return json(result, 200, port);
37525
37576
  }
37526
- if (path2 === "/api/agents" && method === "GET") {
37577
+ if (path3 === "/api/agents" && method === "GET") {
37527
37578
  return json(listAgents(), 200, port);
37528
37579
  }
37529
- if (path2 === "/api/agents/register" && method === "POST") {
37580
+ if (path3 === "/api/agents/register" && method === "POST") {
37530
37581
  const body = await req.json().catch(() => ({}));
37531
37582
  const name = typeof body.name === "string" ? body.name : null;
37532
37583
  if (!name)
@@ -37540,15 +37591,15 @@ ${result.stderr}`;
37540
37591
  return json(result, 409, port);
37541
37592
  return json(result, 200, port);
37542
37593
  }
37543
- if (path2.startsWith("/api/agents/") && method === "DELETE") {
37544
- const agentName = path2.slice("/api/agents/".length);
37594
+ if (path3.startsWith("/api/agents/") && method === "DELETE") {
37595
+ const agentName = path3.slice("/api/agents/".length);
37545
37596
  const agent = getAgentByName(agentName);
37546
37597
  if (!agent)
37547
37598
  return json({ error: "Agent not found" }, 404, port);
37548
37599
  deleteAgent(agent.id);
37549
37600
  return json({ success: true }, 200, port);
37550
37601
  }
37551
- const rateMatch = path2.match(/^\/api\/rate\/([^/]+)\/([^/]+)$/);
37602
+ const rateMatch = path3.match(/^\/api\/rate\/([^/]+)\/([^/]+)$/);
37552
37603
  if (rateMatch && method === "GET") {
37553
37604
  const [, agentId, connector] = rateMatch;
37554
37605
  const limit = parseInt(url2.searchParams.get("limit") || "60", 10);
@@ -37556,7 +37607,7 @@ ${result.stderr}`;
37556
37607
  const result = consume ? checkRateBudget(agentId, connector, limit) : getRateBudget(agentId, connector, limit);
37557
37608
  return json(result, 200, port);
37558
37609
  }
37559
- const profilesMatch = path2.match(/^\/api\/connectors\/([^/]+)\/profiles$/);
37610
+ const profilesMatch = path3.match(/^\/api\/connectors\/([^/]+)\/profiles$/);
37560
37611
  if (profilesMatch && method === "GET") {
37561
37612
  const name = profilesMatch[1];
37562
37613
  if (!isValidConnectorName(name))
@@ -37578,7 +37629,7 @@ ${result.stderr}`;
37578
37629
  return json({ error: e instanceof Error ? e.message : "Failed to list profiles" }, 500, port);
37579
37630
  }
37580
37631
  }
37581
- const profileSwitchMatch = path2.match(/^\/api\/connectors\/([^/]+)\/profiles\/switch$/);
37632
+ const profileSwitchMatch = path3.match(/^\/api\/connectors\/([^/]+)\/profiles\/switch$/);
37582
37633
  if (profileSwitchMatch && method === "POST") {
37583
37634
  const name = profileSwitchMatch[1];
37584
37635
  if (!isValidConnectorName(name))
@@ -37597,7 +37648,7 @@ ${result.stderr}`;
37597
37648
  return json({ error: e instanceof Error ? e.message : "Failed to switch profile" }, 500, port);
37598
37649
  }
37599
37650
  }
37600
- const profileDeleteMatch = path2.match(/^\/api\/connectors\/([^/]+)\/profiles\/([^/]+)$/);
37651
+ const profileDeleteMatch = path3.match(/^\/api\/connectors\/([^/]+)\/profiles\/([^/]+)$/);
37601
37652
  if (profileDeleteMatch && method === "DELETE") {
37602
37653
  const name = profileDeleteMatch[1];
37603
37654
  const profile = profileDeleteMatch[2];
@@ -37615,7 +37666,7 @@ ${result.stderr}`;
37615
37666
  return json({ error: e instanceof Error ? e.message : "Failed to delete profile" }, 500, port);
37616
37667
  }
37617
37668
  }
37618
- if (path2 === "/api/export" && method === "GET") {
37669
+ if (path3 === "/api/export" && method === "GET") {
37619
37670
  try {
37620
37671
  const connectDir = getConnectorsHome();
37621
37672
  const result = {};
@@ -37665,7 +37716,7 @@ ${result.stderr}`;
37665
37716
  return json({ error: e instanceof Error ? e.message : "Failed to export credentials" }, 500, port);
37666
37717
  }
37667
37718
  }
37668
- if (path2 === "/api/import" && method === "POST") {
37719
+ if (path3 === "/api/import" && method === "POST") {
37669
37720
  try {
37670
37721
  const contentLength = parseInt(req.headers.get("content-length") || "0", 10);
37671
37722
  if (contentLength > MAX_BODY_SIZE)
@@ -37698,7 +37749,7 @@ ${result.stderr}`;
37698
37749
  return json({ error: e instanceof Error ? e.message : "Failed to import credentials" }, 500, port);
37699
37750
  }
37700
37751
  }
37701
- const oauthStartMatch = path2.match(/^\/oauth\/([^/]+)\/start$/);
37752
+ const oauthStartMatch = path3.match(/^\/oauth\/([^/]+)\/start$/);
37702
37753
  if (oauthStartMatch && method === "GET") {
37703
37754
  const name = oauthStartMatch[1];
37704
37755
  const redirectUri = `http://localhost:${port}/oauth/${name}/callback`;
@@ -37708,7 +37759,7 @@ ${result.stderr}`;
37708
37759
  }
37709
37760
  return Response.redirect(authUrl, 302);
37710
37761
  }
37711
- const oauthCallbackMatch = path2.match(/^\/oauth\/([^/]+)\/callback$/);
37762
+ const oauthCallbackMatch = path3.match(/^\/oauth\/([^/]+)\/callback$/);
37712
37763
  if (oauthCallbackMatch && method === "GET") {
37713
37764
  const name = oauthCallbackMatch[1];
37714
37765
  const code = url2.searchParams.get("code");
@@ -37742,8 +37793,8 @@ ${result.stderr}`;
37742
37793
  });
37743
37794
  }
37744
37795
  if (dashboardExists && (method === "GET" || method === "HEAD")) {
37745
- if (path2 !== "/") {
37746
- const filePath = join14(dashboardDir, path2);
37796
+ if (path3 !== "/") {
37797
+ const filePath = join14(dashboardDir, path3);
37747
37798
  const rel = relative(dashboardDir, resolve(filePath));
37748
37799
  if (!rel.startsWith("..") && !rel.includes(`..${sep}`) && rel !== "") {
37749
37800
  const res2 = serveStaticFile(filePath);
package/dist/index.js CHANGED
@@ -5764,7 +5764,7 @@ function extractGoogleError(body) {
5764
5764
  // package.json
5765
5765
  var package_default = {
5766
5766
  name: "@hasna/connectors",
5767
- version: "1.4.3",
5767
+ version: "1.4.4",
5768
5768
  description: "Open source connector library - Install API connectors with a single command",
5769
5769
  type: "module",
5770
5770
  bin: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/connectors",
3
- "version": "1.4.3",
3
+ "version": "1.4.4",
4
4
  "description": "Open source connector library - Install API connectors with a single command",
5
5
  "type": "module",
6
6
  "bin": {