@apex-inc/mcp-server 0.22.1 → 0.23.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.
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Turn the control gate's 409s into instructions an agent can act on.
3
+ *
4
+ * Under the winner-is-the-control model, `PATCH /api/communications/:id`,
5
+ * publish, restore, and the variant routes all refuse a content change to a
6
+ * protected control until the caller says how to apply it. A raw
7
+ * `PATCH /api/communications/x failed (409): {"error":"intent_required",...}`
8
+ * is a dead end — the model sees a failure, not a fork in the road, and its
9
+ * usual recovery is to retry the identical call or give up.
10
+ *
11
+ * These helpers parse the structured body out of the thrown Error and render
12
+ * the two available moves, with the safe one named as the default. Kept pure
13
+ * and separate from tools.ts so they're unit-testable without importing the MCP
14
+ * SDK, following the experiment-copy.ts precedent.
15
+ */
16
+ export type ControlGateError = "comm_locked_for_experiment" | "intent_required" | "comm_already_in_experiment" | "ambiguous_experiment_host";
17
+ export interface ControlGateBody {
18
+ error: ControlGateError;
19
+ message?: string;
20
+ controlState?: string;
21
+ experiment?: {
22
+ id?: string;
23
+ name?: string;
24
+ };
25
+ /** `ambiguous_experiment_host` only: journeys that could host the experiment. */
26
+ candidates?: Array<{
27
+ journeyId?: string;
28
+ journeyName?: string;
29
+ stepId?: string;
30
+ }>;
31
+ }
32
+ /**
33
+ * Extract the control-gate body from a thrown api-client Error.
34
+ *
35
+ * The client throws `"<METHOD> <path> failed (409): <raw body>"`, so the JSON
36
+ * is embedded in the message rather than attached to the error. Returns null
37
+ * for anything that isn't a control-gate 409, so callers fall through to their
38
+ * existing error handling instead of mistranslating an unrelated failure.
39
+ */
40
+ export declare function parseControlGateError(err: unknown): ControlGateBody | null;
41
+ /**
42
+ * The guidance text for a parsed control-gate rejection.
43
+ *
44
+ * Always names both options and always names `compete` as the default. That
45
+ * asymmetry is deliberate and matches the server's message: guessing `replace`
46
+ * destroys a measured result permanently, guessing `compete` only costs the
47
+ * time it takes to run an experiment. A model with no strong signal should take
48
+ * the recoverable branch.
49
+ */
50
+ export declare function controlGateGuidance(body: ControlGateBody, ctx: {
51
+ toolName: string;
52
+ communicationId?: string;
53
+ }): string;
54
+ /**
55
+ * One-call wrapper: if `err` is a control-gate 409, return the guidance text;
56
+ * otherwise return null so the caller surfaces the original error verbatim.
57
+ */
58
+ export declare function controlGateGuidanceFor(err: unknown, ctx: {
59
+ toolName: string;
60
+ communicationId?: string;
61
+ }): string | null;
62
+ //# sourceMappingURL=control-gate-guidance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control-gate-guidance.d.ts","sourceRoot":"","sources":["../src/control-gate-guidance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,MAAM,gBAAgB,GACxB,4BAA4B,GAC5B,iBAAiB,GACjB,4BAA4B,GAC5B,2BAA2B,CAAC;AAEhC,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,gBAAgB,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,iFAAiF;IACjF,UAAU,CAAC,EAAE,KAAK,CAAC;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACnF;AASD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CAY1E;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,eAAe,EACrB,GAAG,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,eAAe,CAAC,EAAE,MAAM,CAAA;CAAE,GAClD,MAAM,CA6DR;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,eAAe,CAAC,EAAE,MAAM,CAAA;CAAE,GAClD,MAAM,GAAG,IAAI,CAGf"}
@@ -0,0 +1,119 @@
1
+ /**
2
+ * Turn the control gate's 409s into instructions an agent can act on.
3
+ *
4
+ * Under the winner-is-the-control model, `PATCH /api/communications/:id`,
5
+ * publish, restore, and the variant routes all refuse a content change to a
6
+ * protected control until the caller says how to apply it. A raw
7
+ * `PATCH /api/communications/x failed (409): {"error":"intent_required",...}`
8
+ * is a dead end — the model sees a failure, not a fork in the road, and its
9
+ * usual recovery is to retry the identical call or give up.
10
+ *
11
+ * These helpers parse the structured body out of the thrown Error and render
12
+ * the two available moves, with the safe one named as the default. Kept pure
13
+ * and separate from tools.ts so they're unit-testable without importing the MCP
14
+ * SDK, following the experiment-copy.ts precedent.
15
+ */
16
+ const GATE_ERRORS = new Set([
17
+ "comm_locked_for_experiment",
18
+ "intent_required",
19
+ "comm_already_in_experiment",
20
+ "ambiguous_experiment_host",
21
+ ]);
22
+ /**
23
+ * Extract the control-gate body from a thrown api-client Error.
24
+ *
25
+ * The client throws `"<METHOD> <path> failed (409): <raw body>"`, so the JSON
26
+ * is embedded in the message rather than attached to the error. Returns null
27
+ * for anything that isn't a control-gate 409, so callers fall through to their
28
+ * existing error handling instead of mistranslating an unrelated failure.
29
+ */
30
+ export function parseControlGateError(err) {
31
+ const message = err instanceof Error ? err.message : String(err ?? "");
32
+ if (!message.includes("(409)"))
33
+ return null;
34
+ const start = message.indexOf("{");
35
+ if (start === -1)
36
+ return null;
37
+ try {
38
+ const parsed = JSON.parse(message.slice(start));
39
+ if (!parsed.error || !GATE_ERRORS.has(parsed.error))
40
+ return null;
41
+ return parsed;
42
+ }
43
+ catch {
44
+ return null;
45
+ }
46
+ }
47
+ /**
48
+ * The guidance text for a parsed control-gate rejection.
49
+ *
50
+ * Always names both options and always names `compete` as the default. That
51
+ * asymmetry is deliberate and matches the server's message: guessing `replace`
52
+ * destroys a measured result permanently, guessing `compete` only costs the
53
+ * time it takes to run an experiment. A model with no strong signal should take
54
+ * the recoverable branch.
55
+ */
56
+ export function controlGateGuidance(body, ctx) {
57
+ const retry = ctx.communicationId
58
+ ? `${ctx.toolName} with communication_id: "${ctx.communicationId}"`
59
+ : ctx.toolName;
60
+ switch (body.error) {
61
+ case "intent_required":
62
+ return [
63
+ body.message ??
64
+ "This communication's control is protected: it won an experiment, or a published journey is sending it.",
65
+ "",
66
+ "Two ways forward. Ask the user which they want, then re-issue:",
67
+ ` • Add as a variant — re-issue ${retry}, intent: "compete". The current content keeps sending and your edit runs against it as an experiment.`,
68
+ ` • Update for everyone — re-issue ${retry}, intent: "replace". Your edit becomes what everyone receives and any prior win is superseded.`,
69
+ "",
70
+ 'If the user has not expressed a preference, choose "compete". It keeps the current content live and measures the change, so nothing is lost either way. "replace" discards a measured result permanently.',
71
+ ].join("\n");
72
+ case "comm_locked_for_experiment": {
73
+ const name = body.experiment?.name ?? "a running experiment";
74
+ return [
75
+ body.message ??
76
+ `This communication is the treatment in ${name}, so its content is frozen while the experiment measures it.`,
77
+ "",
78
+ "Do NOT force this by default. Options, best first:",
79
+ ` • Wait for ${name} to finish, then edit. The result stays valid.`,
80
+ " • End the experiment now (conclude_experiment or promote_winner), then edit.",
81
+ ` • Edit anyway — re-issue ${retry}, confirm_live_experiment: true. This marks ${name} invalid and excludes its result from the belief graph. Only do this if the user explicitly accepts losing the experiment.`,
82
+ ].join("\n");
83
+ }
84
+ case "comm_already_in_experiment": {
85
+ const name = body.experiment?.name ?? "another experiment";
86
+ return [
87
+ body.message ??
88
+ `${name} is already running on this communication.`,
89
+ "",
90
+ "A communication hosts one experiment at a time, so there is always a single answer to what won. End the existing experiment first (conclude_experiment or promote_winner), then start this one.",
91
+ ].join("\n");
92
+ }
93
+ case "ambiguous_experiment_host": {
94
+ const lines = (body.candidates ?? []).map((c) => ` • ${c.journeyName ?? c.journeyId ?? "unknown journey"}` +
95
+ (c.journeyId ? ` (journey_id: "${c.journeyId}")` : "") +
96
+ (c.stepId ? `, step_id: "${c.stepId}"` : ""));
97
+ return [
98
+ body.message ??
99
+ "More than one published journey sends this communication, so Apex can't tell where the experiment should run.",
100
+ "",
101
+ lines.length ? "Candidates:" : "No candidates were returned.",
102
+ ...lines,
103
+ "",
104
+ "Ask the user which journey should host the experiment, then re-issue with that journey_id.",
105
+ ]
106
+ .filter(Boolean)
107
+ .join("\n");
108
+ }
109
+ }
110
+ }
111
+ /**
112
+ * One-call wrapper: if `err` is a control-gate 409, return the guidance text;
113
+ * otherwise return null so the caller surfaces the original error verbatim.
114
+ */
115
+ export function controlGateGuidanceFor(err, ctx) {
116
+ const body = parseControlGateError(err);
117
+ return body ? controlGateGuidance(body, ctx) : null;
118
+ }
119
+ //# sourceMappingURL=control-gate-guidance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control-gate-guidance.js","sourceRoot":"","sources":["../src/control-gate-guidance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAiBH,MAAM,WAAW,GAAG,IAAI,GAAG,CAAS;IAClC,4BAA4B;IAC5B,iBAAiB;IACjB,4BAA4B;IAC5B,2BAA2B;CAC5B,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CAAC,GAAY;IAChD,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC;IACvE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO,IAAI,CAAC;IAC5C,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACnC,IAAI,KAAK,KAAK,CAAC,CAAC;QAAE,OAAO,IAA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.ts CHANGED
@@ -1377,18 +1377,24 @@ export declare const toolDefinitions: {
1377
1377
  slots: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1378
1378
  channels: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1379
1379
  status: z.ZodOptional<z.ZodEnum<["draft", "active", "paused"]>>;
1380
+ intent: z.ZodOptional<z.ZodEnum<["compete", "replace"]>>;
1381
+ confirmLiveExperiment: z.ZodOptional<z.ZodBoolean>;
1380
1382
  }, "strip", z.ZodTypeAny, {
1381
1383
  communicationId: string;
1382
1384
  status?: "draft" | "paused" | "active" | undefined;
1383
1385
  subject?: string | undefined;
1384
1386
  slots?: Record<string, string> | undefined;
1385
1387
  channels?: string[] | undefined;
1388
+ intent?: "replace" | "compete" | undefined;
1389
+ confirmLiveExperiment?: boolean | undefined;
1386
1390
  }, {
1387
1391
  communicationId: string;
1388
1392
  status?: "draft" | "paused" | "active" | undefined;
1389
1393
  subject?: string | undefined;
1390
1394
  slots?: Record<string, string> | undefined;
1391
1395
  channels?: string[] | undefined;
1396
+ intent?: "replace" | "compete" | undefined;
1397
+ confirmLiveExperiment?: boolean | undefined;
1392
1398
  }>;
1393
1399
  handler: (args: {
1394
1400
  communicationId: string;
@@ -1396,11 +1402,57 @@ export declare const toolDefinitions: {
1396
1402
  slots?: Record<string, string>;
1397
1403
  channels?: string[];
1398
1404
  status?: string;
1405
+ intent?: "compete" | "replace";
1406
+ confirmLiveExperiment?: boolean;
1399
1407
  }) => Promise<{
1400
1408
  content: {
1401
1409
  type: "text";
1402
1410
  text: string;
1403
1411
  }[];
1412
+ isError?: undefined;
1413
+ } | {
1414
+ content: {
1415
+ type: "text";
1416
+ text: string;
1417
+ }[];
1418
+ isError: boolean;
1419
+ }>;
1420
+ };
1421
+ publish_communication: {
1422
+ description: string;
1423
+ schema: z.ZodObject<{
1424
+ communicationId: z.ZodString;
1425
+ intent: z.ZodOptional<z.ZodEnum<["compete", "replace"]>>;
1426
+ confirmLiveExperiment: z.ZodOptional<z.ZodBoolean>;
1427
+ hostJourneyId: z.ZodOptional<z.ZodString>;
1428
+ }, "strip", z.ZodTypeAny, {
1429
+ communicationId: string;
1430
+ intent?: "replace" | "compete" | undefined;
1431
+ confirmLiveExperiment?: boolean | undefined;
1432
+ hostJourneyId?: string | undefined;
1433
+ }, {
1434
+ communicationId: string;
1435
+ intent?: "replace" | "compete" | undefined;
1436
+ confirmLiveExperiment?: boolean | undefined;
1437
+ hostJourneyId?: string | undefined;
1438
+ }>;
1439
+ handler: (args: {
1440
+ communicationId: string;
1441
+ intent?: "compete" | "replace";
1442
+ confirmLiveExperiment?: boolean;
1443
+ hostJourneyId?: string;
1444
+ }) => Promise<{
1445
+ content: {
1446
+ type: "text";
1447
+ text: string;
1448
+ }[];
1449
+ isError?: undefined;
1450
+ } | {
1451
+ content: {
1452
+ type: "text";
1453
+ text: string;
1454
+ }[];
1455
+ isError: boolean;
1404
1456
  }>;
1405
1457
  };
1406
1458
  preview_communication: {
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAwaxB,iBAAe,sBAAsB,CAAC,IAAI,EAAE;IAAE,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;GA6CzF;AAED;;;;GAIG;AACH,iBAAe,qBAAqB;;;;;GAwBnC;AAED,eAAO,MAAM,eAAe;;;;;;;;;;;;;uCAQa;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,SAAS,CAAC,EAAE,MAAM,CAAA;SAAE;;;;;;;;;;;;;;;;;;;;;;oDAqFvB;YAAE,QAAQ,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,CAAA;SAAE;;;;;;;;;;;;;;;;;;;;;;6DA6C/C;YAAE,SAAS,EAAE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;;;;;;;wBAc/B;YAAE,UAAU,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,WAAW,GAAG,KAAK,CAAA;SAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAqCnD;YACpB,IAAI,EAAE,MAAM,CAAC;YACb,WAAW,CAAC,EAAE,MAAM,CAAC;YACrB,KAAK,CAAC,EAAE,WAAW,GAAG,KAAK,CAAC;YAC5B,UAAU,CAAC,EAAE,OAAO,CAAC;YACrB,SAAS,CAAC,EAAE,OAAO,CAAC;SACrB;;;;;;;CAcJ,CAAC"}
package/dist/tools.js CHANGED
@@ -3,6 +3,7 @@ import { existsSync, readFileSync } from "node:fs";
3
3
  import { join, dirname } from "node:path";
4
4
  import { apiGet, apiPost, apiPatch, apiDelete, postWithIdempotency, setActiveWorkspace, getActiveWorkspace, setActiveOrg, getActiveOrg, getUserContext } from "./api-client.js";
5
5
  import { resolveExperimentHypothesis } from "./experiment-copy.js";
6
+ import { controlGateGuidanceFor } from "./control-gate-guidance.js";
6
7
  const APEX = "∧ Apex";
7
8
  /**
8
9
  * MOBX-006 — stable synthetic visitor id for agent-fired events.
@@ -79,6 +80,28 @@ function appUrl(path) {
79
80
  const base = process.env.APEX_URL || process.env.APEX_API_URL || "http://localhost:3001";
80
81
  return `${base.replace(/\/$/, "")}${path}`;
81
82
  }
83
+ /**
84
+ * Why publishing a comm with variants didn't start an experiment.
85
+ *
86
+ * Each of these is a missing precondition the user can actually fix, so the
87
+ * agent is told what to do rather than that "nothing happened."
88
+ */
89
+ function notStartedExplanation(reason) {
90
+ switch (reason) {
91
+ case "no_host":
92
+ return "The variants were published but no experiment started: no published journey sends this communication, so there's no traffic to measure. Add it to a journey and publish that journey.";
93
+ case "no_goal":
94
+ return "The variants were published but no experiment started: the journey sending this communication has no goal event, so there's nothing to optimize toward. Set the journey's goal event first.";
95
+ case "ambiguous_host":
96
+ return "The variants were published but no experiment started: more than one published journey sends this communication. Re-issue publish_communication with host_journey_id.";
97
+ case "conflict":
98
+ return "The variants were published but no experiment started: another experiment already holds this communication. End it, then publish again.";
99
+ case "no_variants":
100
+ return "";
101
+ default:
102
+ return "The variants were published but the experiment could not be started. Check the communication in the dashboard.";
103
+ }
104
+ }
82
105
  function journeyLink(id) {
83
106
  return appUrl(`/dashboard/communications/journeys/${id}`);
84
107
  }
@@ -2916,7 +2939,7 @@ Events fired through this tool carry a stable synthetic visitorId (mcp-agent-*,
2916
2939
  },
2917
2940
  },
2918
2941
  list_communications: {
2919
- description: "List the workspace's communication templates (email / inbox / web push / mobile push) with the fields you need to CHOOSE one — for a journey send step, a broadcast, or a transactional send. Returns per template: title, version, status, pipeline, channels, subject, and a one-line body preview so you can disambiguate similar titles without opening each one. Pipeline is 'transactional' (bypasses opt-out — needs a recipient-initiated trigger) or 'marketing' (consent-gated). Filter by pipeline, channel, or a search string. This is the programmatic equivalent of the dashboard's communication picker.",
2942
+ description: "List the workspace's communication templates (email / inbox / web push / mobile push) with the fields you need to CHOOSE one — for a journey send step, a broadcast, or a transactional send. Returns per template: title, version, status, pipeline, channels, subject, a one-line body preview so you can disambiguate similar titles without opening each one, and controlState. Pipeline is 'transactional' (bypasses opt-out — needs a recipient-initiated trigger) or 'marketing' (consent-gated). Filter by pipeline, channel, or a search string. This is the programmatic equivalent of the dashboard's communication picker.\n\ncontrolState tells you what the Control currently IS, and therefore what editing it will cost: 'winner' (won an experiment, unedited — editing needs an explicit intent), 'winner_edited' (won, then changed since), 'in_experiment' (frozen, an experiment is measuring it right now), 'no_winner' (an experiment ran and settled without one), 'none' (never experimented on, edit freely).",
2920
2943
  schema: z.object({
2921
2944
  pipeline: z
2922
2945
  .enum(["transactional", "marketing"])
@@ -2960,6 +2983,7 @@ Events fired through this tool carry a stable synthetic visitorId (mcp-agent-*,
2960
2983
  : ["email"],
2961
2984
  subject: typeof content.subject === "string" ? content.subject : "",
2962
2985
  bodyPreview: String(bodyPreview),
2986
+ controlState: typeof comm.controlState === "string" ? comm.controlState : "none",
2963
2987
  triggerEventId: typeof comm.triggerEventId === "string"
2964
2988
  ? comm.triggerEventId
2965
2989
  : "",
@@ -2988,7 +3012,10 @@ Events fired through this tool carry a stable synthetic visitorId (mcp-agent-*,
2988
3012
  const preview = r.bodyPreview
2989
3013
  ? `\n ${r.bodyPreview.slice(0, 120)}`
2990
3014
  : "";
2991
- return `• ${r.title} (v${r.version}) ${r.pipeline} ${r.channels.join("/")} — ${r.status}\n subject: ${r.subject || "(none)"}${preview}\n id: ${r.id}`;
3015
+ const control = r.controlState && r.controlState !== "none"
3016
+ ? ` — control: ${r.controlState}`
3017
+ : "";
3018
+ return `• ${r.title} (v${r.version}) — ${r.pipeline} — ${r.channels.join("/")} — ${r.status}${control}\n subject: ${r.subject || "(none)"}${preview}\n id: ${r.id}`;
2992
3019
  })
2993
3020
  .join("\n\n");
2994
3021
  return {
@@ -3002,13 +3029,21 @@ Events fired through this tool carry a stable synthetic visitorId (mcp-agent-*,
3002
3029
  },
3003
3030
  },
3004
3031
  edit_communication: {
3005
- description: "Update a communication's subject, body, CTA, channels, or status. Pass the communication ID and the fields to update. For blank/builder comms, the headline/body/ctaLabel/ctaUrl slots are synced into the rendered email body — verify with preview_communication.",
3032
+ description: "Update a communication's subject, body, CTA, channels, or status. Pass the communication ID and the fields to update. For blank/builder comms, the headline/body/ctaLabel/ctaUrl slots are synced into the rendered email body — verify with preview_communication.\n\nA communication's Control is protected when it won an experiment or a published journey is sending it. Editing it then requires `intent`: \"compete\" adds your edit as a variant and measures it against the current content (nothing changes for recipients yet); \"replace\" makes your edit what everyone receives and supersedes any prior win. WHEN IN DOUBT, USE \"compete\" — it is recoverable, \"replace\" discards a measured result permanently. The server returns 409 intent_required with both options if you omit it.",
3006
3033
  schema: z.object({
3007
3034
  communicationId: z.string().describe("The communication ID to update"),
3008
3035
  subject: z.string().optional().describe("New email subject line"),
3009
3036
  slots: z.record(z.string()).optional().describe("Content overrides: headline, body, ctaLabel, ctaUrl. These now sync into the rendered email body (not just metadata)."),
3010
3037
  channels: z.array(z.string()).optional().describe("Channels: email, in_app_push, mobile_push"),
3011
3038
  status: z.enum(["draft", "active", "paused"]).optional().describe("Communication status"),
3039
+ intent: z
3040
+ .enum(["compete", "replace"])
3041
+ .optional()
3042
+ .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.'),
3043
+ confirmLiveExperiment: z
3044
+ .boolean()
3045
+ .optional()
3046
+ .describe("Edit a communication that is the treatment in a RUNNING experiment. This marks that experiment invalid and excludes its result from the belief graph. Only pass true when the user has explicitly accepted losing the experiment."),
3012
3047
  }),
3013
3048
  handler: async (args) => {
3014
3049
  const body = {};
@@ -3016,6 +3051,10 @@ Events fired through this tool carry a stable synthetic visitorId (mcp-agent-*,
3016
3051
  body.status = args.status;
3017
3052
  if (args.channels)
3018
3053
  body.channels = args.channels;
3054
+ if (args.intent)
3055
+ body.intent = args.intent;
3056
+ if (args.confirmLiveExperiment)
3057
+ body.confirmLiveExperiment = true;
3019
3058
  const content = {};
3020
3059
  if (args.subject)
3021
3060
  content.subject = args.subject;
@@ -3023,8 +3062,94 @@ Events fired through this tool carry a stable synthetic visitorId (mcp-agent-*,
3023
3062
  content.slots = args.slots;
3024
3063
  if (Object.keys(content).length)
3025
3064
  body.content = content;
3026
- const data = await apiPatch(`/api/communications/${args.communicationId}`, body);
3027
- return { content: [{ type: "text", text: `Communication updated.\n\n${JSON.stringify(data, null, 2)}` }] };
3065
+ try {
3066
+ const data = await apiPatch(`/api/communications/${args.communicationId}`, body);
3067
+ // The comm may be protected without the edit being blocked (draft saves
3068
+ // defer the question to publish). Carry the server's advisory through
3069
+ // so the agent knows a decision is coming rather than meeting it later.
3070
+ const advisory = typeof data?.controlAdvisory === "string"
3071
+ ? `\n\n${data.controlAdvisory}`
3072
+ : "";
3073
+ return { content: [{ type: "text", text: `Communication updated.${advisory}\n\n${JSON.stringify(data, null, 2)}` }] };
3074
+ }
3075
+ catch (err) {
3076
+ const guidance = controlGateGuidanceFor(err, {
3077
+ toolName: "edit_communication",
3078
+ communicationId: args.communicationId,
3079
+ });
3080
+ return {
3081
+ content: [
3082
+ {
3083
+ type: "text",
3084
+ text: guidance ?? `${APEX} ${err instanceof Error ? err.message : String(err)}`,
3085
+ },
3086
+ ],
3087
+ isError: true,
3088
+ };
3089
+ }
3090
+ },
3091
+ },
3092
+ publish_communication: {
3093
+ description: "Publish a communication's draft as the live version — this is what makes an edit reach recipients. Editing only saves a draft.\n\nIf the communication has variants, publishing STARTS the experiment that measures them against the control. That is the point of authoring a variant: a variant that is never published is measured by nothing.\n\nTwo conflicts need a decision rather than a retry. `ambiguous_experiment_host` means several published journeys send this communication, so Apex cannot tell where the experiment belongs — the candidates are returned; ask the user and re-issue with host_journey_id. `comm_already_in_experiment` means one is already running; end it first.",
3094
+ schema: z.object({
3095
+ communicationId: z.string().describe("The communication ID to publish"),
3096
+ intent: z
3097
+ .enum(["compete", "replace"])
3098
+ .optional()
3099
+ .describe('How to apply the draft when the Control is protected. "compete" = the current content keeps sending and your draft runs against it as an experiment (safe default). "replace" = your draft becomes what everyone receives, superseding any prior win. Required only when the comm won an experiment or is live in a published journey.'),
3100
+ confirmLiveExperiment: z
3101
+ .boolean()
3102
+ .optional()
3103
+ .describe("Publish over a communication that is the treatment in a RUNNING experiment. Marks that experiment invalid and excludes its result from the belief graph. Only pass true when the user has explicitly accepted losing the experiment."),
3104
+ hostJourneyId: z
3105
+ .string()
3106
+ .optional()
3107
+ .describe("Which published journey hosts the experiment. Only needed after a 409 ambiguous_experiment_host, using one of the returned candidate ids."),
3108
+ }),
3109
+ handler: async (args) => {
3110
+ const body = {};
3111
+ if (args.intent)
3112
+ body.intent = args.intent;
3113
+ if (args.confirmLiveExperiment)
3114
+ body.confirmLiveExperiment = true;
3115
+ if (args.hostJourneyId)
3116
+ body.hostJourneyId = args.hostJourneyId;
3117
+ try {
3118
+ const data = await apiPost(`/api/communications/${args.communicationId}/publish`, body);
3119
+ const lines = [];
3120
+ if (data.published === false) {
3121
+ lines.push("Nothing to publish — no unpublished changes.");
3122
+ }
3123
+ else {
3124
+ lines.push(`Published version ${data.version ?? "?"}.`);
3125
+ }
3126
+ if (data.repinned?.length) {
3127
+ lines.push(`${data.repinned.length} send step(s) moved to the new version.`);
3128
+ }
3129
+ if (data.experiment) {
3130
+ lines.push(`Experiment started: ${data.experiment.id}. Watch it at ${appUrl(`/dashboard/experiments/${data.experiment.id}`)}`);
3131
+ }
3132
+ else if (data.experimentNotStarted) {
3133
+ lines.push(notStartedExplanation(data.experimentNotStarted));
3134
+ }
3135
+ return { content: [{ type: "text", text: lines.join("\n") }] };
3136
+ }
3137
+ catch (err) {
3138
+ const guidance = controlGateGuidanceFor(err, {
3139
+ toolName: "publish_communication",
3140
+ communicationId: args.communicationId,
3141
+ });
3142
+ return {
3143
+ content: [
3144
+ {
3145
+ type: "text",
3146
+ text: guidance ??
3147
+ `${APEX} ${err instanceof Error ? err.message : String(err)}`,
3148
+ },
3149
+ ],
3150
+ isError: true,
3151
+ };
3152
+ }
3028
3153
  },
3029
3154
  },
3030
3155
  preview_communication: {
@@ -4657,7 +4782,10 @@ _Suggest the next step the user should tackle based on what's incomplete in the
4657
4782
  content: [{ type: "text", text: `No engineering links for experiment ${experimentId}.` }],
4658
4783
  };
4659
4784
  }
4660
- const lines = links.map((l) => `- ${l.system} ${l.kind} ${l.repo ?? ""}#${l.externalId}${l.state ? ` (${l.state})` : ""}${l.title ? ` — ${l.title}` : ""}\n ${l.url}`);
4785
+ // Surface the link id it is the required `engineering_link_id` input to
4786
+ // gate_experiment_on_merge. Without it the merge gate can't be armed
4787
+ // through MCP alone (staging dogfood gap 2026-07-16).
4788
+ const lines = links.map((l) => `- ${l.system} ${l.kind} ${l.repo ?? ""}#${l.externalId}${l.state ? ` (${l.state})` : ""}${l.title ? ` — ${l.title}` : ""}\n ${l.url}\n link id: ${l.id}`);
4661
4789
  return {
4662
4790
  content: [
4663
4791
  { type: "text", text: `# Engineering links — ${experimentId}\n\n${lines.join("\n")}` },