@locusai/telegram 0.9.8 → 0.9.9
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/telegram.js +36 -20
- package/package.json +2 -2
package/bin/telegram.js
CHANGED
|
@@ -19868,6 +19868,32 @@ function splitMessage(text, maxLength = MAX_MESSAGE_LENGTH) {
|
|
|
19868
19868
|
|
|
19869
19869
|
// src/shell-executor.ts
|
|
19870
19870
|
import { spawn } from "node:child_process";
|
|
19871
|
+
|
|
19872
|
+
// src/env.ts
|
|
19873
|
+
import { homedir } from "node:os";
|
|
19874
|
+
import { join } from "node:path";
|
|
19875
|
+
function extraPathDirs() {
|
|
19876
|
+
const home = homedir();
|
|
19877
|
+
return [
|
|
19878
|
+
join(home, ".bun", "bin"),
|
|
19879
|
+
join(home, ".nvm", "current", "bin"),
|
|
19880
|
+
join(home, ".local", "bin"),
|
|
19881
|
+
"/usr/local/bin"
|
|
19882
|
+
];
|
|
19883
|
+
}
|
|
19884
|
+
function buildSpawnEnv() {
|
|
19885
|
+
const existing = process.env.PATH ?? "";
|
|
19886
|
+
const extras = extraPathDirs().filter((d) => !existing.includes(d));
|
|
19887
|
+
const augmentedPath = [...extras, existing].filter(Boolean).join(":");
|
|
19888
|
+
return {
|
|
19889
|
+
...process.env,
|
|
19890
|
+
PATH: augmentedPath,
|
|
19891
|
+
FORCE_COLOR: "0",
|
|
19892
|
+
NO_COLOR: "1"
|
|
19893
|
+
};
|
|
19894
|
+
}
|
|
19895
|
+
|
|
19896
|
+
// src/shell-executor.ts
|
|
19871
19897
|
function timestamp() {
|
|
19872
19898
|
return new Date().toLocaleTimeString("en-GB", { hour12: false });
|
|
19873
19899
|
}
|
|
@@ -19882,11 +19908,7 @@ function executeShellCommand(command, options) {
|
|
|
19882
19908
|
return new Promise((resolve) => {
|
|
19883
19909
|
const proc = spawn(command.binary, command.args, {
|
|
19884
19910
|
cwd: options.cwd,
|
|
19885
|
-
env:
|
|
19886
|
-
...process.env,
|
|
19887
|
-
FORCE_COLOR: "0",
|
|
19888
|
-
NO_COLOR: "1"
|
|
19889
|
-
},
|
|
19911
|
+
env: buildSpawnEnv(),
|
|
19890
19912
|
stdio: ["pipe", "pipe", "pipe"]
|
|
19891
19913
|
});
|
|
19892
19914
|
let stdout = "";
|
|
@@ -20202,7 +20224,9 @@ async function runCommand(ctx, executor, config) {
|
|
|
20202
20224
|
if (agentsMatch) {
|
|
20203
20225
|
parsedAgentCount = Number.parseInt(agentsMatch[1], 10);
|
|
20204
20226
|
if (parsedAgentCount < 1 || parsedAgentCount > 5) {
|
|
20205
|
-
await ctx.reply(formatError("Agent count must be between 1 and 5."), {
|
|
20227
|
+
await ctx.reply(formatError("Agent count must be between 1 and 5."), {
|
|
20228
|
+
parse_mode: "HTML"
|
|
20229
|
+
});
|
|
20206
20230
|
return;
|
|
20207
20231
|
}
|
|
20208
20232
|
}
|
|
@@ -38501,7 +38525,7 @@ Feedback: <i>${escapeHtml(feedback)}</i>`, { parse_mode: "HTML" });
|
|
|
38501
38525
|
}
|
|
38502
38526
|
// src/executor.ts
|
|
38503
38527
|
import { spawn as spawn2 } from "node:child_process";
|
|
38504
|
-
import { join } from "node:path";
|
|
38528
|
+
import { join as join2 } from "node:path";
|
|
38505
38529
|
function timestamp2() {
|
|
38506
38530
|
return new Date().toLocaleTimeString("en-GB", { hour12: false });
|
|
38507
38531
|
}
|
|
@@ -38517,7 +38541,7 @@ class CliExecutor {
|
|
|
38517
38541
|
}
|
|
38518
38542
|
resolveCommand(args) {
|
|
38519
38543
|
if (this.config.testMode) {
|
|
38520
|
-
const cliPath =
|
|
38544
|
+
const cliPath = join2(this.config.projectPath, "packages/cli/src/cli.ts");
|
|
38521
38545
|
return { cmd: "bun", cmdArgs: ["run", cliPath, ...args] };
|
|
38522
38546
|
}
|
|
38523
38547
|
return { cmd: "locus", cmdArgs: args };
|
|
@@ -38532,11 +38556,7 @@ class CliExecutor {
|
|
|
38532
38556
|
return new Promise((resolve) => {
|
|
38533
38557
|
const proc = spawn2(cmd, cmdArgs, {
|
|
38534
38558
|
cwd: this.config.projectPath,
|
|
38535
|
-
env:
|
|
38536
|
-
...process.env,
|
|
38537
|
-
FORCE_COLOR: "0",
|
|
38538
|
-
NO_COLOR: "1"
|
|
38539
|
-
},
|
|
38559
|
+
env: buildSpawnEnv(),
|
|
38540
38560
|
stdio: ["pipe", "pipe", "pipe"]
|
|
38541
38561
|
});
|
|
38542
38562
|
this.runningProcesses.set(id, {
|
|
@@ -38586,11 +38606,7 @@ class CliExecutor {
|
|
|
38586
38606
|
log2(id, `Process started (streaming): ${fullCommand}`);
|
|
38587
38607
|
const proc = spawn2(cmd, cmdArgs, {
|
|
38588
38608
|
cwd: this.config.projectPath,
|
|
38589
|
-
env:
|
|
38590
|
-
...process.env,
|
|
38591
|
-
FORCE_COLOR: "0",
|
|
38592
|
-
NO_COLOR: "1"
|
|
38593
|
-
},
|
|
38609
|
+
env: buildSpawnEnv(),
|
|
38594
38610
|
stdio: ["pipe", "pipe", "pipe"]
|
|
38595
38611
|
});
|
|
38596
38612
|
this.runningProcesses.set(id, {
|
|
@@ -38726,12 +38742,12 @@ function createBot(config2) {
|
|
|
38726
38742
|
// src/config.ts
|
|
38727
38743
|
var import_dotenv = __toESM(require_main(), 1);
|
|
38728
38744
|
import { existsSync, readFileSync } from "node:fs";
|
|
38729
|
-
import { join as
|
|
38745
|
+
import { join as join3 } from "node:path";
|
|
38730
38746
|
import_dotenv.default.config();
|
|
38731
38747
|
var SETTINGS_FILE = "settings.json";
|
|
38732
38748
|
var CONFIG_DIR = ".locus";
|
|
38733
38749
|
function loadSettings(projectPath) {
|
|
38734
|
-
const settingsPath =
|
|
38750
|
+
const settingsPath = join3(projectPath, CONFIG_DIR, SETTINGS_FILE);
|
|
38735
38751
|
if (!existsSync(settingsPath)) {
|
|
38736
38752
|
return null;
|
|
38737
38753
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@locusai/telegram",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.9",
|
|
4
4
|
"description": "Telegram bot for Locus - remote control your AI agents from Telegram",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"author": "",
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@locusai/sdk": "^0.9.
|
|
35
|
+
"@locusai/sdk": "^0.9.9",
|
|
36
36
|
"dotenv": "^16.4.7",
|
|
37
37
|
"telegraf": "^4.16.3"
|
|
38
38
|
},
|