@sendinel/mcp-server 1.0.88 → 1.0.90
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { FALLBACK_MODEL_IDS, MODEL_REGISTRY, ROLE, getAnthropicFastModelId, getAnthropicFrontierModelId, getAnthropicModelId, getAnthropicReasoningModelId, getModelIdForRole, resolveModel, type ModelMetadata, type ModelRole, type ResolvedModel, } from '@desler/models';
|
|
1
|
+
export { FALLBACK_MODEL_IDS, HAIKU_4_5_MODEL_ID, MODEL_REGISTRY, ROLE, getAnthropicFastModelId, getAnthropicHaiku45ModelId, getAnthropicFrontierModelId, getAnthropicModelId, getAnthropicReasoningModelId, getModelIdForRole, resolveModel, parseModelJson, type ModelMetadata, type ModelRole, type ResolvedModel, } from '@desler/models';
|
|
2
2
|
import { type ModelRole, type ResolvedModel } from '@desler/models';
|
|
3
3
|
export declare const DEFAULT_ANTHROPIC_MODEL_ID: string;
|
|
4
4
|
export declare const DEFAULT_ANTHROPIC_FAST_MODEL_ID: string;
|
package/build/anthropic-model.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { FALLBACK_MODEL_IDS, MODEL_REGISTRY, ROLE, getAnthropicFastModelId, getAnthropicFrontierModelId, getAnthropicModelId, getAnthropicReasoningModelId, getModelIdForRole, resolveModel, } from '@desler/models';
|
|
1
|
+
export { FALLBACK_MODEL_IDS, HAIKU_4_5_MODEL_ID, MODEL_REGISTRY, ROLE, getAnthropicFastModelId, getAnthropicHaiku45ModelId, getAnthropicFrontierModelId, getAnthropicModelId, getAnthropicReasoningModelId, getModelIdForRole, resolveModel, parseModelJson, } from '@desler/models';
|
|
2
2
|
import { MODEL_REGISTRY, resolveModel } from '@desler/models';
|
|
3
3
|
import { adminDb } from './db.js';
|
|
4
4
|
export const DEFAULT_ANTHROPIC_MODEL_ID = MODEL_REGISTRY.default.id;
|
package/build/tools/compound.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { anthropicRequiredText } from '@sendinel/domain';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import Anthropic from '@anthropic-ai/sdk';
|
|
4
4
|
import { adminDb, db } from '../db.js';
|
|
5
5
|
import { getProjectId } from '../project.js';
|
|
6
6
|
import { buildVoicePrompt, deriveTemplateVariables } from '../lib/voice.js';
|
|
7
|
-
import { getAnthropicFastModelId } from '../anthropic-model.js';
|
|
7
|
+
import { parseModelJson, getAnthropicFastModelId } from '../anthropic-model.js';
|
|
8
8
|
import { BLOCK_GENERATION_SCHEMA, blocksToHtml, blocksToText, normalizeComposerBlocks } from '../lib/composer-blocks.js';
|
|
9
|
+
// Haiku 5.5 (fast role) thinks before answering; thinking counts toward max_tokens (#4193).
|
|
10
|
+
const FAST_MIN_MAX_TOKENS = 8000;
|
|
9
11
|
const j = (data) => ({ content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] });
|
|
10
12
|
const HEX6 = /^#[0-9A-Fa-f]{6}$/;
|
|
11
13
|
function stringArray(value) {
|
|
@@ -32,16 +34,10 @@ function getAnthropicClient() {
|
|
|
32
34
|
return new Anthropic({ apiKey });
|
|
33
35
|
}
|
|
34
36
|
function extractJsonArray(raw) {
|
|
35
|
-
|
|
36
|
-
if (!match)
|
|
37
|
-
throw new Error('No JSON array in response');
|
|
38
|
-
return JSON.parse(match[0]);
|
|
37
|
+
return parseModelJson(raw, { kind: 'array' });
|
|
39
38
|
}
|
|
40
39
|
function extractJsonObject(raw) {
|
|
41
|
-
|
|
42
|
-
if (!match)
|
|
43
|
-
throw new Error('No JSON object in response');
|
|
44
|
-
return JSON.parse(match[0]);
|
|
40
|
+
return parseModelJson(raw, { kind: 'object' });
|
|
45
41
|
}
|
|
46
42
|
export function registerCompoundTools(server) {
|
|
47
43
|
server.registerTool('setup_campaign_from_brief', {
|
|
@@ -77,7 +73,7 @@ export function registerCompoundTools(server) {
|
|
|
77
73
|
try {
|
|
78
74
|
const msg = await getAnthropicClient().messages.create({
|
|
79
75
|
model: getAnthropicFastModelId(),
|
|
80
|
-
max_tokens:
|
|
76
|
+
max_tokens: FAST_MIN_MAX_TOKENS,
|
|
81
77
|
messages: [{
|
|
82
78
|
role: 'user',
|
|
83
79
|
content: `You are writing a ${num_steps}-step email campaign for "${site?.name ?? 'our product'}".
|
|
@@ -100,8 +96,7 @@ Do not include body_html. Sendinel renders body_html from blocks.
|
|
|
100
96
|
Respond with a JSON array.`,
|
|
101
97
|
}],
|
|
102
98
|
});
|
|
103
|
-
|
|
104
|
-
const raw = anthropicResponseText(msg);
|
|
99
|
+
const raw = anthropicRequiredText(msg);
|
|
105
100
|
steps = extractJsonArray(raw).map((step, index) => {
|
|
106
101
|
const blocks = normalizeComposerBlocks(step.blocks, brandVisual.resolvedButtonColor);
|
|
107
102
|
return {
|
|
@@ -197,7 +192,7 @@ Respond with a JSON array.`,
|
|
|
197
192
|
try {
|
|
198
193
|
const msg = await getAnthropicClient().messages.create({
|
|
199
194
|
model: getAnthropicFastModelId(),
|
|
200
|
-
max_tokens:
|
|
195
|
+
max_tokens: FAST_MIN_MAX_TOKENS,
|
|
201
196
|
messages: [{
|
|
202
197
|
role: 'user',
|
|
203
198
|
content: `Write an email for "${site?.name ?? 'our product'}".
|
|
@@ -210,8 +205,7 @@ Do not include body_html. Sendinel renders body_html from blocks.
|
|
|
210
205
|
Respond with JSON: { "subject": "...", "blocks": [...], "body_text": "..." }`,
|
|
211
206
|
}],
|
|
212
207
|
});
|
|
213
|
-
|
|
214
|
-
const raw = anthropicResponseText(msg);
|
|
208
|
+
const raw = anthropicRequiredText(msg);
|
|
215
209
|
const parsed = extractJsonObject(raw);
|
|
216
210
|
const blocks = normalizeComposerBlocks(parsed.blocks, brandVisual.resolvedButtonColor);
|
|
217
211
|
if (!blocks.length)
|
|
@@ -296,7 +290,7 @@ Respond with JSON: { "subject": "...", "blocks": [...], "body_text": "..." }`,
|
|
|
296
290
|
};
|
|
297
291
|
const analysisMsg = await getAnthropicClient().messages.create({
|
|
298
292
|
model: getAnthropicFastModelId(),
|
|
299
|
-
max_tokens:
|
|
293
|
+
max_tokens: FAST_MIN_MAX_TOKENS,
|
|
300
294
|
messages: [{
|
|
301
295
|
role: 'user',
|
|
302
296
|
content: `You are a deliverability engineer. Diagnose this email delivery issue.
|
|
@@ -308,8 +302,7 @@ ${JSON.stringify(diagnosticData, null, 2)}
|
|
|
308
302
|
Identify the most likely root cause and give 3-5 concise actionable next steps.`,
|
|
309
303
|
}],
|
|
310
304
|
});
|
|
311
|
-
|
|
312
|
-
const analysis = anthropicResponseText(analysisMsg);
|
|
305
|
+
const analysis = anthropicRequiredText(analysisMsg);
|
|
313
306
|
return j({
|
|
314
307
|
diagnostic_data: diagnosticData,
|
|
315
308
|
analysis,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sendinel/mcp-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.90",
|
|
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",
|