@apex-inc/mcp-server 0.75.0 → 0.79.0
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/README.md +8 -0
- package/dist/api-client.d.ts +13 -21
- package/dist/api-client.d.ts.map +1 -1
- package/dist/api-client.js +203 -61
- package/dist/api-client.js.map +1 -1
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +7 -6
- package/dist/auth.js.map +1 -1
- package/dist/fetch-timeout.d.ts +23 -0
- package/dist/fetch-timeout.d.ts.map +1 -0
- package/dist/fetch-timeout.js +78 -0
- package/dist/fetch-timeout.js.map +1 -0
- package/dist/hosted.d.ts +34 -0
- package/dist/hosted.d.ts.map +1 -0
- package/dist/hosted.js +74 -0
- package/dist/hosted.js.map +1 -0
- package/dist/index.js +49 -117
- package/dist/index.js.map +1 -1
- package/dist/letter-blocks.d.ts.map +1 -1
- package/dist/letter-blocks.js +13 -22
- package/dist/letter-blocks.js.map +1 -1
- package/dist/live-test-files.d.ts +35 -0
- package/dist/live-test-files.d.ts.map +1 -0
- package/dist/live-test-files.js +114 -0
- package/dist/live-test-files.js.map +1 -0
- package/dist/live-test-guard.d.ts.map +1 -1
- package/dist/live-test-guard.js +7 -1
- package/dist/live-test-guard.js.map +1 -1
- package/dist/request-context.d.ts +40 -0
- package/dist/request-context.d.ts.map +1 -0
- package/dist/request-context.js +11 -0
- package/dist/request-context.js.map +1 -0
- package/dist/server-factory.d.ts +31 -0
- package/dist/server-factory.d.ts.map +1 -0
- package/dist/server-factory.js +585 -0
- package/dist/server-factory.js.map +1 -0
- package/dist/setup-catchup-tools.d.ts +4 -0
- package/dist/setup-catchup-tools.d.ts.map +1 -1
- package/dist/setup-catchup-tools.js +33 -67
- package/dist/setup-catchup-tools.js.map +1 -1
- package/dist/smoke-tools.d.ts.map +1 -1
- package/dist/smoke-tools.js +2 -0
- package/dist/smoke-tools.js.map +1 -1
- package/dist/tool-catalog.d.ts +2 -0
- package/dist/tool-catalog.d.ts.map +1 -1
- package/dist/tool-catalog.js +6 -1
- package/dist/tool-catalog.js.map +1 -1
- package/dist/tool-groups.d.ts.map +1 -1
- package/dist/tool-groups.js +12 -0
- package/dist/tool-groups.js.map +1 -1
- package/dist/tool-mode.d.ts +48 -0
- package/dist/tool-mode.d.ts.map +1 -0
- package/dist/tool-mode.js +189 -0
- package/dist/tool-mode.js.map +1 -0
- package/dist/tool-shared.d.ts +9 -1
- package/dist/tool-shared.d.ts.map +1 -1
- package/dist/tool-shared.js +52 -6
- package/dist/tool-shared.js.map +1 -1
- package/dist/tools/adoption.d.ts.map +1 -1
- package/dist/tools/adoption.js +2 -1
- package/dist/tools/adoption.js.map +1 -1
- package/dist/tools/apex-campaigns.d.ts +394 -0
- package/dist/tools/apex-campaigns.d.ts.map +1 -1
- package/dist/tools/apex-campaigns.js +256 -1
- package/dist/tools/apex-campaigns.js.map +1 -1
- package/dist/tools/context.d.ts +2 -2
- package/dist/tools/experiments.d.ts +69 -1
- package/dist/tools/experiments.d.ts.map +1 -1
- package/dist/tools/experiments.js +140 -76
- package/dist/tools/experiments.js.map +1 -1
- package/dist/tools/letters.d.ts +214 -48
- package/dist/tools/letters.d.ts.map +1 -1
- package/dist/tools/letters.js +240 -44
- package/dist/tools/letters.js.map +1 -1
- package/dist/tools/measurement.d.ts +70 -28
- package/dist/tools/measurement.d.ts.map +1 -1
- package/dist/tools/measurement.js +165 -27
- package/dist/tools/measurement.js.map +1 -1
- package/dist/tools.d.ts +774 -76
- package/dist/tools.d.ts.map +1 -1
- package/package.json +11 -1
- package/skills/apex-growth-intelligence/SKILL.md +4 -0
- package/skills/apex-growth-tracking/SKILL.md +1 -1
- package/skills/apex-integration-cookbook/SKILL.md +23 -3
- package/skills/apex-setup/SKILL.md +2 -1
- package/skills/apex-spec/SKILL.md +6 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"letters.d.ts","sourceRoot":"","sources":["../../src/tools/letters.ts"],"names":[],"mappings":"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AAC;YACrB,SAAS,CAAC,EAAE,OAAO,CAAC;SACrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA2BqB;YACpB,SAAS,EAAE,MAAM,CAAC;YAClB,KAAK,CAAC,EAAE,WAAW,GAAG,KAAK,CAAC;YAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,WAAW,CAAC,EAAE,MAAM,CAAC;YACrB,UAAU,CAAC,EAAE,OAAO,CAAC;YACrB,SAAS,CAAC,EAAE,OAAO,CAAC;SACrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA0CqB;YACpB,SAAS,EAAE,MAAM,CAAC;YAClB,KAAK,CAAC,EAAE,WAAW,GAAG,KAAK,CAAC;YAC5B,YAAY,CAAC,EAAE,OAAO,CAAC;SACxB;;;;;;;;;;;;;;CAwCJ,CAAC"}
|
package/dist/tools/letters.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { apiGet, apiPost, apiPatch, apiDelete, apiDeleteJson, getActiveWorkspace, resolveActiveOrg, } from "../api-client.js";
|
|
3
|
+
import { LONG_REQUEST_TIMEOUT_MS } from "../fetch-timeout.js";
|
|
3
4
|
import { controlGateGuidanceFor } from "../control-gate-guidance.js";
|
|
4
5
|
import { notStartedExplanation, publishedExperimentLine } from "../publish-communication-copy.js";
|
|
5
6
|
import { applyAddJourneyStep } from "../add-journey-step.js";
|
|
@@ -38,7 +39,7 @@ function everyoneInSegmentLine(c) {
|
|
|
38
39
|
const segmentEventWhereSchema = z
|
|
39
40
|
.array(z.object({
|
|
40
41
|
field_path: z.string().min(1).describe("Event property path (dot notation for nested keys, e.g. ft_source_group or plan.tier)."),
|
|
41
|
-
operator: z.enum(["equals", "not_equals", "in", "exists", "not_exists"]),
|
|
42
|
+
operator: z.enum(["equals", "not_equals", "in", "contains", "gt", "gte", "lt", "lte", "exists", "not_exists"]),
|
|
42
43
|
value: z
|
|
43
44
|
.union([
|
|
44
45
|
z.string(),
|
|
@@ -47,7 +48,7 @@ const segmentEventWhereSchema = z
|
|
|
47
48
|
z.array(z.union([z.string(), z.number(), z.boolean()])),
|
|
48
49
|
])
|
|
49
50
|
.optional()
|
|
50
|
-
.describe("Value to match (omit for exists/not_exists; array for in)."),
|
|
51
|
+
.describe("Value to match (omit for exists/not_exists; array for in; number for gt/gte/lt/lte)."),
|
|
51
52
|
}))
|
|
52
53
|
.max(10)
|
|
53
54
|
.optional()
|
|
@@ -65,8 +66,12 @@ const segmentConditionsSchema = z.object({
|
|
|
65
66
|
scope: z.enum(["person", "account"]).optional(),
|
|
66
67
|
window_days: z.number().optional(),
|
|
67
68
|
attribute: z.string().optional(),
|
|
68
|
-
op: z.enum(["is", "is_not", "exists"]).optional(),
|
|
69
|
+
op: z.enum(["is", "is_not", "contains", "exists"]).optional(),
|
|
69
70
|
value: z.union([z.string(), z.number(), z.boolean()]).optional(),
|
|
71
|
+
brought_by_campaign: z
|
|
72
|
+
.union([z.string().min(1), z.object({ campaign_id: z.string().min(1) })])
|
|
73
|
+
.optional()
|
|
74
|
+
.describe("People brought by an Apex Campaign (pass campaign_id or { campaign_id })."),
|
|
70
75
|
})),
|
|
71
76
|
})),
|
|
72
77
|
});
|
|
@@ -85,7 +90,7 @@ export const letterTools = {
|
|
|
85
90
|
catalogEntryIds: z.array(z.string()).describe("IDs from the recommendation output to generate"),
|
|
86
91
|
}),
|
|
87
92
|
handler: async (args) => {
|
|
88
|
-
const data = await apiPost("/api/communications/generate", { catalogEntryIds: args.catalogEntryIds });
|
|
93
|
+
const data = await apiPost("/api/communications/generate", { catalogEntryIds: args.catalogEntryIds }, { timeoutMs: LONG_REQUEST_TIMEOUT_MS });
|
|
89
94
|
const count = Array.isArray(data) ? data.length : 0;
|
|
90
95
|
return { content: [{ type: "text", text: `Generated ${count} communication(s).\n\n${JSON.stringify(data, null, 2)}` }] };
|
|
91
96
|
},
|
|
@@ -127,6 +132,7 @@ export const letterTools = {
|
|
|
127
132
|
title: String(comm.title ?? "Untitled"),
|
|
128
133
|
version: typeof comm.version === "number" ? comm.version : 1,
|
|
129
134
|
status: String(comm.status ?? "draft"),
|
|
135
|
+
has_unpublished_changes: Boolean(comm.draftContent),
|
|
130
136
|
pipeline: commType === "transactional"
|
|
131
137
|
? "transactional"
|
|
132
138
|
: "marketing",
|
|
@@ -418,38 +424,21 @@ export const letterTools = {
|
|
|
418
424
|
},
|
|
419
425
|
},
|
|
420
426
|
edit_communication: {
|
|
421
|
-
description: "Update a communication's subject, body, CTA, channels, or status.
|
|
427
|
+
description: "Update a communication's title, subject, body (slots or blocks), CTA, channels, or status. Verify with preview_communication. Protected controls (won an experiment or live in a published journey) require intent: 'compete' (safe default: adds a competing variant) or 'replace'.",
|
|
422
428
|
schema: z.object({
|
|
423
|
-
communicationId: z.string().describe("
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
.optional()
|
|
429
|
-
.describe("Rewrite the whole letter body as sections, in order: heading, text, image, button, html, spacer, divider, keep. Keeps the brand header and footer; replaces everything between them. Use this for a multi-section letter (several pictures, subheadings, buttons). To change an existing letter, start from get_communication: pass each section's id back so it keeps its saved settings, and pass every keep section back as it is (a list of people or items, for example), in the place you want it. A keep section left out is removed. Ignores slots when set."),
|
|
429
|
+
communicationId: z.string().describe("Communication ID"),
|
|
430
|
+
title: z.string().min(1).max(200).optional().describe("Communication title"),
|
|
431
|
+
subject: z.string().optional().describe("Email subject line"),
|
|
432
|
+
slots: z.record(z.string()).optional().describe("Slot overrides: headline, body, ctaLabel, ctaUrl, imageUrl (\"\" removes), imageAlt, imageHeight, imageNaturalWidth, imageNaturalHeight."),
|
|
433
|
+
blocks: z.array(letterBlockSchema).optional().describe("Ordered body sections (replaces body between header/footer; pass back keep sections from get_communication; ignores slots)."),
|
|
430
434
|
channels: z.array(z.string()).optional().describe("Channels: email, in_app_push, mobile_push"),
|
|
431
|
-
senderName: z
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
.enum(["production", "beta", "dev"])
|
|
439
|
-
.optional()
|
|
440
|
-
.describe("Who this send is for. Default production. Never All or Unclassified."),
|
|
441
|
-
intent: z
|
|
442
|
-
.enum(["compete", "replace"])
|
|
443
|
-
.optional()
|
|
444
|
-
.describe('How to apply the edit when the Control is protected. "compete" = add it as a variant and run it as an experiment against the current content (safe default; the current content keeps sending). "replace" = update what everyone receives, superseding any prior win. Required only when the comm won an experiment or is live in a published journey.'),
|
|
445
|
-
confirmLiveExperiment: z
|
|
446
|
-
.boolean()
|
|
447
|
-
.optional()
|
|
448
|
-
.describe("Edit a communication that is the treatment in a RUNNING experiment. Marks the numbers untrustworthy: we will not call a winner and we will not learn from mixed counts. Only pass true when they picked an out."),
|
|
449
|
-
categoryId: z
|
|
450
|
-
.string()
|
|
451
|
-
.optional()
|
|
452
|
-
.describe("Optional marketing email category ID (`cat_...`). Required before publishing when the workspace defines email categories; pass empty string to clear."),
|
|
435
|
+
senderName: z.string().optional().describe('From display name (e.g. "Chris"); "" clears.'),
|
|
436
|
+
replyTo: z.string().optional().describe('Reply-to email; "" clears.'),
|
|
437
|
+
status: z.enum(["draft", "active", "paused"]).optional().describe("Prefer publish_communication to go live; pass 'draft' to unpublish."),
|
|
438
|
+
audience_bucket: z.enum(["production", "beta", "dev"]).optional().describe("Target audience bucket (default production)."),
|
|
439
|
+
intent: z.enum(["compete", "replace"]).optional().describe("Required on protected controls: 'compete' (safe variant test) or 'replace'."),
|
|
440
|
+
confirmLiveExperiment: z.boolean().optional().describe("Pass true only after the owner approved editing a running experiment's treatment."),
|
|
441
|
+
categoryId: z.string().optional().describe("Marketing email category id (cat_...); '' clears."),
|
|
453
442
|
}),
|
|
454
443
|
handler: async (args) => {
|
|
455
444
|
const guard = await refuseLiveApexObject({
|
|
@@ -461,6 +450,8 @@ export const letterTools = {
|
|
|
461
450
|
return { content: [{ type: "text", text: guard.text }] };
|
|
462
451
|
}
|
|
463
452
|
const body = {};
|
|
453
|
+
if (args.title !== undefined)
|
|
454
|
+
body.title = args.title.trim();
|
|
464
455
|
if (args.status)
|
|
465
456
|
body.status = args.status;
|
|
466
457
|
if (args.channels)
|
|
@@ -705,6 +696,7 @@ export const letterTools = {
|
|
|
705
696
|
id: comm.id,
|
|
706
697
|
title: comm.title,
|
|
707
698
|
status: comm.status,
|
|
699
|
+
has_unpublished_changes: Boolean(comm.draftContent),
|
|
708
700
|
...(comm.kind ? { kind: comm.kind } : {}),
|
|
709
701
|
channels: comm.channels,
|
|
710
702
|
pipeline: comm.pipeline,
|
|
@@ -1132,6 +1124,64 @@ export const letterTools = {
|
|
|
1132
1124
|
}
|
|
1133
1125
|
},
|
|
1134
1126
|
},
|
|
1127
|
+
update_journey: {
|
|
1128
|
+
description: `${APEX} — Rename a journey or update its description, audience bucket, or attribution window. Edits the journey's draft; if the journey is already published, call publish_journey after renaming so live labels match. Workspace admin.`,
|
|
1129
|
+
schema: z.object({
|
|
1130
|
+
journeyId: z.string().min(1).describe("The journey ID to update (from list_journeys)."),
|
|
1131
|
+
name: z.string().trim().min(1).max(200).optional().describe("New journey name."),
|
|
1132
|
+
description: z.string().max(1000).optional().describe("Updated journey description."),
|
|
1133
|
+
audience_bucket: z
|
|
1134
|
+
.enum(["production", "beta", "dev"])
|
|
1135
|
+
.optional()
|
|
1136
|
+
.describe("Who this journey enrolls."),
|
|
1137
|
+
attributionWindowDays: z
|
|
1138
|
+
.number()
|
|
1139
|
+
.int()
|
|
1140
|
+
.min(1)
|
|
1141
|
+
.max(90)
|
|
1142
|
+
.optional()
|
|
1143
|
+
.describe("Attribution window in days (1-90)."),
|
|
1144
|
+
}),
|
|
1145
|
+
handler: async ({ journeyId, name, description, audience_bucket, attributionWindowDays, }) => {
|
|
1146
|
+
const body = {};
|
|
1147
|
+
if (name !== undefined)
|
|
1148
|
+
body.name = name.trim();
|
|
1149
|
+
if (description !== undefined)
|
|
1150
|
+
body.description = description;
|
|
1151
|
+
if (audience_bucket !== undefined)
|
|
1152
|
+
body.audienceBucket = audience_bucket;
|
|
1153
|
+
if (attributionWindowDays !== undefined) {
|
|
1154
|
+
body.attributionWindowDays = attributionWindowDays;
|
|
1155
|
+
}
|
|
1156
|
+
if (Object.keys(body).length === 0) {
|
|
1157
|
+
return {
|
|
1158
|
+
content: [
|
|
1159
|
+
{
|
|
1160
|
+
type: "text",
|
|
1161
|
+
text: `${APEX} Pass at least one field to update (name, description, audience_bucket, or attribution_window_days).`,
|
|
1162
|
+
},
|
|
1163
|
+
],
|
|
1164
|
+
isError: true,
|
|
1165
|
+
};
|
|
1166
|
+
}
|
|
1167
|
+
try {
|
|
1168
|
+
const j = await apiPatch(`/api/journeys/${encodeURIComponent(journeyId)}`, body);
|
|
1169
|
+
if (!tenantOk(j.workspaceKey))
|
|
1170
|
+
return tenantMismatch();
|
|
1171
|
+
return {
|
|
1172
|
+
content: [
|
|
1173
|
+
{
|
|
1174
|
+
type: "text",
|
|
1175
|
+
text: `${APEX} Updated journey "${j.name}" (id: ${j.id}).\nOpen in Apex: ${journeyLink(j.id)}`,
|
|
1176
|
+
},
|
|
1177
|
+
],
|
|
1178
|
+
};
|
|
1179
|
+
}
|
|
1180
|
+
catch (err) {
|
|
1181
|
+
return { content: [{ type: "text", text: `${APEX} ${errMsg(err)}` }], isError: true };
|
|
1182
|
+
}
|
|
1183
|
+
},
|
|
1184
|
+
},
|
|
1135
1185
|
create_journey_from_template: {
|
|
1136
1186
|
description: `${APEX} — Instantiate a starter journey template (e.g. Abandoned Cart Recovery) into a fresh draft. Get the templateId from get_wiring_status (Ready-to-run templates list their id). Returns a direct link into the Apex visual journey canvas so the owner can inspect or edit the flow and letters before calling publish_journey.`,
|
|
1137
1187
|
schema: z.object({ templateId: z.string().describe("Template id from get_wiring_status (e.g. 'mobile-cart-recovery').") }),
|
|
@@ -1155,7 +1205,7 @@ export const letterTools = {
|
|
|
1155
1205
|
},
|
|
1156
1206
|
},
|
|
1157
1207
|
get_journey_funnel_coverage: {
|
|
1158
|
-
description: `${APEX} — Read the workspace's funnel stages, stage-to-stage progress (default last 30 days),
|
|
1208
|
+
description: `${APEX} — Read the workspace's funnel stages, stage-to-stage progress (default last 30 days), which funnel gaps (e.g. Sign-up → Activation, Churned → Reactivated) have live journeys, draft journeys, or no journey yet, matching vertical templates for each gap, and any journeys missing auto-exits after newer funnel stages were added. Call this before create_journey_from_funnel_gap or sync_journey_funnel_exits.`,
|
|
1159
1209
|
schema: z.object({
|
|
1160
1210
|
days: z
|
|
1161
1211
|
.number()
|
|
@@ -1185,6 +1235,9 @@ export const letterTools = {
|
|
|
1185
1235
|
const stageLine = d.stages
|
|
1186
1236
|
.map((s) => `${s.label} (${s.reachedWindow} in ${d.windowDays}d)`)
|
|
1187
1237
|
.join(" → ");
|
|
1238
|
+
const driftSummary = (d.summary.journeysWithExitDrift ?? 0) > 0
|
|
1239
|
+
? `, ${d.summary.journeysWithExitDrift} needing exit sync`
|
|
1240
|
+
: "";
|
|
1188
1241
|
const gapLines = d.gaps.map((g) => {
|
|
1189
1242
|
const status = g.coverageStatus === "live"
|
|
1190
1243
|
? `LIVE (${g.journeys.map((j) => `"${j.name}" [${j.id}]`).join(", ")})`
|
|
@@ -1194,19 +1247,34 @@ export const letterTools = {
|
|
|
1194
1247
|
const prog = g.progress.enteredWindow > 0 && g.progress.progressRateWindow !== null
|
|
1195
1248
|
? `${Math.round(g.progress.progressRateWindow * 100)}% (${g.progress.progressedWindow}/${g.progress.enteredWindow}, ${g.progress.stillInGapWindow} waiting)`
|
|
1196
1249
|
: `no activity in last ${d.windowDays}d`;
|
|
1197
|
-
|
|
1250
|
+
const extras = [];
|
|
1251
|
+
const tpls = g.recommendedTemplates ?? [];
|
|
1252
|
+
if (tpls.length > 0) {
|
|
1253
|
+
extras.push(` templates: ${tpls.map((t) => `"${t.id}" (${t.title}${t.hasExperiment ? ", A/B test" : ""})`).join(", ")}`);
|
|
1254
|
+
}
|
|
1255
|
+
for (const j of g.journeys) {
|
|
1256
|
+
const missing = j.missingAutoExits ?? [];
|
|
1257
|
+
if (missing.length > 0) {
|
|
1258
|
+
extras.push(` drift on [${j.id}]: missing auto-exit for ${missing.map((m) => m.label).join(", ")} — call sync_journey_funnel_exits`);
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
return [
|
|
1262
|
+
` • ${g.kind === "winback" ? "[Win-back] " : ""}${g.from.label} → ${g.to.label} | ${status} | ${prog}`,
|
|
1263
|
+
` from_key_event_id: "${g.from.keyEventId}", to_key_event_id: "${g.to.keyEventId}"`,
|
|
1264
|
+
...extras,
|
|
1265
|
+
].join("\n");
|
|
1198
1266
|
});
|
|
1199
1267
|
return {
|
|
1200
1268
|
content: [
|
|
1201
1269
|
{
|
|
1202
1270
|
type: "text",
|
|
1203
1271
|
text: [
|
|
1204
|
-
`${APEX} Funnel coverage (last ${d.windowDays}d): ${d.summary.liveCovered}/${d.summary.totalGaps} live, ${d.summary.draftOnly} draft, ${d.summary.uncovered} uncovered`,
|
|
1272
|
+
`${APEX} Funnel coverage (last ${d.windowDays}d): ${d.summary.liveCovered}/${d.summary.totalGaps} live, ${d.summary.draftOnly} draft, ${d.summary.uncovered} uncovered${driftSummary}`,
|
|
1205
1273
|
`Stages: ${stageLine}`,
|
|
1206
1274
|
``,
|
|
1207
1275
|
...gapLines,
|
|
1208
1276
|
``,
|
|
1209
|
-
`To auto-wire a draft journey for any gap, call create_journey_from_funnel_gap with its from_key_event_id and to_key_event_id.`,
|
|
1277
|
+
`To auto-wire a draft journey for any gap, call create_journey_from_funnel_gap with its from_key_event_id and to_key_event_id (defaults to a timed starter sequence; pass template_id to start from a recommended template, or mode: "blank").`,
|
|
1210
1278
|
].join("\n"),
|
|
1211
1279
|
},
|
|
1212
1280
|
],
|
|
@@ -1218,10 +1286,18 @@ export const letterTools = {
|
|
|
1218
1286
|
},
|
|
1219
1287
|
},
|
|
1220
1288
|
create_journey_from_funnel_gap: {
|
|
1221
|
-
description: `${APEX} — Create a draft journey pre-wired for a workspace funnel gap (e.g. Sign-up → Activation, or Churned → Reactivated). Automatically sets the start trigger on from_key_event_id (last-day segment so past history never floods it), sets the journey goal to to_key_event_id, and wires automatic exit rules for the goal, every later funnel stage, and off-ramps.
|
|
1289
|
+
description: `${APEX} — Create a draft journey pre-wired for a workspace funnel gap (e.g. Sign-up → Activation, or Churned → Reactivated). Automatically sets the start trigger on from_key_event_id (last-day segment so past history never floods it), sets the journey goal to to_key_event_id, and wires automatic exit rules for the goal, every later funnel stage, and off-ramps. By default creates a timed starter sequence with editable draft emails (mode: "starter_sequence"). Pass template_id (from get_journey_funnel_coverage) to bind a curated template directly to this funnel gap, or mode: "blank" for guardrails only.`,
|
|
1222
1290
|
schema: z.object({
|
|
1223
1291
|
fromKeyEventId: z.string().describe("Starting funnel stage key event id (from get_journey_funnel_coverage)."),
|
|
1224
1292
|
toKeyEventId: z.string().describe("Goal funnel stage key event id (from get_journey_funnel_coverage)."),
|
|
1293
|
+
mode: z
|
|
1294
|
+
.enum(["starter_sequence", "template", "blank"])
|
|
1295
|
+
.optional()
|
|
1296
|
+
.describe('Starting structure: "starter_sequence" (default timed cadence + draft emails), "template" (bind template_id to this gap), or "blank" (guardrails only).'),
|
|
1297
|
+
templateId: z
|
|
1298
|
+
.string()
|
|
1299
|
+
.optional()
|
|
1300
|
+
.describe("Optional recommended template id from get_journey_funnel_coverage (automatically selects mode: \"template\")."),
|
|
1225
1301
|
name: z.string().optional().describe("Optional journey name (defaults to '<From> → <To>')."),
|
|
1226
1302
|
description: z.string().optional().describe("Optional journey description."),
|
|
1227
1303
|
attributionWindowDays: z
|
|
@@ -1236,11 +1312,13 @@ export const letterTools = {
|
|
|
1236
1312
|
.optional()
|
|
1237
1313
|
.describe("Who this journey enrolls. Default production."),
|
|
1238
1314
|
}),
|
|
1239
|
-
handler: async ({ fromKeyEventId, toKeyEventId, name, description, attributionWindowDays, audienceBucket, }) => {
|
|
1315
|
+
handler: async ({ fromKeyEventId, toKeyEventId, mode, templateId, name, description, attributionWindowDays, audienceBucket, }) => {
|
|
1240
1316
|
try {
|
|
1241
1317
|
const res = await apiPost("/api/journeys/from-funnel-gap", {
|
|
1242
1318
|
fromKeyEventId,
|
|
1243
1319
|
toKeyEventId,
|
|
1320
|
+
...(mode !== undefined ? { mode } : {}),
|
|
1321
|
+
...(templateId !== undefined ? { templateId } : {}),
|
|
1244
1322
|
...(name !== undefined ? { name } : {}),
|
|
1245
1323
|
...(description !== undefined ? { description } : {}),
|
|
1246
1324
|
...(attributionWindowDays !== undefined ? { attributionWindowDays } : {}),
|
|
@@ -1254,6 +1332,17 @@ export const letterTools = {
|
|
|
1254
1332
|
if (!tenantOk(j.workspaceKey ?? res.metadata?.workspace_key))
|
|
1255
1333
|
return tenantMismatch();
|
|
1256
1334
|
const exits = g.autoExitKeyEvents.map((e) => e.label).join(", ");
|
|
1335
|
+
const resolvedMode = res.data?.mode ?? (templateId ? "template" : mode ?? "starter_sequence");
|
|
1336
|
+
const commsCreated = res.data?.commsCreated ?? 0;
|
|
1337
|
+
const commsReused = res.data?.commsReused ?? 0;
|
|
1338
|
+
const structureLine = resolvedMode === "template"
|
|
1339
|
+
? `• Structure: template "${res.data?.templateId ?? templateId}" bound to this gap (${commsCreated} created, ${commsReused} reused)`
|
|
1340
|
+
: resolvedMode === "blank"
|
|
1341
|
+
? `• Structure: blank canvas (trigger, goal, and auto-exits wired)`
|
|
1342
|
+
: `• Structure: starter sequence (${commsCreated} draft ${commsCreated === 1 ? "email" : "emails"} ready to review)`;
|
|
1343
|
+
const nextLine = resolvedMode === "blank"
|
|
1344
|
+
? `Next: add_journey_step to drop in waits and letters, then publish_journey once approved.`
|
|
1345
|
+
: `Next: review or tailor the draft letters, then publish_journey once approved.`;
|
|
1257
1346
|
return {
|
|
1258
1347
|
content: [
|
|
1259
1348
|
{
|
|
@@ -1263,8 +1352,56 @@ export const letterTools = {
|
|
|
1263
1352
|
`• Starts when: someone reaches ${g.from.label} (from now on; past history stays out)`,
|
|
1264
1353
|
`• Goal: ${g.to.label}`,
|
|
1265
1354
|
`• Auto-exits on: ${exits || g.to.label}`,
|
|
1355
|
+
structureLine,
|
|
1356
|
+
`Open on the visual canvas: ${journeyLink(j.id)}`,
|
|
1357
|
+
nextLine,
|
|
1358
|
+
].join("\n"),
|
|
1359
|
+
},
|
|
1360
|
+
],
|
|
1361
|
+
};
|
|
1362
|
+
}
|
|
1363
|
+
catch (err) {
|
|
1364
|
+
return { content: [{ type: "text", text: `${APEX} ${errMsg(err)}` }], isError: true };
|
|
1365
|
+
}
|
|
1366
|
+
},
|
|
1367
|
+
},
|
|
1368
|
+
sync_journey_funnel_exits: {
|
|
1369
|
+
description: `${APEX} — Sync newly added downstream funnel stages or off-ramps into a funnel-gap journey's draft auto-exits. Safe for live journeys: updates the draft only and tells you if publish_journey is needed to roll the new exits live.`,
|
|
1370
|
+
schema: z.object({
|
|
1371
|
+
journeyId: z.string().describe("Journey id to sync funnel auto-exits for."),
|
|
1372
|
+
}),
|
|
1373
|
+
handler: async ({ journeyId }) => {
|
|
1374
|
+
try {
|
|
1375
|
+
const res = await apiPost(`/api/journeys/${encodeURIComponent(journeyId)}/sync-funnel-exits`, {});
|
|
1376
|
+
const j = res.data?.journey;
|
|
1377
|
+
if (!j) {
|
|
1378
|
+
return { content: [{ type: "text", text: `${APEX} Unexpected empty response syncing funnel auto-exits.` }], isError: true };
|
|
1379
|
+
}
|
|
1380
|
+
if (!tenantOk(j.workspaceKey ?? res.metadata?.workspace_key))
|
|
1381
|
+
return tenantMismatch();
|
|
1382
|
+
const added = res.data?.added ?? [];
|
|
1383
|
+
if (added.length === 0) {
|
|
1384
|
+
return {
|
|
1385
|
+
content: [
|
|
1386
|
+
{
|
|
1387
|
+
type: "text",
|
|
1388
|
+
text: `${APEX} "${j.name}" (${j.id}) is already in sync with the workspace's current funnel stages and off-ramps.`,
|
|
1389
|
+
},
|
|
1390
|
+
],
|
|
1391
|
+
};
|
|
1392
|
+
}
|
|
1393
|
+
const names = added.map((a) => a.label).join(", ");
|
|
1394
|
+
const publishNote = res.data?.needsPublish
|
|
1395
|
+
? `This journey is live — call publish_journey("${j.id}") to roll the new auto-exits out to active enrollments.`
|
|
1396
|
+
: `Saved to draft. Publish when ready.`;
|
|
1397
|
+
return {
|
|
1398
|
+
content: [
|
|
1399
|
+
{
|
|
1400
|
+
type: "text",
|
|
1401
|
+
text: [
|
|
1402
|
+
`${APEX} Added ${added.length} missing funnel auto-${added.length === 1 ? "exit" : "exits"} to "${j.name}" (${j.id}): ${names}.`,
|
|
1403
|
+
publishNote,
|
|
1266
1404
|
`Open on the visual canvas: ${journeyLink(j.id)}`,
|
|
1267
|
-
`Next: add_journey_step to drop in waits and letters, then publish_journey once approved.`,
|
|
1268
1405
|
].join("\n"),
|
|
1269
1406
|
},
|
|
1270
1407
|
],
|
|
@@ -1275,6 +1412,65 @@ export const letterTools = {
|
|
|
1275
1412
|
}
|
|
1276
1413
|
},
|
|
1277
1414
|
},
|
|
1415
|
+
fill_funnel_gaps: {
|
|
1416
|
+
description: `${APEX} — Create one draft Adaptive Journey for every uncovered gap in the workspace's Key Event funnel (or pass gap_ids to fill specific gaps). Uses the top matching Journey Template when available, falling back to a multi-touch starter sequence, and wires start trigger, goal, and automatic exits for each gap. Drafts only — never auto-publishes.`,
|
|
1417
|
+
schema: z.object({
|
|
1418
|
+
gapIds: z
|
|
1419
|
+
.array(z.string())
|
|
1420
|
+
.optional()
|
|
1421
|
+
.describe("Optional list of gap ids from get_journey_funnel_coverage to fill. Omit to fill every uncovered gap."),
|
|
1422
|
+
audienceBucket: z
|
|
1423
|
+
.enum(["production", "beta", "dev"])
|
|
1424
|
+
.optional()
|
|
1425
|
+
.describe("Audience bucket for the new drafts. Defaults to production."),
|
|
1426
|
+
}),
|
|
1427
|
+
handler: async ({ gapIds, audienceBucket, }) => {
|
|
1428
|
+
try {
|
|
1429
|
+
const res = await apiPost("/api/journeys/fill-funnel-gaps", {
|
|
1430
|
+
...(gapIds !== undefined ? { gapIds } : {}),
|
|
1431
|
+
...(audienceBucket !== undefined ? { audienceBucket } : {}),
|
|
1432
|
+
});
|
|
1433
|
+
if (!tenantOk(res.metadata?.workspace_key))
|
|
1434
|
+
return tenantMismatch();
|
|
1435
|
+
const created = res.data?.created ?? [];
|
|
1436
|
+
const skipped = res.data?.skipped ?? [];
|
|
1437
|
+
if (created.length === 0) {
|
|
1438
|
+
return {
|
|
1439
|
+
content: [
|
|
1440
|
+
{
|
|
1441
|
+
type: "text",
|
|
1442
|
+
text: `${APEX} No new journeys created — every requested funnel gap is already covered (${skipped.length} skipped).`,
|
|
1443
|
+
},
|
|
1444
|
+
],
|
|
1445
|
+
};
|
|
1446
|
+
}
|
|
1447
|
+
const lines = created.map((c) => {
|
|
1448
|
+
const source = c.mode === "template" && c.templateId
|
|
1449
|
+
? `template "${c.templateId}"`
|
|
1450
|
+
: "starter sequence";
|
|
1451
|
+
return ` • ${c.fromLabel} → ${c.toLabel}: "${c.journeyName}" (id: ${c.journeyId}, ${source}, ${c.commsCreated} draft ${c.commsCreated === 1 ? "email" : "emails"}) — ${journeyLink(c.journeyId)}`;
|
|
1452
|
+
});
|
|
1453
|
+
return {
|
|
1454
|
+
content: [
|
|
1455
|
+
{
|
|
1456
|
+
type: "text",
|
|
1457
|
+
text: [
|
|
1458
|
+
`${APEX} Created ${created.length} draft ${created.length === 1 ? "journey" : "journeys"} wired to your funnel (${res.data?.totalCommsCreated ?? 0} draft emails scaffolded).`,
|
|
1459
|
+
...lines,
|
|
1460
|
+
skipped.length > 0 ? `Skipped ${skipped.length} already-covered or unavailable gap(s).` : "",
|
|
1461
|
+
`Review each draft and call publish_journey once approved.`,
|
|
1462
|
+
]
|
|
1463
|
+
.filter(Boolean)
|
|
1464
|
+
.join("\n"),
|
|
1465
|
+
},
|
|
1466
|
+
],
|
|
1467
|
+
};
|
|
1468
|
+
}
|
|
1469
|
+
catch (err) {
|
|
1470
|
+
return { content: [{ type: "text", text: `${APEX} ${errMsg(err)}` }], isError: true };
|
|
1471
|
+
}
|
|
1472
|
+
},
|
|
1473
|
+
},
|
|
1278
1474
|
list_trigger_contracts: {
|
|
1279
1475
|
description: `${APEX} — List the workspace's trigger contracts (the event bindings you pass to set_journey_trigger / add_journey_exit). Returns each contract's id + the event it fires on. Call this before set_journey_trigger so you use a real id instead of guessing.`,
|
|
1280
1476
|
schema: z.object({}),
|
|
@@ -1558,7 +1754,7 @@ export const letterTools = {
|
|
|
1558
1754
|
scope: z.enum(["person", "account"]).optional().describe("key event only: account = their company reached it."),
|
|
1559
1755
|
field_path: z.string().optional().describe("attribute only: dotted path, e.g. 'cart.valueCents' or 'plan'."),
|
|
1560
1756
|
operator: z
|
|
1561
|
-
.enum(["equals", "not_equals", "greater_than", "less_than", "in", "exists", "not_exists"])
|
|
1757
|
+
.enum(["equals", "not_equals", "contains", "greater_than", "less_than", "in", "exists", "not_exists"])
|
|
1562
1758
|
.optional()
|
|
1563
1759
|
.describe("attribute only."),
|
|
1564
1760
|
value: z
|
|
@@ -1890,7 +2086,7 @@ export const letterTools = {
|
|
|
1890
2086
|
}
|
|
1891
2087
|
if (!tenantOk(comm.workspaceKey))
|
|
1892
2088
|
return tenantMismatch();
|
|
1893
|
-
return { content: [{ type: "text", text: `${APEX} Created draft communication "${comm.title}" (id: ${comm.id}). Open it in the browser: ${appUrl(`/dashboard/communications/${comm.id}`)}\nEdit it
|
|
2089
|
+
return { content: [{ type: "text", text: `${APEX} Created draft communication "${comm.title}" (id: ${comm.id}). Open it in the browser: ${appUrl(`/dashboard/communications/${comm.id}`)}\nEdit it with edit_communication, publish it with publish_communication, then reference it from a journey send step.` }] };
|
|
1894
2090
|
}
|
|
1895
2091
|
catch (err) {
|
|
1896
2092
|
return { content: [{ type: "text", text: `${APEX} ${errMsg(err)}` }], isError: true };
|
|
@@ -2151,7 +2347,7 @@ export const letterTools = {
|
|
|
2151
2347
|
},
|
|
2152
2348
|
},
|
|
2153
2349
|
create_segment: {
|
|
2154
|
-
description: `${APEX} — Create a segment from friendly "conditions" (compiled server-side) OR a raw predicate. Conditions grammar: match all|any of groups; each group match all|any of conditions; each condition is an event ({verb:"has"|"hasnt", event, where?: [{field_path, operator:"equals"|"not_equals"|"in"|"exists"|"not_exists", value?}], at_least?, window_days?}), a key event ({verb:"has"|"hasnt", key_event_id, window_days?, scope?:"person"|"account"}; ids from list_key_events; window_days bounds the first time it was reached; scope "account" means their company reached it), or a trait ({attribute, op:"is"|"is_not"|"exists", value?}). Prefer a key event over the raw events behind it: it is what Attribution counts, conditions included. Use where on an event condition when filtering on specific event properties (e.g. page_view where ft_source_group equals ai_assistant). This is the same grammar the dashboard chip builder speaks.`,
|
|
2350
|
+
description: `${APEX} — Create a segment from friendly "conditions" (compiled server-side) OR a raw predicate. Conditions grammar: match all|any of groups; each group match all|any of conditions; each condition is an event ({verb:"has"|"hasnt", event, where?: [{field_path, operator:"equals"|"not_equals"|"in"|"exists"|"not_exists", value?}], at_least?, window_days?}), a key event ({verb:"has"|"hasnt", key_event_id, window_days?, scope?:"person"|"account"}; ids from list_key_events; window_days bounds the first time it was reached; scope "account" means their company reached it), a campaign source ({brought_by_campaign: "<campaign_id>"} — matches people brought by that Apex Campaign; journeys starting from this segment show up under the campaign's Followed up stage), or a trait ({attribute, op:"is"|"is_not"|"exists", value?}). Prefer a key event over the raw events behind it: it is what Attribution counts, conditions included. Use where on an event condition when filtering on specific event properties (e.g. page_view where ft_source_group equals ai_assistant). This is the same grammar the dashboard chip builder speaks.`,
|
|
2155
2351
|
schema: z.object({
|
|
2156
2352
|
name: z.string().describe("Segment name"),
|
|
2157
2353
|
description: z.string().optional(),
|