beecork 1.4.2 → 1.4.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.
@@ -38,12 +38,21 @@ export class WhatsAppChannel {
38
38
  const { state, saveCreds } = await useMultiFileAuthState(sessionPath);
39
39
  this.sock = makeWASocket({
40
40
  auth: state,
41
- printQRInTerminal: true,
42
41
  });
43
42
  const sock = this.sock;
44
43
  sock.ev.on('creds.update', saveCreds);
45
- sock.ev.on('connection.update', (update) => {
46
- const { connection, lastDisconnect } = update;
44
+ sock.ev.on('connection.update', async (update) => {
45
+ const { connection, lastDisconnect, qr } = update;
46
+ if (qr) {
47
+ try {
48
+ const qrcodeTerminal = await import('qrcode-terminal');
49
+ (qrcodeTerminal.default || qrcodeTerminal).generate(qr, { small: true });
50
+ logger.info('WhatsApp QR code displayed — scan with your phone');
51
+ }
52
+ catch {
53
+ logger.warn('WhatsApp QR code available but could not render. Install qrcode-terminal.');
54
+ }
55
+ }
47
56
  if (connection === 'close') {
48
57
  const reason = lastDisconnect?.error?.output?.statusCode;
49
58
  if (reason !== DisconnectReason.loggedOut) {
@@ -235,18 +235,25 @@ export async function updateBeecork(options) {
235
235
  console.log('Stopping daemon before update...');
236
236
  await stopDaemon();
237
237
  }
238
- console.log('Updating beecork...');
238
+ console.log(`Updating beecork from v${VERSION}...`);
239
239
  try {
240
240
  execSync('npm install -g beecork@latest', { stdio: 'inherit' });
241
- console.log('Update complete!');
241
+ const newVersion = execSync('npm view beecork version', { encoding: 'utf-8' }).trim();
242
+ console.log(`Update complete! v${VERSION} → v${newVersion}`);
242
243
  }
243
244
  catch {
244
245
  console.error('Update failed. Try running: npm install -g beecork@latest');
245
246
  }
246
- // Restart if it was running
247
+ // Restart if it was running — spawn the NEW binary so the freshly installed
248
+ // code is used, not the stale in-memory code from before the update.
247
249
  if (pid) {
248
250
  console.log('Restarting daemon...');
249
- await startDaemon();
251
+ try {
252
+ execSync('beecork start', { stdio: 'inherit' });
253
+ }
254
+ catch {
255
+ console.error('Could not restart daemon. Run "beecork start" manually.');
256
+ }
250
257
  }
251
258
  }
252
259
  export async function sendMessage(message) {
package/dist/index.js CHANGED
@@ -199,10 +199,18 @@ program
199
199
  const { state, saveCreds } = await useMultiFileAuthState(sessionPath);
200
200
  const sock = makeWASocket({
201
201
  auth: state,
202
- printQRInTerminal: true,
203
202
  });
204
203
  sock.ev.on('creds.update', saveCreds);
205
- sock.ev.on('connection.update', (update) => {
204
+ sock.ev.on('connection.update', async (update) => {
205
+ if (update.qr) {
206
+ try {
207
+ const qrcodeTerminal = await import('qrcode-terminal');
208
+ (qrcodeTerminal.default || qrcodeTerminal).generate(update.qr, { small: true });
209
+ }
210
+ catch {
211
+ console.log('QR data:', update.qr);
212
+ }
213
+ }
206
214
  if (update.connection === 'open') {
207
215
  console.log('\n✓ WhatsApp paired successfully!');
208
216
  console.log(' You can now start the daemon: beecork start\n');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "beecork",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "Claude Code always-on infrastructure — a phone number, a memory, and an alarm clock",
5
5
  "type": "module",
6
6
  "bin": {
@@ -26,6 +26,7 @@
26
26
  "discord.js": "^14.26.2",
27
27
  "node-cron": "^4.2.1",
28
28
  "node-telegram-bot-api": "^0.67.0",
29
+ "qrcode-terminal": "^0.12.0",
29
30
  "uuid": "^13.0.0"
30
31
  },
31
32
  "devDependencies": {