nextclaw 0.6.9 → 0.6.10

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.
Files changed (2) hide show
  1. package/dist/cli/index.js +50 -11
  2. package/package.json +2 -2
package/dist/cli/index.js CHANGED
@@ -2481,7 +2481,7 @@ var ServiceCommands = class {
2481
2481
  }
2482
2482
  }
2483
2483
  await reloader.getChannels().startAll();
2484
- await this.wakeFromRestartSentinel({ bus, sessionManager });
2484
+ await this.wakeFromRestartSentinel({ channels: reloader.getChannels(), sessionManager });
2485
2485
  await agent.run();
2486
2486
  } finally {
2487
2487
  await stopPluginChannelGateways(pluginGatewayHandles);
@@ -2495,6 +2495,46 @@ var ServiceCommands = class {
2495
2495
  const trimmed = value.trim();
2496
2496
  return trimmed || void 0;
2497
2497
  }
2498
+ async sleep(ms) {
2499
+ await new Promise((resolve10) => setTimeout(resolve10, ms));
2500
+ }
2501
+ async sendRestartSentinelNotice(params) {
2502
+ const outboundBase = {
2503
+ channel: params.channel,
2504
+ chatId: params.chatId,
2505
+ content: params.content,
2506
+ media: [],
2507
+ metadata: params.metadata
2508
+ };
2509
+ const variants = params.replyTo ? [
2510
+ { ...outboundBase, replyTo: params.replyTo },
2511
+ { ...outboundBase }
2512
+ ] : [{ ...outboundBase }];
2513
+ for (let variantIndex = 0; variantIndex < variants.length; variantIndex += 1) {
2514
+ const outbound = variants[variantIndex];
2515
+ const isLastVariant = variantIndex === variants.length - 1;
2516
+ for (let attempt = 1; attempt <= 3; attempt += 1) {
2517
+ try {
2518
+ const delivered = await params.channels.deliver(outbound);
2519
+ if (delivered) {
2520
+ return true;
2521
+ }
2522
+ return false;
2523
+ } catch (error) {
2524
+ if (attempt < 3) {
2525
+ await this.sleep(attempt * 500);
2526
+ continue;
2527
+ }
2528
+ if (isLastVariant) {
2529
+ console.warn(
2530
+ `Warning: restart sentinel notify failed for ${params.channel}:${params.chatId} (attempt ${attempt}): ${String(error)}`
2531
+ );
2532
+ }
2533
+ }
2534
+ }
2535
+ }
2536
+ return false;
2537
+ }
2498
2538
  async wakeFromRestartSentinel(params) {
2499
2539
  const sentinel = await consumeRestartSentinel();
2500
2540
  if (!sentinel) {
@@ -2519,16 +2559,15 @@ var ServiceCommands = class {
2519
2559
  enqueuePendingSystemEvent(params.sessionManager, sessionKey, message);
2520
2560
  return;
2521
2561
  }
2522
- try {
2523
- await params.bus.publishOutbound({
2524
- channel,
2525
- chatId,
2526
- content: message,
2527
- ...replyTo ? { replyTo } : {},
2528
- media: [],
2529
- metadata
2530
- });
2531
- } catch {
2562
+ const delivered = await this.sendRestartSentinelNotice({
2563
+ channels: params.channels,
2564
+ channel,
2565
+ chatId,
2566
+ content: message,
2567
+ ...replyTo ? { replyTo } : {},
2568
+ metadata
2569
+ });
2570
+ if (!delivered) {
2532
2571
  enqueuePendingSystemEvent(params.sessionManager, sessionKey, message);
2533
2572
  }
2534
2573
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextclaw",
3
- "version": "0.6.9",
3
+ "version": "0.6.10",
4
4
  "description": "Lightweight personal AI assistant with CLI, multi-provider routing, and channel integrations.",
5
5
  "private": false,
6
6
  "type": "module",
@@ -38,7 +38,7 @@
38
38
  "dependencies": {
39
39
  "chokidar": "^3.6.0",
40
40
  "commander": "^12.1.0",
41
- "@nextclaw/core": "^0.6.8",
41
+ "@nextclaw/core": "^0.6.9",
42
42
  "@nextclaw/server": "^0.4.2",
43
43
  "@nextclaw/openclaw-compat": "^0.1.5"
44
44
  },