@clwnt/clawnet 0.7.11 → 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.
- package/package.json +1 -1
- package/src/service.ts +15 -10
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.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)`);
|
|
@@ -207,11 +217,6 @@ export function createClawnetService(params: { api: any; cfg: ClawnetConfig }) {
|
|
|
207
217
|
// Always set delivery lock — even on error, rate-limit retries
|
|
208
218
|
deliveryLock.set(accountId, new Date(Date.now() + DELIVERY_LOCK_TTL_MS));
|
|
209
219
|
accountBusy.delete(accountId);
|
|
210
|
-
// Flush any messages that accumulated while we were busy (overflow/requeue)
|
|
211
|
-
const remaining = pendingMessages.get(accountId);
|
|
212
|
-
if (remaining && remaining.length > 0) {
|
|
213
|
-
scheduleFlush(accountId, agentId);
|
|
214
|
-
}
|
|
215
220
|
}
|
|
216
221
|
}
|
|
217
222
|
|
|
@@ -368,19 +373,19 @@ export function createClawnetService(params: { api: any; cfg: ClawnetConfig }) {
|
|
|
368
373
|
if (checkData.plugin_config) {
|
|
369
374
|
const pc = checkData.plugin_config;
|
|
370
375
|
let changed = false;
|
|
371
|
-
if (pc.poll_seconds !== cfg.pollEverySeconds) {
|
|
376
|
+
if (pc.poll_seconds !== undefined && pc.poll_seconds !== cfg.pollEverySeconds) {
|
|
372
377
|
cfg.pollEverySeconds = pc.poll_seconds;
|
|
373
378
|
changed = true;
|
|
374
379
|
}
|
|
375
|
-
if (pc.debounce_seconds !== cfg.debounceSeconds) {
|
|
380
|
+
if (pc.debounce_seconds !== undefined && pc.debounce_seconds !== cfg.debounceSeconds) {
|
|
376
381
|
cfg.debounceSeconds = pc.debounce_seconds;
|
|
377
382
|
changed = true;
|
|
378
383
|
}
|
|
379
|
-
if (pc.max_batch_size !== cfg.maxBatchSize) {
|
|
384
|
+
if (pc.max_batch_size !== undefined && pc.max_batch_size !== cfg.maxBatchSize) {
|
|
380
385
|
cfg.maxBatchSize = pc.max_batch_size;
|
|
381
386
|
changed = true;
|
|
382
387
|
}
|
|
383
|
-
if (pc.deliver_channel !== cfg.deliver.channel) {
|
|
388
|
+
if (pc.deliver_channel !== undefined && pc.deliver_channel !== cfg.deliver.channel) {
|
|
384
389
|
cfg.deliver.channel = pc.deliver_channel;
|
|
385
390
|
changed = true;
|
|
386
391
|
}
|