@apex-inc/mcp-server 0.74.0 → 0.78.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/dist/api-client.d.ts +13 -19
- package/dist/api-client.d.ts.map +1 -1
- package/dist/api-client.js +173 -59
- 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 +28 -0
- package/dist/hosted.d.ts.map +1 -0
- package/dist/hosted.js +56 -0
- package/dist/hosted.js.map +1 -0
- package/dist/index.js +40 -118
- package/dist/index.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 +38 -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 +18 -0
- package/dist/server-factory.d.ts.map +1 -0
- package/dist/server-factory.js +221 -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 +16 -5
- 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 +14 -0
- package/dist/tool-groups.js.map +1 -1
- package/dist/tool-shared.d.ts +2 -1
- package/dist/tool-shared.d.ts.map +1 -1
- package/dist/tool-shared.js +17 -2
- 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 +390 -0
- package/dist/tools/apex-campaigns.d.ts.map +1 -1
- package/dist/tools/apex-campaigns.js +253 -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 +88 -24
- package/dist/tools/experiments.js.map +1 -1
- package/dist/tools/letters.d.ts +423 -65
- package/dist/tools/letters.d.ts.map +1 -1
- package/dist/tools/letters.js +383 -42
- package/dist/tools/letters.js.map +1 -1
- package/dist/tools/measurement.d.ts +80 -38
- package/dist/tools/measurement.d.ts.map +1 -1
- package/dist/tools/measurement.js +151 -13
- package/dist/tools/measurement.js.map +1 -1
- package/dist/tools.d.ts +1047 -157
- 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 +1 -1
- package/skills/apex-spec/SKILL.md +6 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
3
|
-
import { join } from "node:path";
|
|
4
2
|
import { apiGet, apiPost, apiPatch, apiDelete, getActiveWorkspace, } from "../api-client.js";
|
|
3
|
+
import { LONG_REQUEST_TIMEOUT_MS } from "../fetch-timeout.js";
|
|
4
|
+
import { resolveLiveCheckFiles } from "../live-test-files.js";
|
|
5
5
|
import { resolveExperimentHypothesis } from "../experiment-copy.js";
|
|
6
6
|
import { activationLiveLine, shouldRefuseActivationWiring } from "../activation-wiring.js";
|
|
7
7
|
import { parseFrontDoorRefusal, renderFrontDoorRefusal } from "../belief-front-door.js";
|
|
8
8
|
import { apexBaseUrl } from "../base-url.js";
|
|
9
9
|
import { fetchLiveTestHits, formatLiveTestStop, isFileStop, isObjectStop, } from "../live-test-guard.js";
|
|
10
10
|
import { hasConflictAdvisory, renderConflictAdvisory, } from "../conflict-advisory.js";
|
|
11
|
-
import { APEX, controlPctOf, daysRunningOf, experimentTimingLabel, predictionLines, findVariant, missingScreenshotLines, formatArmLine, titleCaseEvent, assertTargetUrlForActiveWorkspace, errMsg, resolveCreateSurface, } from "../tool-shared.js";
|
|
11
|
+
import { appUrl, APEX, controlPctOf, daysRunningOf, experimentTimingLabel, predictionLines, findVariant, missingScreenshotLines, formatArmLine, titleCaseEvent, assertTargetUrlForActiveWorkspace, errMsg, resolveCreateSurface, } from "../tool-shared.js";
|
|
12
12
|
const STARTING_CONFIDENCE_HELP = "Leave unset. A new claim with no tests starts at 50% (untested) and moves only when a test concludes. Set it only when you can name the evidence (a past test or measured data), and say what it is.";
|
|
13
13
|
const NEW_BECAUSE_HELP = "Only after Apex returned related beliefs and the user said this is a different claim: one sentence on how it differs. Kept on the record.";
|
|
14
14
|
const NETWORK_WORD = {
|
|
@@ -1040,7 +1040,9 @@ export const experimentTools = {
|
|
|
1040
1040
|
}),
|
|
1041
1041
|
handler: async ({ experimentId }) => {
|
|
1042
1042
|
try {
|
|
1043
|
-
const res = await apiPost(`/api/experiments/${encodeURIComponent(experimentId)}/recapture`, {}
|
|
1043
|
+
const res = await apiPost(`/api/experiments/${encodeURIComponent(experimentId)}/recapture`, {}, {
|
|
1044
|
+
timeoutMs: LONG_REQUEST_TIMEOUT_MS,
|
|
1045
|
+
});
|
|
1044
1046
|
const { captured, errors, identical, message } = res.data;
|
|
1045
1047
|
const lines = [
|
|
1046
1048
|
`${APEX} Re-captured ${captured} screenshot${captured === 1 ? "" : "s"} for ${experimentId}.`,
|
|
@@ -1668,15 +1670,20 @@ export const experimentTools = {
|
|
|
1668
1670
|
},
|
|
1669
1671
|
},
|
|
1670
1672
|
list_beliefs: {
|
|
1671
|
-
description: `${APEX} — List the workspace's beliefs (the assumptions experiments test). Shows confidence, validation state, and AI-generated provenance so you can LINK an existing belief instead of minting a duplicate.`,
|
|
1673
|
+
description: `${APEX} — List the workspace's beliefs (the assumptions experiments test). Shows confidence, validation state, and AI-generated provenance so you can LINK an existing belief instead of minting a duplicate. Pass include_archived: true to include archived beliefs.`,
|
|
1672
1674
|
schema: z.object({
|
|
1673
1675
|
query: z
|
|
1674
1676
|
.string()
|
|
1675
1677
|
.optional()
|
|
1676
1678
|
.describe("Filter beliefs by a keyword in the statement"),
|
|
1679
|
+
includeArchived: z
|
|
1680
|
+
.boolean()
|
|
1681
|
+
.optional()
|
|
1682
|
+
.describe("Include archived beliefs (default false)."),
|
|
1677
1683
|
}),
|
|
1678
|
-
handler: async ({ query }) => {
|
|
1679
|
-
const
|
|
1684
|
+
handler: async ({ query, includeArchived }) => {
|
|
1685
|
+
const path = includeArchived ? "/api/beliefs?includeArchived=true" : "/api/beliefs";
|
|
1686
|
+
const beliefs = await apiGet(path);
|
|
1680
1687
|
const q = query?.toLowerCase().trim();
|
|
1681
1688
|
const filtered = q
|
|
1682
1689
|
? beliefs.filter((b) => b.statement.toLowerCase().includes(q))
|
|
@@ -1696,6 +1703,7 @@ export const experimentTools = {
|
|
|
1696
1703
|
.map((b) => {
|
|
1697
1704
|
const tags = [
|
|
1698
1705
|
`${Math.round(b.confidence * 100)}% confidence`,
|
|
1706
|
+
b.archivedAt ? "archived" : null,
|
|
1699
1707
|
b.validationState === "unvalidated" ? "unvalidated" : null,
|
|
1700
1708
|
b.generatedFromExperimentId ? "AI-generated" : null,
|
|
1701
1709
|
]
|
|
@@ -1713,7 +1721,7 @@ export const experimentTools = {
|
|
|
1713
1721
|
`${"═".repeat(40)}`,
|
|
1714
1722
|
lines,
|
|
1715
1723
|
``,
|
|
1716
|
-
`Link one to a new experiment with its id, or
|
|
1724
|
+
`Link one to a new experiment with its id, edit wording with update_belief, or retire an obsolete claim with archive_belief.`,
|
|
1717
1725
|
`If two of these state the same claim, merge them (merge_beliefs) so their evidence adds up in one place.`,
|
|
1718
1726
|
].join("\n"),
|
|
1719
1727
|
},
|
|
@@ -1721,6 +1729,65 @@ export const experimentTools = {
|
|
|
1721
1729
|
};
|
|
1722
1730
|
},
|
|
1723
1731
|
},
|
|
1732
|
+
update_belief: {
|
|
1733
|
+
description: `${APEX} — Edit a belief's statement in place (for example during a rebrand or to clarify wording). Preserves the belief's id, confidence, evidence, and linked experiments. Workspace admin.`,
|
|
1734
|
+
schema: z.object({
|
|
1735
|
+
beliefId: z.string().min(1).describe("The belief id to edit (from list_beliefs)."),
|
|
1736
|
+
statement: z.string().trim().min(1).max(2000).describe("The updated belief statement."),
|
|
1737
|
+
}),
|
|
1738
|
+
handler: async ({ beliefId, statement }) => {
|
|
1739
|
+
try {
|
|
1740
|
+
const res = await apiPatch(`/api/beliefs/${encodeURIComponent(beliefId)}`, { statement: statement.trim() });
|
|
1741
|
+
const updated = res.data;
|
|
1742
|
+
return {
|
|
1743
|
+
content: [
|
|
1744
|
+
{
|
|
1745
|
+
type: "text",
|
|
1746
|
+
text: [
|
|
1747
|
+
`${APEX} Belief updated (${updated?.id ?? beliefId})`,
|
|
1748
|
+
` Statement: "${updated?.statement ?? statement.trim()}"`,
|
|
1749
|
+
` Open Beliefs: ${appUrl("/dashboard/beliefs")}`,
|
|
1750
|
+
].join("\n"),
|
|
1751
|
+
},
|
|
1752
|
+
],
|
|
1753
|
+
};
|
|
1754
|
+
}
|
|
1755
|
+
catch (err) {
|
|
1756
|
+
return textError(`Could not update belief: ${errMsg(err)}`);
|
|
1757
|
+
}
|
|
1758
|
+
},
|
|
1759
|
+
},
|
|
1760
|
+
archive_belief: {
|
|
1761
|
+
description: `${APEX} — Archive (or restore) a belief so retired claims leave active lists and duplicate checks while keeping past experiment history intact. Refuses if an active experiment is currently testing this belief. Pass archived: false to restore an archived belief. Workspace admin.`,
|
|
1762
|
+
schema: z.object({
|
|
1763
|
+
beliefId: z.string().min(1).describe("The belief id to archive or restore (from list_beliefs)."),
|
|
1764
|
+
archived: z
|
|
1765
|
+
.boolean()
|
|
1766
|
+
.optional()
|
|
1767
|
+
.describe("true (default) to archive; false to restore an archived belief."),
|
|
1768
|
+
}),
|
|
1769
|
+
handler: async ({ beliefId, archived = true }) => {
|
|
1770
|
+
try {
|
|
1771
|
+
const res = await apiPatch(`/api/beliefs/${encodeURIComponent(beliefId)}`, { archived });
|
|
1772
|
+
const updated = res.data;
|
|
1773
|
+
return {
|
|
1774
|
+
content: [
|
|
1775
|
+
{
|
|
1776
|
+
type: "text",
|
|
1777
|
+
text: [
|
|
1778
|
+
`${APEX} Belief ${archived ? "archived" : "restored"} (${updated?.id ?? beliefId})`,
|
|
1779
|
+
` Statement: "${updated?.statement ?? beliefId}"`,
|
|
1780
|
+
` Open Beliefs: ${appUrl("/dashboard/beliefs")}`,
|
|
1781
|
+
].join("\n"),
|
|
1782
|
+
},
|
|
1783
|
+
],
|
|
1784
|
+
};
|
|
1785
|
+
}
|
|
1786
|
+
catch (err) {
|
|
1787
|
+
return textError(`Could not ${archived ? "archive" : "restore"} belief: ${errMsg(err)}`);
|
|
1788
|
+
}
|
|
1789
|
+
},
|
|
1790
|
+
},
|
|
1724
1791
|
merge_beliefs: {
|
|
1725
1792
|
description: `${APEX} — Merge a duplicate belief into the one that survives. Use when two beliefs state the same claim, so their evidence is split and neither confidence tells the truth. Moves the duplicate's evidence, hypotheses, predictions, outcomes, decision-log entries, child beliefs and linked tests onto the survivor, writes a decision-log entry naming what moved, and keeps the duplicate as a redirect (old ids still resolve; lists hide it). Not reversible from the tools. Show the user both statements and get their go-ahead before calling.`,
|
|
1726
1793
|
schema: z.object({
|
|
@@ -2057,6 +2124,7 @@ export const experimentTools = {
|
|
|
2057
2124
|
name: z.string().optional().describe("Rename (cosmetic; editable anytime)."),
|
|
2058
2125
|
surface: z.enum(["web", "mobile", "paid_channel"]).optional().describe("Correct the surface — editable only on a draft with 0 exposures (web↔mobile). 'paid_channel' is accepted only when the draft already carries its Ad holdout block."),
|
|
2059
2126
|
hypothesis: z.string().optional().describe("Edit the hypothesis — draft only (pre-registration)."),
|
|
2127
|
+
beliefId: z.string().min(1).optional().describe("Re-link a draft experiment to another belief id (from list_beliefs). Draft only."),
|
|
2060
2128
|
targetUrl: z.string().optional().describe("Retarget a DRAFT to a URL on the ACTIVE workspace. Same host rules as create_experiment."),
|
|
2061
2129
|
predictionId: z.string().optional().describe("Attach a minted prediction id (from log_prediction) to this draft. Also stamps the prediction onto the experiment's hypothesis when that link is missing. Required before activation."),
|
|
2062
2130
|
primaryMetricEvent: z.string().optional().describe("Change the primary metric's event — draft only. Same check as create_experiment: a standard Apex event, or any event this workspace receives or defined."),
|
|
@@ -2104,6 +2172,8 @@ export const experimentTools = {
|
|
|
2104
2172
|
body.surface = args.surface;
|
|
2105
2173
|
if (args.hypothesis !== undefined)
|
|
2106
2174
|
body.hypothesis = args.hypothesis;
|
|
2175
|
+
if (args.beliefId !== undefined)
|
|
2176
|
+
body.beliefId = args.beliefId.trim();
|
|
2107
2177
|
if (args.targetUrl !== undefined)
|
|
2108
2178
|
body.targetUrl = args.targetUrl;
|
|
2109
2179
|
if (args.predictionId !== undefined)
|
|
@@ -2263,13 +2333,17 @@ export const experimentTools = {
|
|
|
2263
2333
|
file_paths: z
|
|
2264
2334
|
.array(z.string())
|
|
2265
2335
|
.optional()
|
|
2266
|
-
.describe("Repo-relative paths you are about to edit or commit.
|
|
2336
|
+
.describe("Repo-relative or absolute paths you are about to edit or commit. When editing inside a git worktree or another checkout, pass file_contents (preferred), absolute paths, or repo_root so Apex reads the right copy."),
|
|
2267
2337
|
file_contents: z
|
|
2268
2338
|
.array(z.object({
|
|
2269
2339
|
path: z.string(),
|
|
2270
2340
|
content: z.string().describe("Full file at HEAD, not the diff hunk."),
|
|
2271
2341
|
}))
|
|
2272
2342
|
.optional(),
|
|
2343
|
+
repo_root: z
|
|
2344
|
+
.string()
|
|
2345
|
+
.optional()
|
|
2346
|
+
.describe("Absolute path to the repo or git worktree root you are editing. Resolves relative file_paths against this folder instead of the MCP process directory."),
|
|
2273
2347
|
urls: z
|
|
2274
2348
|
.array(z.string())
|
|
2275
2349
|
.optional()
|
|
@@ -2289,21 +2363,11 @@ export const experimentTools = {
|
|
|
2289
2363
|
}),
|
|
2290
2364
|
handler: async (args) => {
|
|
2291
2365
|
try {
|
|
2292
|
-
const
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
}
|
|
2297
|
-
for (const raw of args.file_paths ?? []) {
|
|
2298
|
-
if (!raw || byPath.has(raw))
|
|
2299
|
-
continue;
|
|
2300
|
-
const abs = raw.startsWith("/") ? raw : join(process.cwd(), raw);
|
|
2301
|
-
byPath.set(raw, {
|
|
2302
|
-
path: raw,
|
|
2303
|
-
content: existsSync(abs) ? readFileSync(abs, "utf8") : undefined,
|
|
2304
|
-
});
|
|
2305
|
-
}
|
|
2306
|
-
const files = [...byPath.values()];
|
|
2366
|
+
const files = resolveLiveCheckFiles({
|
|
2367
|
+
filePaths: args.file_paths,
|
|
2368
|
+
fileContents: args.file_contents,
|
|
2369
|
+
repoRoot: args.repo_root,
|
|
2370
|
+
});
|
|
2307
2371
|
const hits = await fetchLiveTestHits({
|
|
2308
2372
|
files,
|
|
2309
2373
|
urls: args.urls,
|