@sendinel/mcp-server 1.0.195 → 1.0.196
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/build/tools/warmup.js +21 -0
- package/package.json +1 -1
package/build/tools/warmup.js
CHANGED
|
@@ -2,6 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import { db } from '../db.js';
|
|
3
3
|
import { getProjectId } from '../project.js';
|
|
4
4
|
import { dbToolError } from '../lib/db-error.js';
|
|
5
|
+
import { filterSentRows } from '@sendinel/domain';
|
|
5
6
|
const j = (data) => ({ content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] });
|
|
6
7
|
export function registerWarmupTools(server) {
|
|
7
8
|
server.registerTool('get_warmup_status', {
|
|
@@ -25,6 +26,23 @@ export function registerWarmupTools(server) {
|
|
|
25
26
|
if (error)
|
|
26
27
|
return j(dbToolError(error));
|
|
27
28
|
const day = data?.warmup_day ?? 0;
|
|
29
|
+
// Pacing is "advance only after sends" (#4437): an idle site holds its day, so report
|
|
30
|
+
// when it last sent. Absence is not a value: no health row means nothing to report.
|
|
31
|
+
let lastSendDate = null;
|
|
32
|
+
if (data) {
|
|
33
|
+
const sendsQuery = db().from('email_log')
|
|
34
|
+
.select('sent_at')
|
|
35
|
+
.eq('project_id', getProjectId())
|
|
36
|
+
.eq('site_id', site_id)
|
|
37
|
+
.order('sent_at', { ascending: false });
|
|
38
|
+
const { data: lastSend, error: sendError } = await filterSentRows(sendsQuery)
|
|
39
|
+
.limit(1)
|
|
40
|
+
.maybeSingle();
|
|
41
|
+
if (sendError)
|
|
42
|
+
return j(dbToolError(sendError));
|
|
43
|
+
lastSendDate = lastSend?.sent_at ? String(lastSend.sent_at).slice(0, 10) : null;
|
|
44
|
+
}
|
|
45
|
+
const yesterday = new Date(Date.now() - 86400000).toISOString().slice(0, 10);
|
|
28
46
|
return j({
|
|
29
47
|
phase: day >= 42 ? 'complete' : day > 0 ? 'warming' : 'not_started',
|
|
30
48
|
daily_limit: data?.warmup_daily_limit ?? null,
|
|
@@ -32,6 +50,9 @@ export function registerWarmupTools(server) {
|
|
|
32
50
|
started_at: data?.check_date ?? null,
|
|
33
51
|
progress_pct: Math.min(100, Math.round((day / 42) * 100)),
|
|
34
52
|
next_milestone: day >= 42 ? null : `Day ${Math.min(42, day + 1)}`,
|
|
53
|
+
// Additive. started_at is the latest health row date, not a start date; kept for compatibility.
|
|
54
|
+
last_send_date: lastSendDate,
|
|
55
|
+
idle: data ? lastSendDate === null || lastSendDate < yesterday : false,
|
|
35
56
|
});
|
|
36
57
|
});
|
|
37
58
|
server.registerTool('update_warmup_schedule', {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sendinel/mcp-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.196",
|
|
4
4
|
"description": "AI-controlled email operations control plane for campaigns, contacts, segments, analytics, and multi-provider sending via MCP.",
|
|
5
5
|
"mcpName": "ai.sendinel/mcp-server",
|
|
6
6
|
"type": "module",
|