owpenwork 0.1.3 → 0.1.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/dist/cli.js CHANGED
@@ -11,6 +11,7 @@ import { loginWhatsApp, unpairWhatsApp } from "./whatsapp.js";
11
11
  const program = new Command();
12
12
  program
13
13
  .name("owpenbot")
14
+ .version("0.1.5")
14
15
  .description("OpenCode WhatsApp + Telegram bridge")
15
16
  .argument("[path]")
16
17
  .option("--non-interactive", "Run setup defaults and exit", false)
@@ -289,4 +290,7 @@ program
289
290
  }
290
291
  console.log("If replies fail, ensure OpenCode server is running at OPENCODE_URL.");
291
292
  });
292
- await program.parseAsync(process.argv);
293
+ program.parseAsync(process.argv).catch((error) => {
294
+ console.error(error);
295
+ process.exitCode = 1;
296
+ });
package/dist/whatsapp.js CHANGED
@@ -50,6 +50,13 @@ export function createWhatsAppAdapter(config, logger, onMessage, opts = {}) {
50
50
  if (update.connection === "close") {
51
51
  const lastDisconnect = update.lastDisconnect;
52
52
  const statusCode = lastDisconnect?.error?.output?.statusCode;
53
+ if (statusCode === 515 && !stopped) {
54
+ log.warn("whatsapp stream error; restarting connection");
55
+ setTimeout(() => {
56
+ void connect();
57
+ }, 1000);
58
+ return;
59
+ }
53
60
  const shouldReconnect = statusCode !== DisconnectReason.loggedOut;
54
61
  if (shouldReconnect && !stopped) {
55
62
  log.warn("whatsapp connection closed, reconnecting");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "owpenwork",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "WhatsApp bridge for a running OpenCode server",
5
5
  "private": false,
6
6
  "type": "module",