@locusai/telegram 0.15.2 → 0.15.3

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.
Files changed (2) hide show
  1. package/bin/telegram.js +57 -5
  2. package/package.json +3 -3
package/bin/telegram.js CHANGED
@@ -39567,6 +39567,7 @@ var init_resolve_bin = __esm(() => {
39567
39567
  join3(homedir(), ".local", "bin"),
39568
39568
  join3(homedir(), ".npm", "bin"),
39569
39569
  join3(homedir(), ".npm-global", "bin"),
39570
+ join3(homedir(), ".npm-packages", "bin"),
39570
39571
  join3(homedir(), ".yarn", "bin"),
39571
39572
  join3(homedir(), ".bun", "bin"),
39572
39573
  join3(homedir(), "Library", "pnpm"),
@@ -45211,16 +45212,67 @@ async function dashboardCommand(ctx, config2) {
45211
45212
  import { spawn as spawn4 } from "node:child_process";
45212
45213
 
45213
45214
  // src/env.ts
45215
+ import { existsSync as existsSync11, readdirSync as readdirSync6, readFileSync as readFileSync10 } from "node:fs";
45214
45216
  import { homedir as homedir2 } from "node:os";
45215
45217
  import { join as join11 } from "node:path";
45218
+ function resolveNvmBinDir() {
45219
+ const nvmDir = process.env.NVM_DIR || join11(homedir2(), ".nvm");
45220
+ const versionsDir = join11(nvmDir, "versions", "node");
45221
+ if (!existsSync11(versionsDir))
45222
+ return null;
45223
+ let versions2;
45224
+ try {
45225
+ versions2 = readdirSync6(versionsDir).filter((d) => d.startsWith("v"));
45226
+ } catch {
45227
+ return null;
45228
+ }
45229
+ if (versions2.length === 0)
45230
+ return null;
45231
+ const currentNodeVersion = `v${process.versions.node}`;
45232
+ const currentBin = join11(versionsDir, currentNodeVersion, "bin");
45233
+ if (versions2.includes(currentNodeVersion) && existsSync11(currentBin)) {
45234
+ return currentBin;
45235
+ }
45236
+ const aliasPath = join11(nvmDir, "alias", "default");
45237
+ if (existsSync11(aliasPath)) {
45238
+ try {
45239
+ const alias = readFileSync10(aliasPath, "utf-8").trim();
45240
+ const match = versions2.find((v) => v === `v${alias}` || v.startsWith(`v${alias}.`));
45241
+ if (match) {
45242
+ const bin2 = join11(versionsDir, match, "bin");
45243
+ if (existsSync11(bin2))
45244
+ return bin2;
45245
+ }
45246
+ } catch {}
45247
+ }
45248
+ const sorted = versions2.sort((a, b) => {
45249
+ const pa = a.slice(1).split(".").map(Number);
45250
+ const pb = b.slice(1).split(".").map(Number);
45251
+ for (let i = 0;i < 3; i++) {
45252
+ if ((pa[i] || 0) !== (pb[i] || 0))
45253
+ return (pb[i] || 0) - (pa[i] || 0);
45254
+ }
45255
+ return 0;
45256
+ });
45257
+ const bin = join11(versionsDir, sorted[0], "bin");
45258
+ return existsSync11(bin) ? bin : null;
45259
+ }
45216
45260
  function extraPathDirs() {
45217
45261
  const home = homedir2();
45218
- return [
45262
+ const dirs = [
45219
45263
  join11(home, ".bun", "bin"),
45220
- join11(home, ".nvm", "current", "bin"),
45221
45264
  join11(home, ".local", "bin"),
45265
+ join11(home, ".npm", "bin"),
45266
+ join11(home, ".npm-global", "bin"),
45222
45267
  "/usr/local/bin"
45223
45268
  ];
45269
+ const nvmBin = resolveNvmBinDir();
45270
+ if (nvmBin)
45271
+ dirs.push(nvmBin);
45272
+ const fnmCurrent = join11(home, ".fnm", "current", "bin");
45273
+ if (existsSync11(fnmCurrent))
45274
+ dirs.push(fnmCurrent);
45275
+ return dirs;
45224
45276
  }
45225
45277
  function buildSpawnEnv() {
45226
45278
  const existing = process.env.PATH ?? "";
@@ -46663,17 +46715,17 @@ function createBot(config2) {
46663
46715
 
46664
46716
  // src/config.ts
46665
46717
  var import_dotenv = __toESM(require_main(), 1);
46666
- import { existsSync as existsSync11, readFileSync as readFileSync10 } from "node:fs";
46718
+ import { existsSync as existsSync12, readFileSync as readFileSync11 } from "node:fs";
46667
46719
  import { join as join14 } from "node:path";
46668
46720
  import_dotenv.default.config();
46669
46721
  var SETTINGS_FILE2 = "settings.json";
46670
46722
  var CONFIG_DIR2 = ".locus";
46671
46723
  function loadSettings2(projectPath) {
46672
46724
  const settingsPath = join14(projectPath, CONFIG_DIR2, SETTINGS_FILE2);
46673
- if (!existsSync11(settingsPath)) {
46725
+ if (!existsSync12(settingsPath)) {
46674
46726
  return null;
46675
46727
  }
46676
- const raw = readFileSync10(settingsPath, "utf-8");
46728
+ const raw = readFileSync11(settingsPath, "utf-8");
46677
46729
  return JSON.parse(raw);
46678
46730
  }
46679
46731
  function resolveConfig() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@locusai/telegram",
3
- "version": "0.15.2",
3
+ "version": "0.15.3",
4
4
  "description": "Telegram bot for Locus - remote control your AI agents from Telegram",
5
5
  "type": "module",
6
6
  "main": "./src/lib.ts",
@@ -41,8 +41,8 @@
41
41
  "author": "",
42
42
  "license": "MIT",
43
43
  "dependencies": {
44
- "@locusai/sdk": "^0.15.2",
45
- "@locusai/shared": "^0.15.2",
44
+ "@locusai/sdk": "^0.15.3",
45
+ "@locusai/shared": "^0.15.3",
46
46
  "dotenv": "^16.4.7",
47
47
  "telegraf": "^4.16.3"
48
48
  },