@clwnt/clawnet 0.7.12 → 0.7.13

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/package.json +1 -1
  2. package/src/service.ts +15 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clwnt/clawnet",
3
- "version": "0.7.12",
3
+ "version": "0.7.13",
4
4
  "type": "module",
5
5
  "description": "ClawNet integration for OpenClaw — poll inbox, route messages to hooks",
6
6
  "files": [
package/src/service.ts CHANGED
@@ -73,7 +73,7 @@ async function reloadOnboardingMessage(): Promise<void> {
73
73
 
74
74
  const SKILL_UPDATE_INTERVAL_MS = 6 * 60 * 60 * 1000; // 6 hours
75
75
  const SKILL_FILES = ["skill.json", "api-reference.md", "inbox-handler.md", "capabilities.json", "hook-template.txt", "tool-descriptions.json", "onboarding-message.txt", "inbox-protocol.md"];
76
- export const PLUGIN_VERSION = "0.7.12"; // Reported to server via PATCH /me every 6h
76
+ export const PLUGIN_VERSION = "0.7.13"; // Reported to server via PATCH /me every 6h
77
77
 
78
78
  function loadFreshConfig(api: any): ClawnetConfig {
79
79
  const raw = api.runtime?.config?.loadConfig?.()?.plugins?.entries?.clawnet?.config ?? {};
@@ -141,6 +141,16 @@ export function createClawnetService(params: { api: any; cfg: ClawnetConfig }) {
141
141
  async function deliverBatch(accountId: string, agentId: string, messages: InboxMessage[]) {
142
142
  if (messages.length === 0) return;
143
143
 
144
+ // Delivery lock — respect the cooldown even from flush/debounce paths
145
+ const lockUntil = deliveryLock.get(accountId);
146
+ if (lockUntil && new Date() < lockUntil) {
147
+ const existing = pendingMessages.get(accountId) ?? [];
148
+ const existingIds = new Set(existing.map((m) => m.id));
149
+ const fresh = messages.filter((m) => !existingIds.has(m.id));
150
+ pendingMessages.set(accountId, [...existing, ...fresh]);
151
+ return;
152
+ }
153
+
144
154
  // Concurrency guard
145
155
  if (accountBusy.has(accountId)) {
146
156
  api.logger.info(`[clawnet] ${accountId}: LLM run in progress, requeueing ${messages.length} message(s)`);
@@ -363,19 +373,19 @@ export function createClawnetService(params: { api: any; cfg: ClawnetConfig }) {
363
373
  if (checkData.plugin_config) {
364
374
  const pc = checkData.plugin_config;
365
375
  let changed = false;
366
- if (pc.poll_seconds !== cfg.pollEverySeconds) {
376
+ if (pc.poll_seconds !== undefined && pc.poll_seconds !== cfg.pollEverySeconds) {
367
377
  cfg.pollEverySeconds = pc.poll_seconds;
368
378
  changed = true;
369
379
  }
370
- if (pc.debounce_seconds !== cfg.debounceSeconds) {
380
+ if (pc.debounce_seconds !== undefined && pc.debounce_seconds !== cfg.debounceSeconds) {
371
381
  cfg.debounceSeconds = pc.debounce_seconds;
372
382
  changed = true;
373
383
  }
374
- if (pc.max_batch_size !== cfg.maxBatchSize) {
384
+ if (pc.max_batch_size !== undefined && pc.max_batch_size !== cfg.maxBatchSize) {
375
385
  cfg.maxBatchSize = pc.max_batch_size;
376
386
  changed = true;
377
387
  }
378
- if (pc.deliver_channel !== cfg.deliver.channel) {
388
+ if (pc.deliver_channel !== undefined && pc.deliver_channel !== cfg.deliver.channel) {
379
389
  cfg.deliver.channel = pc.deliver_channel;
380
390
  changed = true;
381
391
  }