@clwnt/clawnet 0.5.0 → 0.5.1
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 +13 -4
package/package.json
CHANGED
package/src/service.ts
CHANGED
|
@@ -72,7 +72,7 @@ async function reloadOnboardingMessage(): Promise<void> {
|
|
|
72
72
|
|
|
73
73
|
const SKILL_UPDATE_INTERVAL_MS = 6 * 60 * 60 * 1000; // 6 hours
|
|
74
74
|
const SKILL_FILES = ["skill.json", "api-reference.md", "inbox-handler.md", "capabilities.json", "hook-template.txt", "tool-descriptions.json", "onboarding-message.txt"];
|
|
75
|
-
const PLUGIN_VERSION = "0.5.
|
|
75
|
+
const PLUGIN_VERSION = "0.5.1"; // Reported to server via PATCH /me every 6h
|
|
76
76
|
|
|
77
77
|
// --- Service ---
|
|
78
78
|
|
|
@@ -339,15 +339,24 @@ export function createClawnetService(params: { api: any; cfg: ClawnetConfig }) {
|
|
|
339
339
|
if (!inboxRes.ok) {
|
|
340
340
|
throw new Error(`/inbox returned ${inboxRes.status}`);
|
|
341
341
|
}
|
|
342
|
-
const inboxData = (await inboxRes.json()) as { messages:
|
|
342
|
+
const inboxData = (await inboxRes.json()) as { messages: Array<Record<string, any>> };
|
|
343
343
|
|
|
344
344
|
if (inboxData.messages.length === 0) return;
|
|
345
345
|
|
|
346
|
-
|
|
346
|
+
// Normalize API field names: API returns "from", plugin uses "from_agent"
|
|
347
|
+
const normalized: InboxMessage[] = inboxData.messages.map((m) => ({
|
|
348
|
+
id: m.id,
|
|
349
|
+
from_agent: m.from_agent ?? m.from ?? "",
|
|
350
|
+
content: m.content,
|
|
351
|
+
subject: m.subject,
|
|
352
|
+
created_at: m.created_at,
|
|
353
|
+
}));
|
|
354
|
+
|
|
355
|
+
state.counters.messagesSeen += normalized.length;
|
|
347
356
|
|
|
348
357
|
// Add to pending and schedule debounced flush
|
|
349
358
|
const existing = pendingMessages.get(account.id) ?? [];
|
|
350
|
-
pendingMessages.set(account.id, [...existing, ...
|
|
359
|
+
pendingMessages.set(account.id, [...existing, ...normalized]);
|
|
351
360
|
scheduleFlush(account.id, account.agentId);
|
|
352
361
|
}
|
|
353
362
|
|