@sendinel/mcp-server 1.0.97 → 1.0.98
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/campaigns.js +10 -5
- package/package.json +1 -1
package/build/tools/campaigns.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CAMPAIGN_BRANCH_CONDITIONS, campaignBranchConditionValue, isContactPropertyConditionList, STEP_PROPERTY_CONDITIONS_ERROR, validateStepPropertyRules } from "@sendinel/domain";
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import Anthropic from '@anthropic-ai/sdk';
|
|
4
|
-
import { assertSendAccepted, SendRefusedError, BLOCKING_CONTENT_ISSUE_KINDS, computeSendContentKey, findContentIssues, sendingHostOf, NAME_FALLBACKS, ONE_SEND_MATCH_STATUSES, ONE_SEND_SENT_STATUSES, ONE_SEND_WINDOW_DAYS, normalizeTriggerConfig, renderTemplateString as renderTemplateVars, resolveBrandTokens, brandWarnings, readAllRows, } from '@sendinel/domain';
|
|
4
|
+
import { assertSendAccepted, providerSendError, sendError, SendRefusedError, BLOCKING_CONTENT_ISSUE_KINDS, computeSendContentKey, findContentIssues, sendingHostOf, NAME_FALLBACKS, ONE_SEND_MATCH_STATUSES, ONE_SEND_SENT_STATUSES, ONE_SEND_WINDOW_DAYS, normalizeTriggerConfig, renderTemplateString as renderTemplateVars, resolveBrandTokens, brandWarnings, readAllRows, } from '@sendinel/domain';
|
|
5
5
|
// Subpath import, not the barrel above -- reply-actions.ts uses node:crypto,
|
|
6
6
|
// and MCP-server-side that's fine (this never runs in an Edge Function), but
|
|
7
7
|
// keeping it off the shared barrel avoids re-creating the Edge-Function
|
|
@@ -2331,7 +2331,7 @@ Do not include body_html in your response; Sendinel renders body_html from block
|
|
|
2331
2331
|
.limit(1)
|
|
2332
2332
|
.maybeSingle();
|
|
2333
2333
|
if (suppression)
|
|
2334
|
-
return txt(
|
|
2334
|
+
return { ...txt('Error: Recipient is suppressed'), code: 'invalid_recipient' };
|
|
2335
2335
|
// Idempotency check
|
|
2336
2336
|
if (idempotency_key) {
|
|
2337
2337
|
const { data: existing } = await db()
|
|
@@ -2369,8 +2369,10 @@ Do not include body_html in your response; Sendinel renders body_html from block
|
|
|
2369
2369
|
.eq('id', template_id)
|
|
2370
2370
|
.eq('project_id', projectId)
|
|
2371
2371
|
.maybeSingle();
|
|
2372
|
-
if (templateError)
|
|
2373
|
-
|
|
2372
|
+
if (templateError) {
|
|
2373
|
+
console.error('MCP send template lookup failed:', templateError);
|
|
2374
|
+
return { ...txt('Error: Internal server error'), ...sendError('internal_error') };
|
|
2375
|
+
}
|
|
2374
2376
|
if (!template)
|
|
2375
2377
|
return txt('Error: Template not found');
|
|
2376
2378
|
const { data: project } = await adminDb().from('projects').select('brand_settings').eq('id', projectId).maybeSingle();
|
|
@@ -2425,10 +2427,13 @@ Do not include body_html in your response; Sendinel renders body_html from block
|
|
|
2425
2427
|
assertSendAccepted(sendResult);
|
|
2426
2428
|
}
|
|
2427
2429
|
catch (error) {
|
|
2430
|
+
console.error('MCP transactional send failed:', error);
|
|
2428
2431
|
if (error instanceof SendRefusedError) {
|
|
2429
2432
|
await db().from('email_log').insert({ project_id: projectId, site_id, to_email: to, from_email: site.from_email, subject: resolvedSubject, category: 'transactional', status: 'failed', error_message: error.message });
|
|
2430
2433
|
}
|
|
2431
|
-
|
|
2434
|
+
const safe = providerSendError(error);
|
|
2435
|
+
const code = error instanceof SendRefusedError ? error.refusal.code : safe.code;
|
|
2436
|
+
return { ...txt(`Error: Send failed — ${safe.error} (${code})`), error: safe.error, code };
|
|
2432
2437
|
}
|
|
2433
2438
|
// Log to email_log
|
|
2434
2439
|
const { data: logRow } = await db().from('email_log').insert({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sendinel/mcp-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.98",
|
|
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",
|