@migma/mcp 1.3.1 → 1.3.3
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/prompts/index.js +5 -5
- package/build/prompts/index.js.map +1 -1
- package/build/tools/__tests__/agent-payload.test.d.ts +2 -0
- package/build/tools/__tests__/agent-payload.test.d.ts.map +1 -0
- package/build/tools/__tests__/agent-payload.test.js +76 -0
- package/build/tools/__tests__/agent-payload.test.js.map +1 -0
- package/build/tools/__tests__/email-images.test.d.ts +2 -0
- package/build/tools/__tests__/email-images.test.d.ts.map +1 -0
- package/build/tools/__tests__/email-images.test.js +94 -0
- package/build/tools/__tests__/email-images.test.js.map +1 -0
- package/build/tools/agent-payload.d.ts +9 -0
- package/build/tools/agent-payload.d.ts.map +1 -0
- package/build/tools/agent-payload.js +146 -0
- package/build/tools/agent-payload.js.map +1 -0
- package/build/tools/capabilities.js +12 -12
- package/build/tools/capabilities.js.map +1 -1
- package/build/tools/email-images.d.ts +30 -0
- package/build/tools/email-images.d.ts.map +1 -0
- package/build/tools/email-images.js +165 -0
- package/build/tools/email-images.js.map +1 -0
- package/build/tools/export.d.ts.map +1 -1
- package/build/tools/export.js +7 -6
- package/build/tools/export.js.map +1 -1
- package/build/tools/generate.d.ts.map +1 -1
- package/build/tools/generate.js +45 -11
- package/build/tools/generate.js.map +1 -1
- package/build/tools/projects.d.ts.map +1 -1
- package/build/tools/projects.js +12 -13
- package/build/tools/projects.js.map +1 -1
- package/build/tools/validate.d.ts.map +1 -1
- package/build/tools/validate.js +63 -23
- package/build/tools/validate.js.map +1 -1
- package/package.json +1 -1
package/build/prompts/index.js
CHANGED
|
@@ -10,8 +10,8 @@ export const WORKFLOWS = [
|
|
|
10
10
|
steps: [
|
|
11
11
|
"migma_get_capabilities — see available tools and the idempotency contract.",
|
|
12
12
|
"migma_generate_email — start generation; keep conversationId.",
|
|
13
|
-
"migma_get_generation_status — poll until completed. Or migma_list_emails to see designs already in the project.",
|
|
14
|
-
"migma_send_test_email — send a test to yourself
|
|
13
|
+
"migma_get_generation_status — poll until completed, then show the preview images. Or migma_list_emails to see designs already in the project.",
|
|
14
|
+
"migma_send_test_email — send a test to yourself after reviewing the images.",
|
|
15
15
|
"migma_list_domains + migma_list_segments / migma_list_tags — pick the sender and audience.",
|
|
16
16
|
"migma_create_campaign — create a draft campaign from the generated email.",
|
|
17
17
|
"migma_send_campaign — send it (pass idempotency_key, e.g. campaign-send-<campaignId>, for safe retries).",
|
|
@@ -24,7 +24,7 @@ export const WORKFLOWS = [
|
|
|
24
24
|
steps: [
|
|
25
25
|
"migma_get_field_catalog — discover which subscriber fields exist and how often they're populated.",
|
|
26
26
|
"migma_create_segment — create a segment using those fields as filters.",
|
|
27
|
-
"migma_generate_email — start generation; poll migma_get_generation_status.",
|
|
27
|
+
"migma_generate_email — start generation; poll migma_get_generation_status and show the preview images.",
|
|
28
28
|
"migma_create_campaign — create a campaign targeting the new segment.",
|
|
29
29
|
"migma_send_campaign — send the campaign (use an idempotency_key for safe retries).",
|
|
30
30
|
"migma_get_campaign_stats — read the campaign results.",
|
|
@@ -36,8 +36,8 @@ export const WORKFLOWS = [
|
|
|
36
36
|
steps: [
|
|
37
37
|
"migma_import_brand — import the brand from one or more website URLs.",
|
|
38
38
|
"migma_get_project — confirm the extracted colors, fonts, logos, and tone.",
|
|
39
|
-
"migma_generate_email — start generation; poll migma_get_generation_status.",
|
|
40
|
-
"migma_send_test_email — send a test
|
|
39
|
+
"migma_generate_email — start generation; poll migma_get_generation_status and show the preview images.",
|
|
40
|
+
"migma_send_test_email — send a test after reviewing the images.",
|
|
41
41
|
],
|
|
42
42
|
},
|
|
43
43
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAe;IACnC;QACE,IAAI,EAAE,uBAAuB;QAC7B,OAA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AAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,MAAM,CAAC,cAAc,CACnB,QAAQ,CAAC,IAAI,EACb;YACE,KAAK,EAAE,QAAQ,CAAC,IAAI;iBACjB,KAAK,CAAC,GAAG,CAAC;iBACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;iBAClD,IAAI,CAAC,GAAG,CAAC;YACZ,WAAW,EAAE,QAAQ,CAAC,OAAO;SAC9B,EACD,GAAG,EAAE,CAAC,eAAe,CAAC,QAAQ,CAAC,CAChC,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-payload.test.d.ts","sourceRoot":"","sources":["../../../src/tools/__tests__/agent-payload.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import test from "node:test";
|
|
3
|
+
import { compactProjectList, conversationAppUrl, decorateEmailPayload, screenshotStatus, slimProject, stripExportInlineContent, } from "../agent-payload.js";
|
|
4
|
+
test("conversationAppUrl uses chat deep link", () => {
|
|
5
|
+
assert.equal(conversationAppUrl("abc"), "https://migma.ai/chat?c=abc");
|
|
6
|
+
assert.equal(conversationAppUrl("abc", 2), "https://migma.ai/chat?c=abc&slot=2");
|
|
7
|
+
});
|
|
8
|
+
test("screenshotStatus treats completed-without-url as pending", () => {
|
|
9
|
+
assert.equal(screenshotStatus("https://cdn.migma.ai/a.png"), "ready");
|
|
10
|
+
assert.equal(screenshotStatus(null, "completed"), "pending");
|
|
11
|
+
assert.equal(screenshotStatus(null, "failed"), "missing");
|
|
12
|
+
});
|
|
13
|
+
test("decorateEmailPayload strips html and adds appUrl", () => {
|
|
14
|
+
const decorated = decorateEmailPayload({
|
|
15
|
+
conversationId: "c1",
|
|
16
|
+
subject: "Hi",
|
|
17
|
+
html: "<table>huge</table>",
|
|
18
|
+
screenshotUrl: null,
|
|
19
|
+
status: "completed",
|
|
20
|
+
emails: [
|
|
21
|
+
{
|
|
22
|
+
conversationId: "c1",
|
|
23
|
+
slot: 1,
|
|
24
|
+
subject: "One",
|
|
25
|
+
html: "<p>x</p>",
|
|
26
|
+
screenshotUrl: "https://cdn.migma.ai/a.png",
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
});
|
|
30
|
+
assert.equal(decorated.html, undefined);
|
|
31
|
+
assert.equal(decorated.appUrl, "https://migma.ai/chat?c=c1");
|
|
32
|
+
assert.equal(decorated.screenshotStatus, "pending");
|
|
33
|
+
const emails = decorated.emails;
|
|
34
|
+
assert.equal(emails[0]?.html, undefined);
|
|
35
|
+
assert.equal(emails[0]?.appUrl, "https://migma.ai/chat?c=c1&slot=1");
|
|
36
|
+
assert.equal(emails[0]?.screenshotStatus, "ready");
|
|
37
|
+
const withHtml = decorateEmailPayload({ conversationId: "c1", html: "<p>keep</p>" }, { includeHtml: true });
|
|
38
|
+
assert.equal(withHtml.html, "<p>keep</p>");
|
|
39
|
+
});
|
|
40
|
+
test("slimProject drops knowledge base and leftover inventory", () => {
|
|
41
|
+
const slim = slimProject({
|
|
42
|
+
_id: "p1",
|
|
43
|
+
name: "Osmo",
|
|
44
|
+
colors: { brand: "#000" },
|
|
45
|
+
knowledgeBase: [{ title: "huge" }],
|
|
46
|
+
imageUrls: ["x"],
|
|
47
|
+
customCSS: "oklch()",
|
|
48
|
+
templateCount: 0,
|
|
49
|
+
emails: [],
|
|
50
|
+
});
|
|
51
|
+
assert.equal(slim.name, "Osmo");
|
|
52
|
+
assert.deepEqual(slim.colors, { brand: "#000" });
|
|
53
|
+
assert.equal(slim.knowledgeBase, undefined);
|
|
54
|
+
assert.equal(slim.templateCount, undefined);
|
|
55
|
+
});
|
|
56
|
+
test("compactProjectList searches and stays small", () => {
|
|
57
|
+
const compact = compactProjectList({
|
|
58
|
+
projects: [
|
|
59
|
+
{ _id: "1", name: "Osmo Studio", domain: "osmo.com", status: "active", updatedAt: "t", description: "long" },
|
|
60
|
+
{ _id: "2", name: "Other", domain: "x.com", status: "active", updatedAt: "t" },
|
|
61
|
+
],
|
|
62
|
+
pagination: { total: 2, limit: 20, offset: 0, hasMore: false },
|
|
63
|
+
}, "osmo");
|
|
64
|
+
assert.equal(compact.projects.length, 1);
|
|
65
|
+
assert.equal(compact.projects[0]?.id, "1");
|
|
66
|
+
assert.equal(compact.projects[0].description, undefined);
|
|
67
|
+
});
|
|
68
|
+
test("stripExportInlineContent keeps url only", () => {
|
|
69
|
+
const stripped = stripExportInlineContent({
|
|
70
|
+
exportType: "html",
|
|
71
|
+
files: [{ filename: "a.html", url: "https://cdn.migma.ai/a.html", content: "<html>huge</html>" }],
|
|
72
|
+
});
|
|
73
|
+
assert.equal(stripped.files[0]?.url, "https://cdn.migma.ai/a.html");
|
|
74
|
+
assert.equal(stripped.files[0]?.content, undefined);
|
|
75
|
+
});
|
|
76
|
+
//# sourceMappingURL=agent-payload.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-payload.test.js","sourceRoot":"","sources":["../../../src/tools/__tests__/agent-payload.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,WAAW,EACX,wBAAwB,GACzB,MAAM,qBAAqB,CAAC;AAE7B,IAAI,CAAC,wCAAwC,EAAE,GAAG,EAAE;IAClD,MAAM,CAAC,KAAK,CACV,kBAAkB,CAAC,KAAK,CAAC,EACzB,6BAA6B,CAC9B,CAAC;IACF,MAAM,CAAC,KAAK,CACV,kBAAkB,CAAC,KAAK,EAAE,CAAC,CAAC,EAC5B,oCAAoC,CACrC,CAAC;AACJ,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mappings":""}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import test from "node:test";
|
|
3
|
+
import { collectScreenshotRefs, fetchEmailImage, isAllowedScreenshotUrl, screenshotGuidance, toolResultWithImages, } from "../email-images.js";
|
|
4
|
+
test("allows only https Migma CDN and S3 screenshot hosts", () => {
|
|
5
|
+
assert.equal(isAllowedScreenshotUrl("https://cdn.migma.ai/shot.png"), true);
|
|
6
|
+
assert.equal(isAllowedScreenshotUrl("https://migmaa-sandbox.s3.amazonaws.com/shot.png"), true);
|
|
7
|
+
assert.equal(isAllowedScreenshotUrl("https://d111111abcdef8.cloudfront.net/shot.png"), true);
|
|
8
|
+
assert.equal(isAllowedScreenshotUrl("http://cdn.migma.ai/shot.png"), false);
|
|
9
|
+
assert.equal(isAllowedScreenshotUrl("https://evil.example/shot.png"), false);
|
|
10
|
+
assert.equal(isAllowedScreenshotUrl("https://127.0.0.1/shot.png"), false);
|
|
11
|
+
assert.equal(isAllowedScreenshotUrl("not-a-url"), false);
|
|
12
|
+
});
|
|
13
|
+
test("collects list thumbs and detail slot shots", () => {
|
|
14
|
+
const list = collectScreenshotRefs({
|
|
15
|
+
emails: [
|
|
16
|
+
{
|
|
17
|
+
title: "Welcome",
|
|
18
|
+
subject: "Hi",
|
|
19
|
+
screenshotUrl: "https://cdn.migma.ai/a.png",
|
|
20
|
+
},
|
|
21
|
+
{ title: "No shot", screenshotUrl: null },
|
|
22
|
+
{
|
|
23
|
+
title: "Blocked",
|
|
24
|
+
screenshotUrl: "https://evil.example/x.png",
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
}, "list");
|
|
28
|
+
assert.deepEqual(list, [
|
|
29
|
+
{ url: "https://cdn.migma.ai/a.png", label: "Hi" },
|
|
30
|
+
]);
|
|
31
|
+
const status = collectScreenshotRefs({
|
|
32
|
+
status: "completed",
|
|
33
|
+
result: {
|
|
34
|
+
emails: [
|
|
35
|
+
{
|
|
36
|
+
subject: "One",
|
|
37
|
+
slot: 1,
|
|
38
|
+
screenshotUrl: "https://cdn.migma.ai/one.png",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
subject: "Two",
|
|
42
|
+
slot: 2,
|
|
43
|
+
thumbnailUrl: "https://cdn.migma.ai/two.png",
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
}, "detail");
|
|
48
|
+
assert.equal(status.length, 2);
|
|
49
|
+
assert.equal(status[0]?.label, "One");
|
|
50
|
+
const one = collectScreenshotRefs({
|
|
51
|
+
subject: "Solo",
|
|
52
|
+
screenshotUrl: "https://cdn.migma.ai/solo.png",
|
|
53
|
+
}, "detail");
|
|
54
|
+
assert.deepEqual(one, [
|
|
55
|
+
{ url: "https://cdn.migma.ai/solo.png", label: "Solo" },
|
|
56
|
+
]);
|
|
57
|
+
});
|
|
58
|
+
test("guidance tells the agent to show images or poll", () => {
|
|
59
|
+
assert.match(screenshotGuidance([{ url: "https://cdn.migma.ai/a.png", label: "A" }], 1, {}), /Show these email preview images/);
|
|
60
|
+
assert.match(screenshotGuidance([], 0, { status: "completed" }), /still rendering/);
|
|
61
|
+
assert.equal(screenshotGuidance([], 0, { status: "pending" }), "");
|
|
62
|
+
assert.match(screenshotGuidance([], 0, { screenshotStatus: "pending" }), /still rendering/);
|
|
63
|
+
});
|
|
64
|
+
test("fetchEmailImage skips disallowed hosts and oversized bodies", async () => {
|
|
65
|
+
const blocked = await fetchEmailImage("https://evil.example/x.png");
|
|
66
|
+
assert.equal(blocked, null);
|
|
67
|
+
const png = Buffer.from([0x89, 0x50, 0x4e, 0x47]);
|
|
68
|
+
const image = await fetchEmailImage("https://cdn.migma.ai/a.png", async () => ({
|
|
69
|
+
ok: true,
|
|
70
|
+
headers: { get: () => "image/png" },
|
|
71
|
+
arrayBuffer: async () => png.buffer.slice(png.byteOffset, png.byteOffset + png.byteLength),
|
|
72
|
+
}));
|
|
73
|
+
assert.equal(image?.type, "image");
|
|
74
|
+
assert.equal(image?.mimeType, "image/png");
|
|
75
|
+
assert.equal(image?.data, png.toString("base64"));
|
|
76
|
+
});
|
|
77
|
+
test("toolResultWithImages puts image content before JSON", async () => {
|
|
78
|
+
const png = Buffer.from("img");
|
|
79
|
+
const result = await toolResultWithImages({
|
|
80
|
+
subject: "Hi",
|
|
81
|
+
screenshotUrl: "https://cdn.migma.ai/a.png",
|
|
82
|
+
}, "detail", async () => ({
|
|
83
|
+
ok: true,
|
|
84
|
+
headers: { get: () => "image/png" },
|
|
85
|
+
arrayBuffer: async () => png.buffer.slice(png.byteOffset, png.byteOffset + png.byteLength),
|
|
86
|
+
}));
|
|
87
|
+
assert.equal(result.content[0]?.type, "text");
|
|
88
|
+
assert.match(result.content[0].text, /Show these email preview images/);
|
|
89
|
+
assert.equal(result.content[1]?.type, "image");
|
|
90
|
+
const last = result.content[result.content.length - 1];
|
|
91
|
+
assert.equal(last?.type, "text");
|
|
92
|
+
assert.match(last.text, /"subject": "Hi"/);
|
|
93
|
+
});
|
|
94
|
+
//# sourceMappingURL=email-images.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-images.test.js","sourceRoot":"","sources":["../../../src/tools/__tests__/email-images.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAE5B,IAAI,CAAC,qDAAqD,EAAE,GAAG,EAAE;IAC/D,MAAM,CAAC,KAAK,CAAC,sBAAsB,CAAC,+BAA+B,CAAC,EAAE,IAAI,CAAC,CAAC;IAC5E,MAAM,CAAC,KAAK,CACV,sBAAsB,CAAC,kDAAkD,CAAC,EAC1E,IAAI,CACL,CAAC;IACF,MAAM,CAAC,KAAK,CACV,sBAAsB,CAAC,gDAAgD,CAAC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O,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAC9C,MAAM,CAAC,KAAK,CACT,MAAM,CAAC,OAAO,CAAC,CAAC,CAAsB,CAAC,IAAI,EAC5C,iCAAiC,CAClC,CAAC;IACF,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/C,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACvD,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IACjC,MAAM,CAAC,KAAK,CAAE,IAAyB,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;AACnE,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function conversationAppUrl(conversationId: string, slot?: number | null): string;
|
|
2
|
+
export declare function screenshotStatus(url: unknown, generationStatus?: string | null): "ready" | "pending" | "missing";
|
|
3
|
+
export declare function decorateEmailPayload(data: unknown, options?: {
|
|
4
|
+
includeHtml?: boolean;
|
|
5
|
+
}): unknown;
|
|
6
|
+
export declare function slimProject(data: unknown): unknown;
|
|
7
|
+
export declare function compactProjectList(data: unknown, search?: string): unknown;
|
|
8
|
+
export declare function stripExportInlineContent(data: unknown): unknown;
|
|
9
|
+
//# sourceMappingURL=agent-payload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-payload.d.ts","sourceRoot":"","sources":["../../src/tools/agent-payload.ts"],"names":[],"mappings":"AAeA,wBAAgB,kBAAkB,CAChC,cAAc,EAAE,MAAM,EACtB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,GACnB,MAAM,CAGR;AAED,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,OAAO,EACZ,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,GAC/B,OAAO,GAAG,SAAS,GAAG,SAAS,CAWjC;AA8CD,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,OAAO,EACb,OAAO,GAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAO,GACtC,OAAO,CA6BT;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAQlD;AAED,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,OAAO,EACb,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CA6BT;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAY/D"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
const APP_ORIGIN = "https://migma.ai";
|
|
2
|
+
const PROJECT_DROP = new Set([
|
|
3
|
+
"templateCount",
|
|
4
|
+
"templates",
|
|
5
|
+
"emails",
|
|
6
|
+
"knowledgeBase",
|
|
7
|
+
"imageUrls",
|
|
8
|
+
"customCSS",
|
|
9
|
+
"designSystem",
|
|
10
|
+
"importMetrics",
|
|
11
|
+
"authCredentials",
|
|
12
|
+
"mcpServers",
|
|
13
|
+
]);
|
|
14
|
+
export function conversationAppUrl(conversationId, slot) {
|
|
15
|
+
const url = `${APP_ORIGIN}/chat?c=${encodeURIComponent(conversationId)}`;
|
|
16
|
+
return slot == null ? url : `${url}&slot=${slot}`;
|
|
17
|
+
}
|
|
18
|
+
export function screenshotStatus(url, generationStatus) {
|
|
19
|
+
if (typeof url === "string" && url.trim())
|
|
20
|
+
return "ready";
|
|
21
|
+
if (generationStatus === "pending" ||
|
|
22
|
+
generationStatus === "processing" ||
|
|
23
|
+
generationStatus === "completed" ||
|
|
24
|
+
generationStatus === "ready") {
|
|
25
|
+
return "pending";
|
|
26
|
+
}
|
|
27
|
+
return "missing";
|
|
28
|
+
}
|
|
29
|
+
function asRecord(value) {
|
|
30
|
+
return value && typeof value === "object" && !Array.isArray(value)
|
|
31
|
+
? value
|
|
32
|
+
: null;
|
|
33
|
+
}
|
|
34
|
+
function cloneJson(value) {
|
|
35
|
+
return JSON.parse(JSON.stringify(value));
|
|
36
|
+
}
|
|
37
|
+
function decorateRecord(record, includeHtml, generationStatus) {
|
|
38
|
+
if (!includeHtml) {
|
|
39
|
+
delete record.html;
|
|
40
|
+
}
|
|
41
|
+
const conversationId = typeof record.conversationId === "string" ? record.conversationId : null;
|
|
42
|
+
if (conversationId) {
|
|
43
|
+
const slot = typeof record.slotIdx === "number"
|
|
44
|
+
? record.slotIdx
|
|
45
|
+
: typeof record.slot === "number"
|
|
46
|
+
? record.slot
|
|
47
|
+
: null;
|
|
48
|
+
record.appUrl = conversationAppUrl(conversationId, slot);
|
|
49
|
+
}
|
|
50
|
+
else if (typeof record.link === "string" && !record.appUrl) {
|
|
51
|
+
record.appUrl = record.link;
|
|
52
|
+
}
|
|
53
|
+
if ("screenshotUrl" in record || "thumbnailUrl" in record) {
|
|
54
|
+
record.screenshotStatus = screenshotStatus(record.screenshotUrl || record.thumbnailUrl, generationStatus ??
|
|
55
|
+
(typeof record.status === "string" ? record.status : null));
|
|
56
|
+
}
|
|
57
|
+
void conversationId;
|
|
58
|
+
}
|
|
59
|
+
export function decorateEmailPayload(data, options = {}) {
|
|
60
|
+
if (!data || typeof data !== "object")
|
|
61
|
+
return data;
|
|
62
|
+
const includeHtml = options.includeHtml === true;
|
|
63
|
+
const copy = cloneJson(data);
|
|
64
|
+
const root = asRecord(copy);
|
|
65
|
+
if (!root)
|
|
66
|
+
return copy;
|
|
67
|
+
const rootStatus = typeof root.status === "string" ? root.status : null;
|
|
68
|
+
decorateRecord(root, includeHtml, rootStatus);
|
|
69
|
+
const result = asRecord(root.result);
|
|
70
|
+
if (result) {
|
|
71
|
+
decorateRecord(result, includeHtml, rootStatus);
|
|
72
|
+
if (Array.isArray(result.emails)) {
|
|
73
|
+
for (const row of result.emails) {
|
|
74
|
+
const record = asRecord(row);
|
|
75
|
+
if (record)
|
|
76
|
+
decorateRecord(record, includeHtml, record.status);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (Array.isArray(root.emails)) {
|
|
81
|
+
for (const row of root.emails) {
|
|
82
|
+
const record = asRecord(row);
|
|
83
|
+
if (record)
|
|
84
|
+
decorateRecord(record, includeHtml, record.status);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return copy;
|
|
88
|
+
}
|
|
89
|
+
export function slimProject(data) {
|
|
90
|
+
const record = asRecord(data);
|
|
91
|
+
if (!record)
|
|
92
|
+
return data;
|
|
93
|
+
const slim = {};
|
|
94
|
+
for (const [key, value] of Object.entries(record)) {
|
|
95
|
+
if (!PROJECT_DROP.has(key))
|
|
96
|
+
slim[key] = value;
|
|
97
|
+
}
|
|
98
|
+
return slim;
|
|
99
|
+
}
|
|
100
|
+
export function compactProjectList(data, search) {
|
|
101
|
+
const root = asRecord(data);
|
|
102
|
+
if (!root || !Array.isArray(root.projects))
|
|
103
|
+
return data;
|
|
104
|
+
const needle = search?.trim().toLowerCase();
|
|
105
|
+
const projects = root.projects
|
|
106
|
+
.map((row) => asRecord(row))
|
|
107
|
+
.filter((row) => !!row)
|
|
108
|
+
.filter((row) => {
|
|
109
|
+
if (!needle)
|
|
110
|
+
return true;
|
|
111
|
+
const name = String(row.name ?? "").toLowerCase();
|
|
112
|
+
const domain = String(row.domain ?? "").toLowerCase();
|
|
113
|
+
const id = String(row._id ?? row.id ?? "").toLowerCase();
|
|
114
|
+
return name.includes(needle) || domain.includes(needle) || id.includes(needle);
|
|
115
|
+
})
|
|
116
|
+
.map((row) => ({
|
|
117
|
+
id: row._id ?? row.id,
|
|
118
|
+
name: row.name,
|
|
119
|
+
domain: row.domain,
|
|
120
|
+
status: row.status,
|
|
121
|
+
updatedAt: row.updatedAt,
|
|
122
|
+
}));
|
|
123
|
+
return {
|
|
124
|
+
projects,
|
|
125
|
+
pagination: root.pagination,
|
|
126
|
+
note: needle
|
|
127
|
+
? "Names can repeat across brands — use id + domain."
|
|
128
|
+
: "Compact list. Names can repeat — use id + domain. Pass search to filter.",
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
export function stripExportInlineContent(data) {
|
|
132
|
+
const root = asRecord(data);
|
|
133
|
+
if (!root || !Array.isArray(root.files))
|
|
134
|
+
return data;
|
|
135
|
+
return {
|
|
136
|
+
...root,
|
|
137
|
+
files: root.files.map((file) => {
|
|
138
|
+
const record = asRecord(file);
|
|
139
|
+
if (!record)
|
|
140
|
+
return file;
|
|
141
|
+
const { content: _content, ...rest } = record;
|
|
142
|
+
return rest;
|
|
143
|
+
}),
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=agent-payload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-payload.js","sourceRoot":"","sources":["../../src/tools/agent-payload.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,GAAG,kBAAkB,CAAC;AAEtC,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC;IAC3B,eAAe;IACf,WAAW;IACX,QAAQ;IACR,eAAe;IACf,WAAW;IACX,WAAW;IACX,cAAc;IACd,eAAe;IACf,iBAAiB;IACjB,YAAY;CACb,CAAC,CAAC;AAEH,MAAM,UAAU,kBAAkB,CAChC,cAAsB,EACtB,IAAoB;IAEpB,MAAM,GAAG,GAAG,GAAG,UAAU,WAAW,kBAAkB,CAAC,cAAc,CAAC,EAAE,CAAC;IACzE,OAAO,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,SAAS,IAAI,EAAE,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,GAAY,EACZ,gBAAgC;IAEhC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,EAAE;QAAE,OAAO,OAAO,CAAC;IAC1D,IACE,gBAAgB,KAAK,SAAS;QAC9B,gBAAgB,KAAK,YAAY;QACjC,g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C,CAAC;IAC5B,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACrD,OAAO;QACL,GAAG,IAAI;QACP,KAAK,EAAG,IAAI,CAAC,KAAmB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YAC5C,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;YAC9B,IAAI,CAAC,MAAM;gBAAE,OAAO,IAAI,CAAC;YACzB,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;YAC9C,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;KACH,CAAC;AACJ,CAAC"}
|
|
@@ -8,17 +8,17 @@ import { WORKFLOWS } from "../prompts/index.js";
|
|
|
8
8
|
*/
|
|
9
9
|
export const TOOL_CATALOG = [
|
|
10
10
|
// Projects / brands
|
|
11
|
-
{ name: "migma_list_projects", domain: "projects", summary: "List
|
|
12
|
-
{ name: "migma_get_project", domain: "projects", summary: "Get brand
|
|
11
|
+
{ name: "migma_list_projects", domain: "projects", summary: "List brands as compact id/name/domain rows. Pass search to find a name.", write: false, idempotent: false },
|
|
12
|
+
{ name: "migma_get_project", domain: "projects", summary: "Get brand colors, fonts, logos, voice. Not emails or the knowledge base.", write: false, idempotent: false },
|
|
13
13
|
{ name: "migma_import_brand", domain: "projects", summary: "Import a brand from website URLs and poll until the import completes.", write: true, idempotent: false },
|
|
14
14
|
{ name: "migma_get_field_catalog", domain: "projects", summary: "List subscriber fields, fill rates, and example values for template variables.", write: false, idempotent: false },
|
|
15
15
|
// Email generation
|
|
16
|
-
{ name: "migma_generate_email", domain: "emails", summary: "Start email generation;
|
|
17
|
-
{ name: "migma_get_generation_status", domain: "emails", summary: "Poll a generation
|
|
18
|
-
{ name: "migma_list_emails", domain: "emails", summary: "List generated email designs
|
|
16
|
+
{ name: "migma_generate_email", domain: "emails", summary: "Start email generation; optional images, referenceId, idempotency_key. Returns conversationId. Poll status.", write: true, idempotent: true },
|
|
17
|
+
{ name: "migma_get_generation_status", domain: "emails", summary: "Poll a generation. Returns preview images, appUrl, screenshotStatus. HTML off by default.", write: false, idempotent: false },
|
|
18
|
+
{ name: "migma_list_emails", domain: "emails", summary: "List generated email designs with preview images and appUrl. Not campaigns.", write: false, idempotent: false },
|
|
19
19
|
{ name: "migma_send_test_email", domain: "emails", summary: "Send a test email for a generated email id or single-email conversation.", write: true, idempotent: false },
|
|
20
|
-
{ name: "migma_get_email", domain: "emails", summary: "Fetch one
|
|
21
|
-
{ name: "migma_edit_email", domain: "emails", summary: "Edit a generated email
|
|
20
|
+
{ name: "migma_get_email", domain: "emails", summary: "Fetch one email: preview image, appUrl, screenshotStatus. HTML off unless includeHtml.", write: false, idempotent: false },
|
|
21
|
+
{ name: "migma_edit_email", domain: "emails", summary: "Edit a generated email; returns a preview image. HTML off unless includeHtml.", write: true, idempotent: false },
|
|
22
22
|
{ name: "migma_get_email_metrics", domain: "emails", summary: "Aggregate performance for one generated email across its API sends: delivery, opens, clicks, bounces, unsubscribes + time series.", write: false, idempotent: false },
|
|
23
23
|
{ name: "migma_get_email_logs", domain: "emails", summary: "Per-recipient send log for one generated email, cursor-paginated.", write: false, idempotent: false },
|
|
24
24
|
// Sending
|
|
@@ -35,11 +35,11 @@ export const TOOL_CATALOG = [
|
|
|
35
35
|
{ name: "migma_get_campaign_stats", domain: "campaigns", summary: "Aggregated engagement metrics for a campaign (cached, may be slightly stale).", write: false, idempotent: false },
|
|
36
36
|
{ name: "migma_get_campaign_logs", domain: "campaigns", summary: "Per-recipient delivery logs for a campaign, cursor-paginated.", write: false, idempotent: false },
|
|
37
37
|
// Validation
|
|
38
|
-
{ name: "migma_validate_email", domain: "validation", summary: "
|
|
39
|
-
{ name: "migma_validate_compatibility", domain: "validation", summary: "
|
|
40
|
-
{ name: "migma_validate_deliverability", domain: "validation", summary: "
|
|
38
|
+
{ name: "migma_validate_email", domain: "validation", summary: "Validate by emailId (preferred). Do not pass raw HTML.", write: false, idempotent: false },
|
|
39
|
+
{ name: "migma_validate_compatibility", domain: "validation", summary: "Client compatibility by emailId. Do not pass raw HTML.", write: false, idempotent: false },
|
|
40
|
+
{ name: "migma_validate_deliverability", domain: "validation", summary: "Spam/inbox check by emailId. Do not pass raw HTML.", write: false, idempotent: false },
|
|
41
41
|
// Export
|
|
42
|
-
{ name: "migma_export_html", domain: "export", summary: "Export a generated email
|
|
42
|
+
{ name: "migma_export_html", domain: "export", summary: "Export a generated email. Returns a download URL, not inline HTML.", write: false, idempotent: false },
|
|
43
43
|
{ name: "migma_export_mjml", domain: "export", summary: "Export a generated email as MJML markup.", write: false, idempotent: false },
|
|
44
44
|
{ name: "migma_export_pdf", domain: "export", summary: "Export a generated email as a PDF document.", write: false, idempotent: false },
|
|
45
45
|
{ name: "migma_export_klaviyo", domain: "export", summary: "Export a generated email in Klaviyo-compatible format.", write: false, idempotent: false },
|
|
@@ -88,7 +88,7 @@ export function registerCapabilitiesTool(server) {
|
|
|
88
88
|
server: "migma",
|
|
89
89
|
version,
|
|
90
90
|
brandScoping: "API key is account-scoped; pass projectId per tool (or set MIGMA_PROJECT_ID). Resources in another project return 404.",
|
|
91
|
-
emailsVsCampaigns: "Designed emails = migma_list_emails / migma_get_generation_status. Audience sends = migma_list_campaigns. migma_get_project is brand only
|
|
91
|
+
emailsVsCampaigns: "Designed emails = migma_list_emails / migma_get_generation_status. Audience sends = migma_list_campaigns. migma_get_project is brand only. List/get/status/edit return preview images and appUrl; HTML is off unless includeHtml. Validate with emailId, not raw HTML.",
|
|
92
92
|
idempotency: {
|
|
93
93
|
header: "Idempotency-Key",
|
|
94
94
|
maxLength: 100,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../../src/tools/capabilities.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;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AE,kBAAkB;QACzB,WAAW,EACT,8KAA8K;QAChL,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;QACnC,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;KAC1B,EACD,KAAK,IAAI,EAAE;QACT,MAAM,OAAO,GAAG;YACd,MAAM,EAAE,OAAO;YACf,OAAO;YACP,YAAY,EACV,wHAAwH;YAC1H,iBAAiB,EACf,wQAAwQ;YAC1Q,WAAW,EAAE;gBACX,MAAM,EAAE,iBAAiB;gBACzB,SAAS,EAAE,GAAG;gBACd,QAAQ,EAAE,EAAE;gBACZ,YAAY,EAAE,sBAAsB;aACrC;YACD,KAAK,EAAE,YAAY;YACnB,SAAS,EAAE,SAAS;YACpB,MAAM,EACJ,sGAAsG;YACxG,IAAI,EAAE,uBAAuB;SAC9B,CAAC;QAEF,OAAO;YACL,OAAO,EAAE;gBACP,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE;aAClE;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type ScreenshotRef = {
|
|
2
|
+
url: string;
|
|
3
|
+
label: string;
|
|
4
|
+
};
|
|
5
|
+
export type ImageContent = {
|
|
6
|
+
type: "image";
|
|
7
|
+
data: string;
|
|
8
|
+
mimeType: string;
|
|
9
|
+
};
|
|
10
|
+
export type TextContent = {
|
|
11
|
+
type: "text";
|
|
12
|
+
text: string;
|
|
13
|
+
};
|
|
14
|
+
export type FetchLike = (input: string, init?: {
|
|
15
|
+
signal?: AbortSignal;
|
|
16
|
+
}) => Promise<{
|
|
17
|
+
ok: boolean;
|
|
18
|
+
headers: {
|
|
19
|
+
get(name: string): string | null;
|
|
20
|
+
};
|
|
21
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
22
|
+
}>;
|
|
23
|
+
export declare function isAllowedScreenshotUrl(url: string): boolean;
|
|
24
|
+
export declare function collectScreenshotRefs(data: unknown, mode: "list" | "detail"): ScreenshotRef[];
|
|
25
|
+
export declare function screenshotGuidance(refs: ScreenshotRef[], attached: number, data: unknown): string;
|
|
26
|
+
export declare function fetchEmailImage(url: string, fetchImpl?: FetchLike): Promise<ImageContent | null>;
|
|
27
|
+
export declare function toolResultWithImages(data: unknown, mode: "list" | "detail", fetchImpl?: FetchLike): Promise<{
|
|
28
|
+
content: Array<TextContent | ImageContent>;
|
|
29
|
+
}>;
|
|
30
|
+
//# sourceMappingURL=email-images.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-images.d.ts","sourceRoot":"","sources":["../../src/tools/email-images.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,CACtB,KAAK,EAAE,MAAM,EACb,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,WAAW,CAAA;CAAE,KAC5B,OAAO,CAAC;IACX,EAAE,EAAE,OAAO,CAAC;IACZ,OAAO,EAAE;QAAE,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IAC9C,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;CACrC,CAAC,CAAC;AAYH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAkB3D;AA2BD,wBA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