@aliwey/bmo 2.0.5 → 2.0.7

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/bmo.js CHANGED
@@ -16,6 +16,32 @@ const PKG_DIR = path.join(__dirname, '..');
16
16
  const BMO_HOME = process.env.BMO_HOME || path.join(os.homedir(), '.bmo');
17
17
  const VERSION = require('../package.json').version;
18
18
 
19
+ // Load config from ~/.bmo/.env into process.env if it exists
20
+ const envPath = path.join(BMO_HOME, '.env');
21
+ if (fs.existsSync(envPath)) {
22
+ try {
23
+ const content = fs.readFileSync(envPath, 'utf8');
24
+ const lines = content.split(/\r?\n/);
25
+ for (const line of lines) {
26
+ const trimmed = line.trim();
27
+ if (!trimmed || trimmed.startsWith('#')) continue;
28
+ const match = trimmed.match(/^([^=]+)=(.*)$/);
29
+ if (match) {
30
+ const key = match[1].trim();
31
+ let val = match[2].trim();
32
+ if ((val.startsWith('"') && val.endsWith('"')) || (val.startsWith("'") && val.endsWith("'"))) {
33
+ val = val.slice(1, -1);
34
+ }
35
+ if (!process.env[key]) {
36
+ process.env[key] = val;
37
+ }
38
+ }
39
+ }
40
+ } catch (e) {
41
+ console.error(`Warning: Failed to load .env from ${envPath}: ${e.message}`);
42
+ }
43
+ }
44
+
19
45
  // ── Helpers ─────────────────────────────────────────────────────────────────
20
46
 
21
47
  function sleep(ms) {
@@ -126,6 +152,17 @@ Data lives in: ${BMO_HOME_DISPLAY}
126
152
  // ── bmo --update [version] ────────────────────────────────────────────────
127
153
  if (cmd === '--update' || cmd === '-update' || cmd === 'update') {
128
154
  const ver = args[0] ? `@${args[0]}` : '@latest';
155
+ console.log(`Stopping any running BMO background processes to release file locks...`);
156
+ try {
157
+ if (os.platform() === 'win32') {
158
+ execSync(`powershell -Command "Get-CimInstance Win32_Process | Where-Object { $_.CommandLine -like '*main.py*' -or $_.CommandLine -like '*cli.py*' -or $_.CommandLine -like '*bmo*' } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue }"`, { stdio: 'ignore' });
159
+ } else {
160
+ execSync(`pkill -f "main.py|cli.py|bmo" || true`, { stdio: 'ignore' });
161
+ }
162
+ } catch (e) {
163
+ // Ignore failures
164
+ }
165
+
129
166
  console.log(`🗑️ Uninstalling old version of @aliwey/bmo...`);
130
167
  try {
131
168
  execSync('npm uninstall -g @aliwey/bmo', { stdio: 'inherit' });
@@ -40,6 +40,7 @@ class OpenCodeBotClient:
40
40
  base_url=OPENCODE_BASE_URL,
41
41
  headers=HEADERS,
42
42
  timeout=float(OPENCODE_TIMEOUT),
43
+ trust_env=False,
43
44
  )
44
45
  self._memory_cache: Optional[str] = None
45
46
  self._memory_cache_time: float = 0
@@ -427,6 +428,7 @@ class OpenCodeBotClient:
427
428
  base_url=OPENCODE_BASE_URL,
428
429
  headers=HEADERS,
429
430
  timeout=10.0,
431
+ trust_env=False,
430
432
  )
431
433
  # Track which part indices we've already emitted activity for (non-thinking parts only)
432
434
  _seen_part_indices: set = set()
@@ -45,7 +45,8 @@ class RequestWorker:
45
45
  async def _init_client(self):
46
46
  self.http_client = httpx.AsyncClient(
47
47
  timeout=httpx.Timeout(600.0, connect=30.0),
48
- follow_redirects=True
48
+ follow_redirects=True,
49
+ trust_env=False
49
50
  )
50
51
 
51
52
  async def _handle_query(self, task: dict):
@@ -1800,7 +1800,7 @@ async def choose_model_callback(update: Update, context: ContextTypes.DEFAULT_TY
1800
1800
 
1801
1801
  async def handle_use_skill(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
1802
1802
  try:
1803
- async with httpx.AsyncClient(base_url=OPENCODE_BASE_URL, timeout=10) as client:
1803
+ async with httpx.AsyncClient(base_url=OPENCODE_BASE_URL, timeout=10, trust_env=False) as client:
1804
1804
  r = await client.get("/agent")
1805
1805
  agents = r.json() if r.status_code == 200 else []
1806
1806
  except Exception:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aliwey/bmo",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
4
4
  "description": "BMO — AI coding assistant with Telegram, CLI & Web sync. One command, all frontends.",
5
5
  "keywords": ["ai", "coding-assistant", "telegram-bot", "cli", "opencode", "bfp"],
6
6
  "homepage": "https://github.com/aliwey/bmo",