@clwnt/clawnet 0.7.14 → 0.7.15
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 +5 -49
- package/src/tools.ts +2 -2
package/package.json
CHANGED
package/src/service.ts
CHANGED
|
@@ -429,8 +429,8 @@ export function createClawnetService(params: { api: any; cfg: ClawnetConfig }) {
|
|
|
429
429
|
state.lastInboxNonEmptyAt = new Date();
|
|
430
430
|
api.logger.info(`[clawnet] ${account.id}: ${checkData.count} message(s) waiting (${notifyCount} to notify)`);
|
|
431
431
|
|
|
432
|
-
// Fetch
|
|
433
|
-
const inboxRes = await fetch(`${cfg.baseUrl}/inbox
|
|
432
|
+
// Fetch messages for delivery (mark-notified handled server-side in /inbox/check)
|
|
433
|
+
const inboxRes = await fetch(`${cfg.baseUrl}/inbox`, { headers });
|
|
434
434
|
if (!inboxRes.ok) {
|
|
435
435
|
throw new Error(`/inbox returned ${inboxRes.status}`);
|
|
436
436
|
}
|
|
@@ -450,21 +450,7 @@ export function createClawnetService(params: { api: any; cfg: ClawnetConfig }) {
|
|
|
450
450
|
|
|
451
451
|
state.counters.messagesSeen += normalized.length;
|
|
452
452
|
|
|
453
|
-
//
|
|
454
|
-
// at maxBatchSize, but the nag timer should reset for every message the agent
|
|
455
|
-
// is being alerted about, not just the ones in the batch.
|
|
456
|
-
const allEmailIds = normalized.map((m) => m.id);
|
|
457
|
-
if (allEmailIds.length > 0) {
|
|
458
|
-
try {
|
|
459
|
-
await fetch(`${cfg.baseUrl}/inbox/mark-notified`, {
|
|
460
|
-
method: "POST",
|
|
461
|
-
headers,
|
|
462
|
-
body: JSON.stringify({ message_ids: allEmailIds }),
|
|
463
|
-
});
|
|
464
|
-
} catch {
|
|
465
|
-
// Non-fatal — deliverBatch will still mark its batch after delivery
|
|
466
|
-
}
|
|
467
|
-
}
|
|
453
|
+
// Server-side /inbox/check auto-marks all notifiable items — no separate call needed
|
|
468
454
|
|
|
469
455
|
// Add to pending (dedup by ID) and schedule debounced flush
|
|
470
456
|
const existing = pendingMessages.get(account.id) ?? [];
|
|
@@ -533,22 +519,7 @@ export function createClawnetService(params: { api: any; cfg: ClawnetConfig }) {
|
|
|
533
519
|
|
|
534
520
|
state.counters.messagesSeen += messages.length;
|
|
535
521
|
|
|
536
|
-
//
|
|
537
|
-
const allTaskIds = messages.map((m) => m.id);
|
|
538
|
-
if (allTaskIds.length > 0) {
|
|
539
|
-
try {
|
|
540
|
-
await fetch(`${cfg.baseUrl}/inbox/mark-notified`, {
|
|
541
|
-
method: "POST",
|
|
542
|
-
headers: {
|
|
543
|
-
Authorization: `Bearer ${resolvedToken}`,
|
|
544
|
-
"Content-Type": "application/json",
|
|
545
|
-
},
|
|
546
|
-
body: JSON.stringify({ task_ids: allTaskIds }),
|
|
547
|
-
});
|
|
548
|
-
} catch {
|
|
549
|
-
// Non-fatal
|
|
550
|
-
}
|
|
551
|
-
}
|
|
522
|
+
// Server-side /inbox/check auto-marks all notifiable items — no separate call needed
|
|
552
523
|
|
|
553
524
|
const existing = pendingMessages.get(account.id) ?? [];
|
|
554
525
|
const existingIds = new Set(existing.map((m) => m.id));
|
|
@@ -606,22 +577,7 @@ export function createClawnetService(params: { api: any; cfg: ClawnetConfig }) {
|
|
|
606
577
|
|
|
607
578
|
state.counters.messagesSeen += messages.length;
|
|
608
579
|
|
|
609
|
-
//
|
|
610
|
-
const allSentTaskIds = messages.map((m) => m.id);
|
|
611
|
-
if (allSentTaskIds.length > 0) {
|
|
612
|
-
try {
|
|
613
|
-
await fetch(`${cfg.baseUrl}/inbox/mark-notified`, {
|
|
614
|
-
method: "POST",
|
|
615
|
-
headers: {
|
|
616
|
-
Authorization: `Bearer ${resolvedToken}`,
|
|
617
|
-
"Content-Type": "application/json",
|
|
618
|
-
},
|
|
619
|
-
body: JSON.stringify({ task_ids: allSentTaskIds }),
|
|
620
|
-
});
|
|
621
|
-
} catch {
|
|
622
|
-
// Non-fatal
|
|
623
|
-
}
|
|
624
|
-
}
|
|
580
|
+
// Server-side /inbox/check auto-marks all notifiable items — no separate call needed
|
|
625
581
|
|
|
626
582
|
const existing = pendingMessages.get(account.id) ?? [];
|
|
627
583
|
const existingIds = new Set(existing.map((m) => m.id));
|
package/src/tools.ts
CHANGED
|
@@ -454,7 +454,7 @@ export function registerTools(api: any) {
|
|
|
454
454
|
type: "object",
|
|
455
455
|
properties: {
|
|
456
456
|
message_id: { type: "string", description: "The message ID (e.g. msg_abc123)" },
|
|
457
|
-
status: { type: "string", enum: ["archived", "read", "snoozed", "
|
|
457
|
+
status: { type: "string", enum: ["archived", "read", "snoozed", "handled", "waiting"], description: "New status (use 'archived' or 'read'; 'handled'/'waiting' accepted for backward compat)" },
|
|
458
458
|
snoozed_until: { type: "string", description: "ISO 8601 timestamp (required when status is 'snoozed')" },
|
|
459
459
|
},
|
|
460
460
|
required: ["message_id", "status"],
|
|
@@ -475,7 +475,7 @@ export function registerTools(api: any) {
|
|
|
475
475
|
type: "object",
|
|
476
476
|
properties: {
|
|
477
477
|
message_ids: { type: "array", items: { type: "string" }, description: "Array of message IDs (e.g. ['msg_abc123', 'msg_def456'])" },
|
|
478
|
-
status: { type: "string", enum: ["archived", "read", "snoozed"
|
|
478
|
+
status: { type: "string", enum: ["archived", "read", "snoozed"], description: "New status to apply to all messages" },
|
|
479
479
|
},
|
|
480
480
|
required: ["message_ids", "status"],
|
|
481
481
|
},
|