@clwnt/clawnet 0.7.10 → 0.7.12
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 +1 -1
- package/src/service.ts +16 -7
package/package.json
CHANGED
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.
|
|
76
|
+
export const PLUGIN_VERSION = "0.7.12"; // 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 ?? {};
|
|
@@ -145,7 +145,9 @@ export function createClawnetService(params: { api: any; cfg: ClawnetConfig }) {
|
|
|
145
145
|
if (accountBusy.has(accountId)) {
|
|
146
146
|
api.logger.info(`[clawnet] ${accountId}: LLM run in progress, requeueing ${messages.length} message(s)`);
|
|
147
147
|
const existing = pendingMessages.get(accountId) ?? [];
|
|
148
|
-
|
|
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]);
|
|
149
151
|
return;
|
|
150
152
|
}
|
|
151
153
|
|
|
@@ -163,7 +165,6 @@ export function createClawnetService(params: { api: any; cfg: ClawnetConfig }) {
|
|
|
163
165
|
|
|
164
166
|
state.counters.batchesSent++;
|
|
165
167
|
state.counters.delivered += messages.length;
|
|
166
|
-
deliveryLock.set(accountId, new Date(Date.now() + DELIVERY_LOCK_TTL_MS));
|
|
167
168
|
api.logger.info(
|
|
168
169
|
`[clawnet] ${accountId}: delivered ${messages.length} message(s) to ${agentId} via ${freshCfg.deliveryMethod}`,
|
|
169
170
|
);
|
|
@@ -203,6 +204,8 @@ export function createClawnetService(params: { api: any; cfg: ClawnetConfig }) {
|
|
|
203
204
|
state.counters.errors++;
|
|
204
205
|
api.logger.error(`[clawnet] ${accountId}: batch delivery failed: ${err.message}`);
|
|
205
206
|
} finally {
|
|
207
|
+
// Always set delivery lock — even on error, rate-limit retries
|
|
208
|
+
deliveryLock.set(accountId, new Date(Date.now() + DELIVERY_LOCK_TTL_MS));
|
|
206
209
|
accountBusy.delete(accountId);
|
|
207
210
|
}
|
|
208
211
|
}
|
|
@@ -436,9 +439,11 @@ export function createClawnetService(params: { api: any; cfg: ClawnetConfig }) {
|
|
|
436
439
|
|
|
437
440
|
state.counters.messagesSeen += normalized.length;
|
|
438
441
|
|
|
439
|
-
// Add to pending and schedule debounced flush
|
|
442
|
+
// Add to pending (dedup by ID) and schedule debounced flush
|
|
440
443
|
const existing = pendingMessages.get(account.id) ?? [];
|
|
441
|
-
|
|
444
|
+
const existingIds = new Set(existing.map((m) => m.id));
|
|
445
|
+
const fresh = normalized.filter((m) => !existingIds.has(m.id));
|
|
446
|
+
pendingMessages.set(account.id, [...existing, ...fresh]);
|
|
442
447
|
scheduleFlush(account.id, account.agentId);
|
|
443
448
|
|
|
444
449
|
return { a2aDmCount, sentTaskUpdates, notifyCount };
|
|
@@ -501,7 +506,9 @@ export function createClawnetService(params: { api: any; cfg: ClawnetConfig }) {
|
|
|
501
506
|
|
|
502
507
|
state.counters.messagesSeen += messages.length;
|
|
503
508
|
const existing = pendingMessages.get(account.id) ?? [];
|
|
504
|
-
|
|
509
|
+
const existingIds = new Set(existing.map((m) => m.id));
|
|
510
|
+
const freshTasks = messages.filter((m) => !existingIds.has(m.id));
|
|
511
|
+
pendingMessages.set(account.id, [...existing, ...freshTasks]);
|
|
505
512
|
scheduleFlush(account.id, account.agentId);
|
|
506
513
|
}
|
|
507
514
|
|
|
@@ -554,7 +561,9 @@ export function createClawnetService(params: { api: any; cfg: ClawnetConfig }) {
|
|
|
554
561
|
|
|
555
562
|
state.counters.messagesSeen += messages.length;
|
|
556
563
|
const existing = pendingMessages.get(account.id) ?? [];
|
|
557
|
-
|
|
564
|
+
const existingIds = new Set(existing.map((m) => m.id));
|
|
565
|
+
const freshUpdates = messages.filter((m) => !existingIds.has(m.id));
|
|
566
|
+
pendingMessages.set(account.id, [...existing, ...freshUpdates]);
|
|
558
567
|
scheduleFlush(account.id, account.agentId);
|
|
559
568
|
}
|
|
560
569
|
|