bloby-bot 0.70.4 → 0.70.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bloby-bot",
3
- "version": "0.70.4",
3
+ "version": "0.70.5",
4
4
  "releaseNotes": [
5
5
  "1. Fix: agent self-update ",
6
6
  "1",
@@ -10,7 +10,7 @@
10
10
  "type": "module",
11
11
  "license": "BUSL-1.1",
12
12
  "bin": {
13
- "bloby": "./bin/cli.js"
13
+ "bloby": "bin/cli.js"
14
14
  },
15
15
  "files": [
16
16
  "LICENSE",
package/scripts/install CHANGED
@@ -32,6 +32,20 @@ DIM='\033[2m'
32
32
  BOLD='\033[1m'
33
33
  RESET='\033[0m'
34
34
 
35
+ # Disable colors if not a terminal
36
+ if [ ! -t 1 ]; then
37
+ BLUE='' PINK='' YELLOW='' RED='' DIM='' BOLD='' RESET='' G1='' G2='' G3='' G4='' G5='' G6='' G7=''
38
+ fi
39
+
40
+ # Cleanup on exit (restore cursor, reset colors, remove temp files)
41
+ cleanup() {
42
+ printf '\033[?25h' # show cursor
43
+ printf "${RESET}"
44
+ rm -f "$TMPFILE" 2>/dev/null
45
+ rm -rf "$TMPDIR" 2>/dev/null
46
+ }
47
+ trap cleanup EXIT INT TERM
48
+
35
49
  printf "\n"
36
50
  printf "${G1}${BOLD} █▄ ${RESET}\n"
37
51
  printf "${G2}${BOLD} ▄ ▄ ██ ${RESET}\n"
@@ -147,14 +161,14 @@ install_bloby() {
147
161
  fi
148
162
 
149
163
  # Fetch version + tarball URL from npm registry
150
- NPM_VERSION=$("$NPM" view bloby version 2>/dev/null || echo "")
164
+ NPM_VERSION=$("$NPM" view bloby-bot version 2>/dev/null || echo "")
151
165
  if [ -n "$NPM_VERSION" ]; then
152
- printf " ${DIM}Latest npm version: bloby@${NPM_VERSION}${RESET}\n"
166
+ printf " ${DIM}Latest npm version: bloby-bot@${NPM_VERSION}${RESET}\n"
153
167
  fi
154
168
 
155
169
  printf " ${BLUE}↓${RESET} Installing bloby...\n"
156
170
 
157
- TARBALL_URL=$("$NPM" view bloby dist.tarball 2>/dev/null)
171
+ TARBALL_URL=$("$NPM" view bloby-bot dist.tarball 2>/dev/null || echo "")
158
172
  if [ -z "$TARBALL_URL" ]; then
159
173
  printf " ${RED}✗${RESET} Failed to fetch package info from npm\n"
160
174
  exit 1
@@ -213,7 +227,30 @@ install_bloby() {
213
227
  # resolver (ERESOLVE). Persist legacy-peer-deps so npm install resolves cleanly.
214
228
  grep -qs '^legacy-peer-deps' "$BLOBY_HOME/.npmrc" 2>/dev/null || printf 'legacy-peer-deps=true\n' >> "$BLOBY_HOME/.npmrc"
215
229
  printf " ${BLUE}↓${RESET} Installing dependencies...\n"
216
- (cd "$BLOBY_HOME" && "$NPM" install --omit=dev 2>/dev/null)
230
+ INSTALL_LOG=$(mktemp)
231
+ if ! (cd "$BLOBY_HOME" && "$NPM" install --omit=dev > "$INSTALL_LOG" 2>&1); then
232
+ printf " ${RED}✗${RESET} Dependency install failed:\n"
233
+ cat "$INSTALL_LOG"
234
+ rm -f "$INSTALL_LOG"
235
+ exit 1
236
+ fi
237
+ rm -f "$INSTALL_LOG"
238
+
239
+ # Install workspace dependencies (rebuilds native modules for this platform —
240
+ # workspace/node_modules is intentionally not shipped in the tarball so that
241
+ # better-sqlite3 etc. get a prebuild matching the target OS+arch, not the
242
+ # publisher's machine)
243
+ if [ -f "$BLOBY_HOME/workspace/package.json" ]; then
244
+ printf " ${BLUE}↓${RESET} Installing workspace dependencies...\n"
245
+ WS_INSTALL_LOG=$(mktemp)
246
+ if ! (cd "$BLOBY_HOME/workspace" && "$NPM" install --omit=dev > "$WS_INSTALL_LOG" 2>&1); then
247
+ printf " ${RED}✗${RESET} Workspace dependency install failed:\n"
248
+ cat "$WS_INSTALL_LOG"
249
+ rm -f "$WS_INSTALL_LOG"
250
+ exit 1
251
+ fi
252
+ rm -f "$WS_INSTALL_LOG"
253
+ fi
217
254
 
218
255
  # Verify
219
256
  if [ ! -f "$BLOBY_HOME/bin/cli.js" ]; then
@@ -320,6 +357,7 @@ printf "\n"
320
357
  printf " ${BLUE}bloby init${RESET} Set up your bot\n"
321
358
  printf " ${BLUE}bloby start${RESET} Start your bot\n"
322
359
  printf " ${BLUE}bloby status${RESET} Check if it's running\n"
360
+ printf " ${BLUE}bloby help${RESET} All commands\n"
323
361
  printf "\n"
324
362
  printf " ${PINK}>${RESET} Run ${BLUE}bloby init${RESET} to begin.\n"
325
363
  printf " ${DIM}(Open a new terminal if 'bloby' isn't found yet)${RESET}\n"
@@ -165,14 +165,14 @@ function Install-Bloby {
165
165
 
166
166
  # Fetch version + tarball URL from npm registry
167
167
  $npmVersion = ""
168
- try { $npmVersion = (& $NPM view bloby version 2>$null).Trim() } catch {}
168
+ try { $npmVersion = (& $NPM view bloby-bot version 2>$null).Trim() } catch {}
169
169
  if ($npmVersion) {
170
- Write-Host " Latest npm version: bloby@${npmVersion}" -ForegroundColor DarkGray
170
+ Write-Host " Latest npm version: bloby-bot@${npmVersion}" -ForegroundColor DarkGray
171
171
  }
172
172
 
173
173
  Write-Down "Installing bloby..."
174
174
 
175
- $tarballUrl = (& $NPM view bloby dist.tarball 2>$null).Trim()
175
+ $tarballUrl = (& $NPM view bloby-bot dist.tarball 2>$null).Trim()
176
176
  if (-not $tarballUrl) {
177
177
  Write-Host " ✗ Failed to fetch package info from npm" -ForegroundColor Red
178
178
  exit 1
@@ -32,6 +32,20 @@ DIM='\033[2m'
32
32
  BOLD='\033[1m'
33
33
  RESET='\033[0m'
34
34
 
35
+ # Disable colors if not a terminal
36
+ if [ ! -t 1 ]; then
37
+ BLUE='' PINK='' YELLOW='' RED='' DIM='' BOLD='' RESET='' G1='' G2='' G3='' G4='' G5='' G6='' G7=''
38
+ fi
39
+
40
+ # Cleanup on exit (restore cursor, reset colors, remove temp files)
41
+ cleanup() {
42
+ printf '\033[?25h' # show cursor
43
+ printf "${RESET}"
44
+ rm -f "$TMPFILE" 2>/dev/null
45
+ rm -rf "$TMPDIR" 2>/dev/null
46
+ }
47
+ trap cleanup EXIT INT TERM
48
+
35
49
  printf "\n"
36
50
  printf "${G1}${BOLD} █▄ ${RESET}\n"
37
51
  printf "${G2}${BOLD} ▄ ▄ ██ ${RESET}\n"
@@ -147,14 +161,14 @@ install_bloby() {
147
161
  fi
148
162
 
149
163
  # Fetch version + tarball URL from npm registry
150
- NPM_VERSION=$("$NPM" view bloby version 2>/dev/null || echo "")
164
+ NPM_VERSION=$("$NPM" view bloby-bot version 2>/dev/null || echo "")
151
165
  if [ -n "$NPM_VERSION" ]; then
152
- printf " ${DIM}Latest npm version: bloby@${NPM_VERSION}${RESET}\n"
166
+ printf " ${DIM}Latest npm version: bloby-bot@${NPM_VERSION}${RESET}\n"
153
167
  fi
154
168
 
155
169
  printf " ${BLUE}↓${RESET} Installing bloby...\n"
156
170
 
157
- TARBALL_URL=$("$NPM" view bloby dist.tarball 2>/dev/null)
171
+ TARBALL_URL=$("$NPM" view bloby-bot dist.tarball 2>/dev/null || echo "")
158
172
  if [ -z "$TARBALL_URL" ]; then
159
173
  printf " ${RED}✗${RESET} Failed to fetch package info from npm\n"
160
174
  exit 1
@@ -213,15 +227,29 @@ install_bloby() {
213
227
  # resolver (ERESOLVE). Persist legacy-peer-deps so npm install resolves cleanly.
214
228
  grep -qs '^legacy-peer-deps' "$BLOBY_HOME/.npmrc" 2>/dev/null || printf 'legacy-peer-deps=true\n' >> "$BLOBY_HOME/.npmrc"
215
229
  printf " ${BLUE}↓${RESET} Installing dependencies...\n"
216
- (cd "$BLOBY_HOME" && "$NPM" install --omit=dev 2>/dev/null)
230
+ INSTALL_LOG=$(mktemp)
231
+ if ! (cd "$BLOBY_HOME" && "$NPM" install --omit=dev > "$INSTALL_LOG" 2>&1); then
232
+ printf " ${RED}✗${RESET} Dependency install failed:\n"
233
+ cat "$INSTALL_LOG"
234
+ rm -f "$INSTALL_LOG"
235
+ exit 1
236
+ fi
237
+ rm -f "$INSTALL_LOG"
217
238
 
218
- # Install workspace dependencies (rebuilds native modules for this platform)
239
+ # Install workspace dependencies (rebuilds native modules for this platform
240
+ # workspace/node_modules is intentionally not shipped in the tarball so that
241
+ # better-sqlite3 etc. get a prebuild matching the target OS+arch, not the
242
+ # publisher's machine)
219
243
  if [ -f "$BLOBY_HOME/workspace/package.json" ]; then
220
244
  printf " ${BLUE}↓${RESET} Installing workspace dependencies...\n"
221
- if ! (cd "$BLOBY_HOME/workspace" && "$NPM" install --omit=dev); then
222
- printf " ${RED}✗${RESET} Workspace dependency install failed backend may not start\n"
245
+ WS_INSTALL_LOG=$(mktemp)
246
+ if ! (cd "$BLOBY_HOME/workspace" && "$NPM" install --omit=dev > "$WS_INSTALL_LOG" 2>&1); then
247
+ printf " ${RED}✗${RESET} Workspace dependency install failed:\n"
248
+ cat "$WS_INSTALL_LOG"
249
+ rm -f "$WS_INSTALL_LOG"
223
250
  exit 1
224
251
  fi
252
+ rm -f "$WS_INSTALL_LOG"
225
253
  fi
226
254
 
227
255
  # Verify
@@ -14,8 +14,12 @@ const PKG_ROOT = path.resolve(__dirname, '..');
14
14
  const BLOBY_HOME = path.join(os.homedir(), '.bloby');
15
15
 
16
16
  // Loop guard: if we're already running inside ~/.bloby/, exit
17
- // (prevents infinite loop when npm install triggers postinstall again)
18
- if (path.resolve(PKG_ROOT) === path.resolve(BLOBY_HOME)) {
17
+ // (prevents infinite loop when npm install triggers postinstall again).
18
+ // Compare realpaths — npm may run us from a symlinked cwd (e.g. /tmp vs
19
+ // /private/tmp on macOS), and a missed match makes cpSync copy a dir onto
20
+ // itself, which is a hard error on Node 22+.
21
+ const realOrSelf = (p) => { try { return fs.realpathSync(p); } catch { return path.resolve(p); } };
22
+ if (realOrSelf(PKG_ROOT) === realOrSelf(BLOBY_HOME)) {
19
23
  process.exit(0);
20
24
  }
21
25
 
@@ -68,6 +72,14 @@ for (const file of CODE_FILES) {
68
72
 
69
73
  // ── Install dependencies in ~/.bloby/ ──
70
74
 
75
+ // This script runs as an npm lifecycle hook, so the environment carries the
76
+ // parent install's npm_config_* vars (global=true, prefix, etc.). A nested
77
+ // `npm install` inherits them and silently runs in global mode — wiping
78
+ // node_modules instead of installing deps. Strip them.
79
+ const NPM_ENV = Object.fromEntries(
80
+ Object.entries(process.env).filter(([k]) => !/^npm_config_/i.test(k))
81
+ );
82
+
71
83
  // claude-agent-sdk 0.3.x moved @anthropic-ai/sdk + @modelcontextprotocol/sdk to
72
84
  // peerDependencies; upgrading the existing ~/.bloby tree in place deadlocks npm's
73
85
  // resolver (ERESOLVE). Persist legacy-peer-deps so this install — and the manual
@@ -84,6 +96,7 @@ try {
84
96
  execSync('npm install --omit=dev', {
85
97
  cwd: BLOBY_HOME,
86
98
  stdio: 'inherit',
99
+ env: NPM_ENV,
87
100
  });
88
101
  } catch (e) {
89
102
  // Don't swallow this — partial deps leave bloby in a crash loop on first
@@ -130,6 +143,7 @@ try {
130
143
  execSync('npm install --omit=dev', {
131
144
  cwd: path.join(BLOBY_HOME, 'workspace'),
132
145
  stdio: 'inherit',
146
+ env: NPM_ENV,
133
147
  });
134
148
  } catch {
135
149
  console.error('Error: workspace dependency install failed — backend will not start until fixed.');
@@ -150,6 +164,7 @@ if (fs.existsSync(distSrc)) {
150
164
  execSync('npm run build:bloby', {
151
165
  cwd: BLOBY_HOME,
152
166
  stdio: 'ignore',
167
+ env: NPM_ENV,
153
168
  });
154
169
  } catch {
155
170
  // Non-fatal: supervisor will build on first start
@@ -615,6 +615,9 @@ export async function startBlobyAgentQuery(
615
615
  const oauthToken = await getClaudeAccessToken();
616
616
  if (!oauthToken) {
617
617
  onMessage('bot:error', { conversationId, error: 'Claude OAuth token not found. Please authenticate via the dashboard.' });
618
+ // bot:done frees the caller's slot (WhatsApp activeAgents / scheduler) — this
619
+ // early return is the only path that skips the finally's guarantee below.
620
+ onMessage('bot:done', { conversationId, usedFileTools: false });
618
621
  return;
619
622
  }
620
623