@sentientui/mcp 0.28.0 → 0.29.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/AGENTS.md +1 -1
- package/README.md +1 -1
- package/dist/{chunk-Q7RW5Q4X.js → chunk-X6MTB6FY.js} +38 -17
- package/dist/index.cjs +38 -17
- package/dist/index.js +1 -1
- package/dist/lib.cjs +38 -17
- package/dist/lib.js +1 -1
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -58,7 +58,7 @@ Visits marked **internal** still see your versions — so QA on staging keeps wo
|
|
|
58
58
|
- **Browser link** — `https://<site>/?sentient_internal=<token>` opened once marks that browser; `?sentient_internal=off` stops it. Rotating the link un-marks every browser.
|
|
59
59
|
- **Code flag** — `<AdaptiveRoot internal={…}>` / `<AdaptiveProvider internal>`, `init({ internal })` in `@sentientui/core`, or `window.sentient.internal` (a boolean, or a function read once at start-up). Example: `internal={user.email.endsWith('@example.com')}` — the email never leaves the site.
|
|
60
60
|
|
|
61
|
-
It applies from when it is turned on: earlier visits can't be separated, because which site a visit came from was not recorded before. A visit marked internal after it already trained (a late identify, a rule added later) drops out of every report on the next read but is not untrained. There is no report filter or IP rule. `get_internal_traffic_rules` reads the rules
|
|
61
|
+
It applies from when it is turned on: earlier visits can't be separated, because which site a visit came from was not recorded before. A visit marked internal after it already trained (a late identify, a rule added later) drops out of every report on the next read but is not untrained. There is no report filter or IP rule. `get_internal_traffic_rules` reads the rules; `manage_settings` changes them (`set_internal_sites`, `add_internal_email`, `remove_internal_email`) when the project's Agent access allows Project settings.
|
|
62
62
|
|
|
63
63
|
## Auth
|
|
64
64
|
|
package/README.md
CHANGED
|
@@ -165,7 +165,7 @@ Visits marked **internal** still see your versions — so QA on staging keeps wo
|
|
|
165
165
|
- **Browser link** — `https://<site>/?sentient_internal=<token>` opened once marks that browser; `?sentient_internal=off` stops it. Rotating the link un-marks every browser.
|
|
166
166
|
- **Code flag** — `<AdaptiveRoot internal={…}>` / `<AdaptiveProvider internal>`, `init({ internal })` in `@sentientui/core`, or `window.sentient.internal` (a boolean, or a function read once at start-up). Example: `internal={user.email.endsWith('@example.com')}` — the email never leaves the site.
|
|
167
167
|
|
|
168
|
-
It applies from when it is turned on: earlier visits can't be separated, because which site a visit came from was not recorded before. A visit marked internal after it already trained (a late identify, a rule added later) drops out of every report on the next read but is not untrained. There is no report filter or IP rule. `get_internal_traffic_rules` reads the rules
|
|
168
|
+
It applies from when it is turned on: earlier visits can't be separated, because which site a visit came from was not recorded before. A visit marked internal after it already trained (a late identify, a rule added later) drops out of every report on the next read but is not untrained. There is no report filter or IP rule. `get_internal_traffic_rules` reads the rules; `manage_settings` changes them (`set_internal_sites`, `add_internal_email`, `remove_internal_email`) when the project's Agent access allows Project settings.
|
|
169
169
|
|
|
170
170
|
## Example prompts
|
|
171
171
|
|
|
@@ -870,7 +870,7 @@ var regionOutputSchema = z3.array(
|
|
|
870
870
|
versions: z3.array(
|
|
871
871
|
z3.object({
|
|
872
872
|
versionId: z3.string().describe("The served arm id: baseline = the original, authored.<key> = a version written in code, anything else = generated or edited in the dashboard"),
|
|
873
|
-
source: z3.enum(["original", "code", "generated"]),
|
|
873
|
+
source: z3.enum(["original", "code", "generated", "written"]).describe("written = by a person in the dashboard or the on-site editor"),
|
|
874
874
|
timesShown: z3.number().describe("All-time times shown \u2014 the optimizer's own totals, NOT filtered by the requested window"),
|
|
875
875
|
conversions: z3.number().describe("All-time conversions credited to this version (optimizer totals)"),
|
|
876
876
|
conversionRate: z3.number().nullable().describe("conversions / timesShown; null at 0 shown"),
|
|
@@ -886,12 +886,16 @@ var regionOutputSchema = z3.array(
|
|
|
886
886
|
)
|
|
887
887
|
})
|
|
888
888
|
).describe("Regions: components served per visitor through Who sees what \u2014 versions written in code next to the original, or generated ones");
|
|
889
|
-
function sourceOf(arm, baselineArm) {
|
|
889
|
+
function sourceOf(arm, baselineArm, known) {
|
|
890
|
+
if (known === "original" || known === "generated") return known;
|
|
891
|
+
if (known === "authored") return "code";
|
|
892
|
+
if (known === "manual") return "written";
|
|
893
|
+
if (known === "suggested") return "generated";
|
|
890
894
|
if (arm === baselineArm) return "original";
|
|
891
895
|
if (arm.startsWith("authored.")) return "code";
|
|
892
896
|
return "generated";
|
|
893
897
|
}
|
|
894
|
-
function regionsFrom(body) {
|
|
898
|
+
function regionsFrom(body, sources) {
|
|
895
899
|
var _a, _b;
|
|
896
900
|
const totals = new Map(((_a = body == null ? void 0 : body.window_totals) != null ? _a : []).map((t) => [t.slotId, t]));
|
|
897
901
|
return ((_b = body == null ? void 0 : body.slots) != null ? _b : []).map((s) => {
|
|
@@ -899,16 +903,16 @@ function regionsFrom(body) {
|
|
|
899
903
|
const baselineArm = (_a2 = s.baselineArm) != null ? _a2 : "baseline";
|
|
900
904
|
const t = totals.get(s.slotId);
|
|
901
905
|
const versions = ((_b2 = s.arms) != null ? _b2 : []).map((a2) => {
|
|
902
|
-
var _a3, _b3, _c;
|
|
906
|
+
var _a3, _b3, _c, _d;
|
|
903
907
|
const shown = (_a3 = a2.timesShown) != null ? _a3 : 0;
|
|
904
908
|
const conv = (_b3 = a2.conversions) != null ? _b3 : 0;
|
|
905
909
|
return {
|
|
906
910
|
versionId: a2.arm,
|
|
907
|
-
source: sourceOf(a2.arm, baselineArm),
|
|
911
|
+
source: sourceOf(a2.arm, baselineArm, (_c = sources == null ? void 0 : sources.get(s.slotId)) == null ? void 0 : _c.get(a2.arm)),
|
|
908
912
|
timesShown: shown,
|
|
909
913
|
conversions: conv,
|
|
910
914
|
conversionRate: shown > 0 ? conv / shown : null,
|
|
911
|
-
evidence: ((
|
|
915
|
+
evidence: ((_d = a2.personas) != null ? _d : []).map((p) => {
|
|
912
916
|
var _a4, _b4, _c2;
|
|
913
917
|
return {
|
|
914
918
|
audience: (_a4 = p.personaDisplay) != null ? _a4 : p.persona,
|
|
@@ -919,7 +923,7 @@ function regionsFrom(body) {
|
|
|
919
923
|
})
|
|
920
924
|
};
|
|
921
925
|
});
|
|
922
|
-
const rank = { original: 0, code: 1,
|
|
926
|
+
const rank = { original: 0, code: 1, written: 2, generated: 3 };
|
|
923
927
|
versions.sort((x, y) => rank[x.source] - rank[y.source] || x.versionId.localeCompare(y.versionId));
|
|
924
928
|
return {
|
|
925
929
|
componentId: s.slotId,
|
|
@@ -930,10 +934,21 @@ function regionsFrom(body) {
|
|
|
930
934
|
});
|
|
931
935
|
}
|
|
932
936
|
async function fetchRegions(client, projectId, rangeArgs) {
|
|
933
|
-
|
|
934
|
-
|
|
937
|
+
var _a, _b;
|
|
938
|
+
const id = encodeURIComponent(projectId);
|
|
939
|
+
const [body, defs] = await Promise.all([
|
|
940
|
+
client.get(`/projects/${id}/slots${rangeQuery(rangeArgs)}`),
|
|
941
|
+
// Sources are a label: without them the arm-id rule still answers.
|
|
942
|
+
client.get(`/projects/${id}/slot-definitions`).catch(() => null)
|
|
943
|
+
]);
|
|
944
|
+
const sources = /* @__PURE__ */ new Map();
|
|
945
|
+
for (const d of (_a = defs == null ? void 0 : defs.slots) != null ? _a : []) {
|
|
946
|
+
if (typeof d.slot_id !== "string") continue;
|
|
947
|
+
sources.set(d.slot_id, new Map(((_b = d.arms) != null ? _b : []).filter((a2) => typeof a2.id === "string" && typeof a2.source === "string").map((a2) => [a2.id, a2.source])));
|
|
948
|
+
}
|
|
949
|
+
return regionsFrom(body, sources);
|
|
935
950
|
}
|
|
936
|
-
var SOURCE_LABEL = { original: "original", code: "written in code", generated: "generated" };
|
|
951
|
+
var SOURCE_LABEL = { original: "original", code: "written in code", generated: "generated", written: "written by a person" };
|
|
937
952
|
function regionText(r, untrusted2) {
|
|
938
953
|
var _a;
|
|
939
954
|
const head = `${untrusted2(r.componentId)} \u2014 region, ${r.versions.length} version${r.versions.length === 1 ? "" : "s"}` + (r.windowVisitors !== null ? ` \xB7 ${r.windowVisitors} People served in this window, ${(_a = r.windowConversions) != null ? _a : 0} converted` : "");
|
|
@@ -2057,7 +2072,7 @@ function registerPageElementTools(server, client) {
|
|
|
2057
2072
|
"get_page_elements",
|
|
2058
2073
|
{
|
|
2059
2074
|
title: "Page elements Sentient found on your site",
|
|
2060
|
-
description: "The buttons, headlines, forms and other elements the latest site check found, each with an `id`, what kind it is, its label, its current text and the page it is on. Use an `id` as `targetId` for manage_generation open_pr, which writes the change into your site's code and sends it to your developers as a pull request (the project needs a connected GitHub repo first \u2014 that one step is done in the dashboard, because GitHub asks the repo owner to approve the app). open_pr body: { targetId, label, goalId, arms: [{ displayName, ops }] } with 2\u20134 arms, the first being the element as it is now (ops {}). ops may set: text (plain text), hidden (boolean), href and imageSrc (https URLs), imageAlt, and style with these properties only: color, background, fontSize, fontWeight, textAlign, padding, margin, borderRadius, width, height, maxWidth, border, boxShadow, opacity, lineHeight, letterSpacing, textTransform, gap, fontFamily. Pass `pageUrl` to keep one page. When the site has not been checked yet, ask for a check with manage_settings rescan_site; results land in a few minutes." + UNTRUSTED_FIELDS_NOTE,
|
|
2075
|
+
description: "The buttons, headlines, forms and other elements the latest site check found, each with an `id`, what kind it is, its label, its current text and the page it is on. Use an `id` as `targetId` for manage_generation open_pr, which writes the change into your site's code and sends it to your developers as a pull request (the project needs a connected GitHub repo first \u2014 that one step is done in the dashboard, Settings \u2192 GitHub, because GitHub asks the repo owner to approve the app). An element with no text (a whole form, an image with no id) cannot be found in the code and is refused for open_pr \u2014 offer the no-code path for it. open_pr body: { targetId, label, goalId, arms: [{ displayName, ops }] } with 2\u20134 arms, the first being the element as it is now (ops {}). ops may set: text (plain text), hidden (boolean), href and imageSrc (https URLs), imageAlt, and style with these properties only: color, background, fontSize, fontWeight, textAlign, padding, margin, borderRadius, width, height, maxWidth, border, boxShadow, opacity, lineHeight, letterSpacing, textTransform, gap, fontFamily. Pass `pageUrl` to keep one page. When the site has not been checked yet, ask for a check with manage_settings rescan_site; results land in a few minutes." + UNTRUSTED_FIELDS_NOTE,
|
|
2061
2076
|
inputSchema: {
|
|
2062
2077
|
projectId: projectIdSchema,
|
|
2063
2078
|
pageUrl: z12.string().max(500).optional().describe("Only elements on this page (a path like /pricing, or a full URL)")
|
|
@@ -3868,7 +3883,7 @@ function registerInternalTrafficTools(server, client) {
|
|
|
3868
3883
|
"get_internal_traffic_rules",
|
|
3869
3884
|
{
|
|
3870
3885
|
title: "Internal traffic rules",
|
|
3871
|
-
description: `Read how this project keeps its own team and test sites out of its numbers (dashboard Settings \u2192 Internal traffic): which allowed domains are internal sites, the team email domains and masked exact emails, whether a "mark this browser" link exists, and how many sessions each way marked internal in the last 7 days. Internal visits still see versions (QA works) but never count in any report or teach the optimizer; get_traffic_breakdown lists them as "${INTERNAL_TRAFFIC_LABEL}". Exact emails are stored only as a hash \u2014 this tool returns the masked form, never an address or the hash. Rules apply from when they are turned on
|
|
3886
|
+
description: `Read how this project keeps its own team and test sites out of its numbers (dashboard Settings \u2192 Internal traffic): which allowed domains are internal sites, the team email domains and masked exact emails, whether a "mark this browser" link exists, and how many sessions each way marked internal in the last 7 days. Internal visits still see versions (QA works) but never count in any report or teach the optimizer; get_traffic_breakdown lists them as "${INTERNAL_TRAFFIC_LABEL}". Exact emails are stored only as a hash \u2014 this tool returns the masked form, never an address or the hash. Rules apply from when they are turned on. To change them: manage_settings set_internal_sites, add_internal_email, remove_internal_email.`,
|
|
3872
3887
|
inputSchema: { projectId: projectIdSchema },
|
|
3873
3888
|
outputSchema: {
|
|
3874
3889
|
internalOrigins: z24.array(z24.string()).describe("Allowed domains whose every visit is marked internal"),
|
|
@@ -3975,7 +3990,7 @@ function registerCellTools(server, client) {
|
|
|
3975
3990
|
"get_cell_matrix",
|
|
3976
3991
|
{
|
|
3977
3992
|
title: "Persona \xD7 slot cell matrix",
|
|
3978
|
-
description: 'The "Who sees what" matrix: which visitor types (personas) have an AI-generated version live in each personalizable region (slot), with per-persona traffic share and the first-miss auto-fill setting. A cell with no row means that visitor type sees the original.' + UNTRUSTED_FIELDS_NOTE,
|
|
3993
|
+
description: 'The "Who sees what" matrix: which visitor types (personas) have an AI-generated version live in each personalizable region (slot), with per-persona traffic share and the first-miss auto-fill setting. A cell with no row means nothing has been written for that visitor type in that region \u2014 not that it sees only the original: a region can still be testing shared versions (an editor or dashboard alternative) on everyone, which list_components lists with their numbers.' + UNTRUSTED_FIELDS_NOTE,
|
|
3979
3994
|
inputSchema: { projectId: projectIdSchema },
|
|
3980
3995
|
outputSchema: {
|
|
3981
3996
|
slots: z25.array(
|
|
@@ -4788,7 +4803,13 @@ var ACTIONS = {
|
|
|
4788
4803
|
save_insight: a("POST", "structured-insights/:insightId/save", { body: "opt" }),
|
|
4789
4804
|
// Who counts as already past the main goal (spec 2026-11-17).
|
|
4790
4805
|
set_gate_settings: a("PUT", "gate-settings", { body: "req" }),
|
|
4791
|
-
import_known_people: a("POST", "known-people/import", { body: "req" })
|
|
4806
|
+
import_known_people: a("POST", "known-people/import", { body: "req" }),
|
|
4807
|
+
// Internal traffic (2026-11-19): read-only until now, but the API already
|
|
4808
|
+
// let agents change it under the Project settings switch — the MCP was
|
|
4809
|
+
// the only thing in the way of "keep our staging site out of the numbers".
|
|
4810
|
+
set_internal_sites: a("PUT", "internal-traffic/origins", { body: "req" }),
|
|
4811
|
+
add_internal_email: a("POST", "internal-traffic/emails", { body: "req" }),
|
|
4812
|
+
remove_internal_email: a("DELETE", "internal-traffic/emails", { body: "req" })
|
|
4792
4813
|
}
|
|
4793
4814
|
};
|
|
4794
4815
|
var REFUSAL_NOTE = " If this project has turned off agent access for this area, the call is refused with a sentence saying so \u2014 tell the user, don't retry.";
|
|
@@ -4821,7 +4842,7 @@ var TOOLS = {
|
|
|
4821
4842
|
manage_settings: {
|
|
4822
4843
|
title: "Manage project settings",
|
|
4823
4844
|
destructive: true,
|
|
4824
|
-
description:
|
|
4845
|
+
description: 'Change project settings: rename or edit the project, remove an allowed origin, add, remove or test a webhook, remove a captured style, rescan the site, set page meaning, create, refresh or remove a report share link, set previews and the layout and slot models, send a test event, and accept, dismiss or save a structured insight. Also who counts as already converted: set_gate_settings (body { identifiedIsConverted: boolean } \u2014 true only when reaching the main goal is what creates the account, i.e. the main goal is sign-up; not available on stores) and import_known_people (body { people: [{ userId, convertedAt?, converted?, orderCount?, totalSpent?, currency?, lastOrderAt?, customerSince?, tags? }] }, at most 2000 per call \u2014 the site\'s own user ids for people who already reached the main goal; never names, emails, phone numbers or addresses, which are refused). Who counts as your team or a test site (Settings \u2192 Internal traffic; read the rules first with get_internal_traffic_rules): set_internal_sites (body { origins: [...] } \u2014 the WHOLE list of internal sites, each one already an allowed origin; an origin left out stops being internal), add_internal_email (body { value } \u2014 a team email domain such as "@acme.com", or one exact address, which is stored only as a hash) and remove_internal_email (body { domain } or { hash } from get_internal_traffic_rules). Internal visits still see versions but never count or teach the optimizer, from the moment a rule is on; earlier visits are separated where the rule can tell. Confirm the list with the user first. Removals cannot be undone. The three insight actions (accept_insight, dismiss_insight, save_insight) are always allowed: the Project settings switch does not govern them. Pick one `action`; pass the ids it needs.' + REFUSAL_NOTE
|
|
4825
4846
|
}
|
|
4826
4847
|
};
|
|
4827
4848
|
var pathParams = (route) => [...route.matchAll(/:([A-Za-z]+)/g)].map((m) => m[1]);
|
|
@@ -4905,7 +4926,7 @@ Server goal, exact shape (server only, never the browser):
|
|
|
4905
4926
|
await trackServerGoal({ serverKey: process.env.SENTIENT_SECRET_KEY!, userId: user.id, name: 'subscribed', dedupeKey: user.id });
|
|
4906
4927
|
userId must be the id the site identifies the visitor with (<AdaptiveRoot userId={user.id}>); in the visitor's own request pass sessionId: readSessionCookie(cookies, publicKey) instead.
|
|
4907
4928
|
|
|
4908
|
-
Excluding the team and test sites (dashboard Settings -> Internal traffic): visits marked internal still see versions (QA works) but never count in any report and never teach the optimizer; get_traffic_breakdown lists them as "Your team / test sites". They are marked by internal sites (allowed domains such as staging or localhost), team emails and domains (they match visitors the site identifies with identify(userId, { email }); the SDK sends only a SHA-256 of the address and its domain, never the address), a browser link, or the code flag (the internal prop on <AdaptiveRoot>/<AdaptiveProvider>, init({ internal }), window.sentient.internal). There is no report filter or IP rule, and visits from before a rule was turned on cannot be separated. Read the rules with get_internal_traffic_rules;
|
|
4929
|
+
Excluding the team and test sites (dashboard Settings -> Internal traffic): visits marked internal still see versions (QA works) but never count in any report and never teach the optimizer; get_traffic_breakdown lists them as "Your team / test sites". They are marked by internal sites (allowed domains such as staging or localhost), team emails and domains (they match visitors the site identifies with identify(userId, { email }); the SDK sends only a SHA-256 of the address and its domain, never the address), a browser link, or the code flag (the internal prop on <AdaptiveRoot>/<AdaptiveProvider>, init({ internal }), window.sentient.internal). There is no report filter or IP rule, and visits from before a rule was turned on cannot be separated. Read the rules with get_internal_traffic_rules; change them with manage_settings set_internal_sites / add_internal_email / remove_internal_email (Agent access: Project settings), after confirming the list with the user.
|
|
4909
4930
|
|
|
4910
4931
|
The main funnel (get_main_funnel): "how is my funnel doing" is answered by the one journey that ends at the project's main goal \u2014 Arrived, the marketer's own steps, the main goal \u2014 counted in people, with those who had already converted left out. It is chosen with manage_goals set_main_funnel and must end at the main goal; with none chosen it is just Arrived -> main goal. Stores get their checkout journey as the main funnel on connect. Use get_funnel_report only for a side journey: it counts one funnel's goals inside a window and includes people who had already converted, so its numbers and the main funnel's do not add up.
|
|
4911
4932
|
|
|
@@ -4916,7 +4937,7 @@ Known people (get_known_people): a person is "known" once they have reached the
|
|
|
4916
4937
|
Write tools change what real visitors see: confirm with the user first. Call get_agent_access before a manage_* write.`;
|
|
4917
4938
|
|
|
4918
4939
|
// src/server.ts
|
|
4919
|
-
var PKG_VERSION = true ? "0.
|
|
4940
|
+
var PKG_VERSION = true ? "0.29.0" : "0.0.0-dev";
|
|
4920
4941
|
function createMcpServer(client) {
|
|
4921
4942
|
const server = new McpServer(
|
|
4922
4943
|
{
|
package/dist/index.cjs
CHANGED
|
@@ -874,7 +874,7 @@ var regionOutputSchema = import_v33.z.array(
|
|
|
874
874
|
versions: import_v33.z.array(
|
|
875
875
|
import_v33.z.object({
|
|
876
876
|
versionId: import_v33.z.string().describe("The served arm id: baseline = the original, authored.<key> = a version written in code, anything else = generated or edited in the dashboard"),
|
|
877
|
-
source: import_v33.z.enum(["original", "code", "generated"]),
|
|
877
|
+
source: import_v33.z.enum(["original", "code", "generated", "written"]).describe("written = by a person in the dashboard or the on-site editor"),
|
|
878
878
|
timesShown: import_v33.z.number().describe("All-time times shown \u2014 the optimizer's own totals, NOT filtered by the requested window"),
|
|
879
879
|
conversions: import_v33.z.number().describe("All-time conversions credited to this version (optimizer totals)"),
|
|
880
880
|
conversionRate: import_v33.z.number().nullable().describe("conversions / timesShown; null at 0 shown"),
|
|
@@ -890,12 +890,16 @@ var regionOutputSchema = import_v33.z.array(
|
|
|
890
890
|
)
|
|
891
891
|
})
|
|
892
892
|
).describe("Regions: components served per visitor through Who sees what \u2014 versions written in code next to the original, or generated ones");
|
|
893
|
-
function sourceOf(arm, baselineArm) {
|
|
893
|
+
function sourceOf(arm, baselineArm, known) {
|
|
894
|
+
if (known === "original" || known === "generated") return known;
|
|
895
|
+
if (known === "authored") return "code";
|
|
896
|
+
if (known === "manual") return "written";
|
|
897
|
+
if (known === "suggested") return "generated";
|
|
894
898
|
if (arm === baselineArm) return "original";
|
|
895
899
|
if (arm.startsWith("authored.")) return "code";
|
|
896
900
|
return "generated";
|
|
897
901
|
}
|
|
898
|
-
function regionsFrom(body) {
|
|
902
|
+
function regionsFrom(body, sources) {
|
|
899
903
|
var _a2, _b;
|
|
900
904
|
const totals = new Map(((_a2 = body == null ? void 0 : body.window_totals) != null ? _a2 : []).map((t) => [t.slotId, t]));
|
|
901
905
|
return ((_b = body == null ? void 0 : body.slots) != null ? _b : []).map((s) => {
|
|
@@ -903,16 +907,16 @@ function regionsFrom(body) {
|
|
|
903
907
|
const baselineArm = (_a3 = s.baselineArm) != null ? _a3 : "baseline";
|
|
904
908
|
const t = totals.get(s.slotId);
|
|
905
909
|
const versions = ((_b2 = s.arms) != null ? _b2 : []).map((a2) => {
|
|
906
|
-
var _a4, _b3, _c;
|
|
910
|
+
var _a4, _b3, _c, _d;
|
|
907
911
|
const shown = (_a4 = a2.timesShown) != null ? _a4 : 0;
|
|
908
912
|
const conv = (_b3 = a2.conversions) != null ? _b3 : 0;
|
|
909
913
|
return {
|
|
910
914
|
versionId: a2.arm,
|
|
911
|
-
source: sourceOf(a2.arm, baselineArm),
|
|
915
|
+
source: sourceOf(a2.arm, baselineArm, (_c = sources == null ? void 0 : sources.get(s.slotId)) == null ? void 0 : _c.get(a2.arm)),
|
|
912
916
|
timesShown: shown,
|
|
913
917
|
conversions: conv,
|
|
914
918
|
conversionRate: shown > 0 ? conv / shown : null,
|
|
915
|
-
evidence: ((
|
|
919
|
+
evidence: ((_d = a2.personas) != null ? _d : []).map((p) => {
|
|
916
920
|
var _a5, _b4, _c2;
|
|
917
921
|
return {
|
|
918
922
|
audience: (_a5 = p.personaDisplay) != null ? _a5 : p.persona,
|
|
@@ -923,7 +927,7 @@ function regionsFrom(body) {
|
|
|
923
927
|
})
|
|
924
928
|
};
|
|
925
929
|
});
|
|
926
|
-
const rank = { original: 0, code: 1,
|
|
930
|
+
const rank = { original: 0, code: 1, written: 2, generated: 3 };
|
|
927
931
|
versions.sort((x, y) => rank[x.source] - rank[y.source] || x.versionId.localeCompare(y.versionId));
|
|
928
932
|
return {
|
|
929
933
|
componentId: s.slotId,
|
|
@@ -934,10 +938,21 @@ function regionsFrom(body) {
|
|
|
934
938
|
});
|
|
935
939
|
}
|
|
936
940
|
async function fetchRegions(client, projectId, rangeArgs) {
|
|
937
|
-
|
|
938
|
-
|
|
941
|
+
var _a2, _b;
|
|
942
|
+
const id = encodeURIComponent(projectId);
|
|
943
|
+
const [body, defs] = await Promise.all([
|
|
944
|
+
client.get(`/projects/${id}/slots${rangeQuery(rangeArgs)}`),
|
|
945
|
+
// Sources are a label: without them the arm-id rule still answers.
|
|
946
|
+
client.get(`/projects/${id}/slot-definitions`).catch(() => null)
|
|
947
|
+
]);
|
|
948
|
+
const sources = /* @__PURE__ */ new Map();
|
|
949
|
+
for (const d of (_a2 = defs == null ? void 0 : defs.slots) != null ? _a2 : []) {
|
|
950
|
+
if (typeof d.slot_id !== "string") continue;
|
|
951
|
+
sources.set(d.slot_id, new Map(((_b = d.arms) != null ? _b : []).filter((a2) => typeof a2.id === "string" && typeof a2.source === "string").map((a2) => [a2.id, a2.source])));
|
|
952
|
+
}
|
|
953
|
+
return regionsFrom(body, sources);
|
|
939
954
|
}
|
|
940
|
-
var SOURCE_LABEL = { original: "original", code: "written in code", generated: "generated" };
|
|
955
|
+
var SOURCE_LABEL = { original: "original", code: "written in code", generated: "generated", written: "written by a person" };
|
|
941
956
|
function regionText(r, untrusted2) {
|
|
942
957
|
var _a2;
|
|
943
958
|
const head = `${untrusted2(r.componentId)} \u2014 region, ${r.versions.length} version${r.versions.length === 1 ? "" : "s"}` + (r.windowVisitors !== null ? ` \xB7 ${r.windowVisitors} People served in this window, ${(_a2 = r.windowConversions) != null ? _a2 : 0} converted` : "");
|
|
@@ -2061,7 +2076,7 @@ function registerPageElementTools(server, client) {
|
|
|
2061
2076
|
"get_page_elements",
|
|
2062
2077
|
{
|
|
2063
2078
|
title: "Page elements Sentient found on your site",
|
|
2064
|
-
description: "The buttons, headlines, forms and other elements the latest site check found, each with an `id`, what kind it is, its label, its current text and the page it is on. Use an `id` as `targetId` for manage_generation open_pr, which writes the change into your site's code and sends it to your developers as a pull request (the project needs a connected GitHub repo first \u2014 that one step is done in the dashboard, because GitHub asks the repo owner to approve the app). open_pr body: { targetId, label, goalId, arms: [{ displayName, ops }] } with 2\u20134 arms, the first being the element as it is now (ops {}). ops may set: text (plain text), hidden (boolean), href and imageSrc (https URLs), imageAlt, and style with these properties only: color, background, fontSize, fontWeight, textAlign, padding, margin, borderRadius, width, height, maxWidth, border, boxShadow, opacity, lineHeight, letterSpacing, textTransform, gap, fontFamily. Pass `pageUrl` to keep one page. When the site has not been checked yet, ask for a check with manage_settings rescan_site; results land in a few minutes." + UNTRUSTED_FIELDS_NOTE,
|
|
2079
|
+
description: "The buttons, headlines, forms and other elements the latest site check found, each with an `id`, what kind it is, its label, its current text and the page it is on. Use an `id` as `targetId` for manage_generation open_pr, which writes the change into your site's code and sends it to your developers as a pull request (the project needs a connected GitHub repo first \u2014 that one step is done in the dashboard, Settings \u2192 GitHub, because GitHub asks the repo owner to approve the app). An element with no text (a whole form, an image with no id) cannot be found in the code and is refused for open_pr \u2014 offer the no-code path for it. open_pr body: { targetId, label, goalId, arms: [{ displayName, ops }] } with 2\u20134 arms, the first being the element as it is now (ops {}). ops may set: text (plain text), hidden (boolean), href and imageSrc (https URLs), imageAlt, and style with these properties only: color, background, fontSize, fontWeight, textAlign, padding, margin, borderRadius, width, height, maxWidth, border, boxShadow, opacity, lineHeight, letterSpacing, textTransform, gap, fontFamily. Pass `pageUrl` to keep one page. When the site has not been checked yet, ask for a check with manage_settings rescan_site; results land in a few minutes." + UNTRUSTED_FIELDS_NOTE,
|
|
2065
2080
|
inputSchema: {
|
|
2066
2081
|
projectId: projectIdSchema,
|
|
2067
2082
|
pageUrl: import_v312.z.string().max(500).optional().describe("Only elements on this page (a path like /pricing, or a full URL)")
|
|
@@ -3872,7 +3887,7 @@ function registerInternalTrafficTools(server, client) {
|
|
|
3872
3887
|
"get_internal_traffic_rules",
|
|
3873
3888
|
{
|
|
3874
3889
|
title: "Internal traffic rules",
|
|
3875
|
-
description: `Read how this project keeps its own team and test sites out of its numbers (dashboard Settings \u2192 Internal traffic): which allowed domains are internal sites, the team email domains and masked exact emails, whether a "mark this browser" link exists, and how many sessions each way marked internal in the last 7 days. Internal visits still see versions (QA works) but never count in any report or teach the optimizer; get_traffic_breakdown lists them as "${INTERNAL_TRAFFIC_LABEL}". Exact emails are stored only as a hash \u2014 this tool returns the masked form, never an address or the hash. Rules apply from when they are turned on
|
|
3890
|
+
description: `Read how this project keeps its own team and test sites out of its numbers (dashboard Settings \u2192 Internal traffic): which allowed domains are internal sites, the team email domains and masked exact emails, whether a "mark this browser" link exists, and how many sessions each way marked internal in the last 7 days. Internal visits still see versions (QA works) but never count in any report or teach the optimizer; get_traffic_breakdown lists them as "${INTERNAL_TRAFFIC_LABEL}". Exact emails are stored only as a hash \u2014 this tool returns the masked form, never an address or the hash. Rules apply from when they are turned on. To change them: manage_settings set_internal_sites, add_internal_email, remove_internal_email.`,
|
|
3876
3891
|
inputSchema: { projectId: projectIdSchema },
|
|
3877
3892
|
outputSchema: {
|
|
3878
3893
|
internalOrigins: import_v324.z.array(import_v324.z.string()).describe("Allowed domains whose every visit is marked internal"),
|
|
@@ -3979,7 +3994,7 @@ function registerCellTools(server, client) {
|
|
|
3979
3994
|
"get_cell_matrix",
|
|
3980
3995
|
{
|
|
3981
3996
|
title: "Persona \xD7 slot cell matrix",
|
|
3982
|
-
description: 'The "Who sees what" matrix: which visitor types (personas) have an AI-generated version live in each personalizable region (slot), with per-persona traffic share and the first-miss auto-fill setting. A cell with no row means that visitor type sees the original.' + UNTRUSTED_FIELDS_NOTE,
|
|
3997
|
+
description: 'The "Who sees what" matrix: which visitor types (personas) have an AI-generated version live in each personalizable region (slot), with per-persona traffic share and the first-miss auto-fill setting. A cell with no row means nothing has been written for that visitor type in that region \u2014 not that it sees only the original: a region can still be testing shared versions (an editor or dashboard alternative) on everyone, which list_components lists with their numbers.' + UNTRUSTED_FIELDS_NOTE,
|
|
3983
3998
|
inputSchema: { projectId: projectIdSchema },
|
|
3984
3999
|
outputSchema: {
|
|
3985
4000
|
slots: import_v325.z.array(
|
|
@@ -4792,7 +4807,13 @@ var ACTIONS = {
|
|
|
4792
4807
|
save_insight: a("POST", "structured-insights/:insightId/save", { body: "opt" }),
|
|
4793
4808
|
// Who counts as already past the main goal (spec 2026-11-17).
|
|
4794
4809
|
set_gate_settings: a("PUT", "gate-settings", { body: "req" }),
|
|
4795
|
-
import_known_people: a("POST", "known-people/import", { body: "req" })
|
|
4810
|
+
import_known_people: a("POST", "known-people/import", { body: "req" }),
|
|
4811
|
+
// Internal traffic (2026-11-19): read-only until now, but the API already
|
|
4812
|
+
// let agents change it under the Project settings switch — the MCP was
|
|
4813
|
+
// the only thing in the way of "keep our staging site out of the numbers".
|
|
4814
|
+
set_internal_sites: a("PUT", "internal-traffic/origins", { body: "req" }),
|
|
4815
|
+
add_internal_email: a("POST", "internal-traffic/emails", { body: "req" }),
|
|
4816
|
+
remove_internal_email: a("DELETE", "internal-traffic/emails", { body: "req" })
|
|
4796
4817
|
}
|
|
4797
4818
|
};
|
|
4798
4819
|
var REFUSAL_NOTE = " If this project has turned off agent access for this area, the call is refused with a sentence saying so \u2014 tell the user, don't retry.";
|
|
@@ -4825,7 +4846,7 @@ var TOOLS = {
|
|
|
4825
4846
|
manage_settings: {
|
|
4826
4847
|
title: "Manage project settings",
|
|
4827
4848
|
destructive: true,
|
|
4828
|
-
description:
|
|
4849
|
+
description: 'Change project settings: rename or edit the project, remove an allowed origin, add, remove or test a webhook, remove a captured style, rescan the site, set page meaning, create, refresh or remove a report share link, set previews and the layout and slot models, send a test event, and accept, dismiss or save a structured insight. Also who counts as already converted: set_gate_settings (body { identifiedIsConverted: boolean } \u2014 true only when reaching the main goal is what creates the account, i.e. the main goal is sign-up; not available on stores) and import_known_people (body { people: [{ userId, convertedAt?, converted?, orderCount?, totalSpent?, currency?, lastOrderAt?, customerSince?, tags? }] }, at most 2000 per call \u2014 the site\'s own user ids for people who already reached the main goal; never names, emails, phone numbers or addresses, which are refused). Who counts as your team or a test site (Settings \u2192 Internal traffic; read the rules first with get_internal_traffic_rules): set_internal_sites (body { origins: [...] } \u2014 the WHOLE list of internal sites, each one already an allowed origin; an origin left out stops being internal), add_internal_email (body { value } \u2014 a team email domain such as "@acme.com", or one exact address, which is stored only as a hash) and remove_internal_email (body { domain } or { hash } from get_internal_traffic_rules). Internal visits still see versions but never count or teach the optimizer, from the moment a rule is on; earlier visits are separated where the rule can tell. Confirm the list with the user first. Removals cannot be undone. The three insight actions (accept_insight, dismiss_insight, save_insight) are always allowed: the Project settings switch does not govern them. Pick one `action`; pass the ids it needs.' + REFUSAL_NOTE
|
|
4829
4850
|
}
|
|
4830
4851
|
};
|
|
4831
4852
|
var pathParams = (route) => [...route.matchAll(/:([A-Za-z]+)/g)].map((m) => m[1]);
|
|
@@ -4909,7 +4930,7 @@ Server goal, exact shape (server only, never the browser):
|
|
|
4909
4930
|
await trackServerGoal({ serverKey: process.env.SENTIENT_SECRET_KEY!, userId: user.id, name: 'subscribed', dedupeKey: user.id });
|
|
4910
4931
|
userId must be the id the site identifies the visitor with (<AdaptiveRoot userId={user.id}>); in the visitor's own request pass sessionId: readSessionCookie(cookies, publicKey) instead.
|
|
4911
4932
|
|
|
4912
|
-
Excluding the team and test sites (dashboard Settings -> Internal traffic): visits marked internal still see versions (QA works) but never count in any report and never teach the optimizer; get_traffic_breakdown lists them as "Your team / test sites". They are marked by internal sites (allowed domains such as staging or localhost), team emails and domains (they match visitors the site identifies with identify(userId, { email }); the SDK sends only a SHA-256 of the address and its domain, never the address), a browser link, or the code flag (the internal prop on <AdaptiveRoot>/<AdaptiveProvider>, init({ internal }), window.sentient.internal). There is no report filter or IP rule, and visits from before a rule was turned on cannot be separated. Read the rules with get_internal_traffic_rules;
|
|
4933
|
+
Excluding the team and test sites (dashboard Settings -> Internal traffic): visits marked internal still see versions (QA works) but never count in any report and never teach the optimizer; get_traffic_breakdown lists them as "Your team / test sites". They are marked by internal sites (allowed domains such as staging or localhost), team emails and domains (they match visitors the site identifies with identify(userId, { email }); the SDK sends only a SHA-256 of the address and its domain, never the address), a browser link, or the code flag (the internal prop on <AdaptiveRoot>/<AdaptiveProvider>, init({ internal }), window.sentient.internal). There is no report filter or IP rule, and visits from before a rule was turned on cannot be separated. Read the rules with get_internal_traffic_rules; change them with manage_settings set_internal_sites / add_internal_email / remove_internal_email (Agent access: Project settings), after confirming the list with the user.
|
|
4913
4934
|
|
|
4914
4935
|
The main funnel (get_main_funnel): "how is my funnel doing" is answered by the one journey that ends at the project's main goal \u2014 Arrived, the marketer's own steps, the main goal \u2014 counted in people, with those who had already converted left out. It is chosen with manage_goals set_main_funnel and must end at the main goal; with none chosen it is just Arrived -> main goal. Stores get their checkout journey as the main funnel on connect. Use get_funnel_report only for a side journey: it counts one funnel's goals inside a window and includes people who had already converted, so its numbers and the main funnel's do not add up.
|
|
4915
4936
|
|
|
@@ -4920,7 +4941,7 @@ Known people (get_known_people): a person is "known" once they have reached the
|
|
|
4920
4941
|
Write tools change what real visitors see: confirm with the user first. Call get_agent_access before a manage_* write.`;
|
|
4921
4942
|
|
|
4922
4943
|
// src/server.ts
|
|
4923
|
-
var PKG_VERSION = true ? "0.
|
|
4944
|
+
var PKG_VERSION = true ? "0.29.0" : "0.0.0-dev";
|
|
4924
4945
|
function createMcpServer(client) {
|
|
4925
4946
|
const server = new import_mcp.McpServer(
|
|
4926
4947
|
{
|
package/dist/index.js
CHANGED
package/dist/lib.cjs
CHANGED
|
@@ -900,7 +900,7 @@ var regionOutputSchema = import_v33.z.array(
|
|
|
900
900
|
versions: import_v33.z.array(
|
|
901
901
|
import_v33.z.object({
|
|
902
902
|
versionId: import_v33.z.string().describe("The served arm id: baseline = the original, authored.<key> = a version written in code, anything else = generated or edited in the dashboard"),
|
|
903
|
-
source: import_v33.z.enum(["original", "code", "generated"]),
|
|
903
|
+
source: import_v33.z.enum(["original", "code", "generated", "written"]).describe("written = by a person in the dashboard or the on-site editor"),
|
|
904
904
|
timesShown: import_v33.z.number().describe("All-time times shown \u2014 the optimizer's own totals, NOT filtered by the requested window"),
|
|
905
905
|
conversions: import_v33.z.number().describe("All-time conversions credited to this version (optimizer totals)"),
|
|
906
906
|
conversionRate: import_v33.z.number().nullable().describe("conversions / timesShown; null at 0 shown"),
|
|
@@ -916,12 +916,16 @@ var regionOutputSchema = import_v33.z.array(
|
|
|
916
916
|
)
|
|
917
917
|
})
|
|
918
918
|
).describe("Regions: components served per visitor through Who sees what \u2014 versions written in code next to the original, or generated ones");
|
|
919
|
-
function sourceOf(arm, baselineArm) {
|
|
919
|
+
function sourceOf(arm, baselineArm, known) {
|
|
920
|
+
if (known === "original" || known === "generated") return known;
|
|
921
|
+
if (known === "authored") return "code";
|
|
922
|
+
if (known === "manual") return "written";
|
|
923
|
+
if (known === "suggested") return "generated";
|
|
920
924
|
if (arm === baselineArm) return "original";
|
|
921
925
|
if (arm.startsWith("authored.")) return "code";
|
|
922
926
|
return "generated";
|
|
923
927
|
}
|
|
924
|
-
function regionsFrom(body) {
|
|
928
|
+
function regionsFrom(body, sources) {
|
|
925
929
|
var _a, _b;
|
|
926
930
|
const totals = new Map(((_a = body == null ? void 0 : body.window_totals) != null ? _a : []).map((t) => [t.slotId, t]));
|
|
927
931
|
return ((_b = body == null ? void 0 : body.slots) != null ? _b : []).map((s) => {
|
|
@@ -929,16 +933,16 @@ function regionsFrom(body) {
|
|
|
929
933
|
const baselineArm = (_a2 = s.baselineArm) != null ? _a2 : "baseline";
|
|
930
934
|
const t = totals.get(s.slotId);
|
|
931
935
|
const versions = ((_b2 = s.arms) != null ? _b2 : []).map((a2) => {
|
|
932
|
-
var _a3, _b3, _c;
|
|
936
|
+
var _a3, _b3, _c, _d;
|
|
933
937
|
const shown = (_a3 = a2.timesShown) != null ? _a3 : 0;
|
|
934
938
|
const conv = (_b3 = a2.conversions) != null ? _b3 : 0;
|
|
935
939
|
return {
|
|
936
940
|
versionId: a2.arm,
|
|
937
|
-
source: sourceOf(a2.arm, baselineArm),
|
|
941
|
+
source: sourceOf(a2.arm, baselineArm, (_c = sources == null ? void 0 : sources.get(s.slotId)) == null ? void 0 : _c.get(a2.arm)),
|
|
938
942
|
timesShown: shown,
|
|
939
943
|
conversions: conv,
|
|
940
944
|
conversionRate: shown > 0 ? conv / shown : null,
|
|
941
|
-
evidence: ((
|
|
945
|
+
evidence: ((_d = a2.personas) != null ? _d : []).map((p) => {
|
|
942
946
|
var _a4, _b4, _c2;
|
|
943
947
|
return {
|
|
944
948
|
audience: (_a4 = p.personaDisplay) != null ? _a4 : p.persona,
|
|
@@ -949,7 +953,7 @@ function regionsFrom(body) {
|
|
|
949
953
|
})
|
|
950
954
|
};
|
|
951
955
|
});
|
|
952
|
-
const rank = { original: 0, code: 1,
|
|
956
|
+
const rank = { original: 0, code: 1, written: 2, generated: 3 };
|
|
953
957
|
versions.sort((x, y) => rank[x.source] - rank[y.source] || x.versionId.localeCompare(y.versionId));
|
|
954
958
|
return {
|
|
955
959
|
componentId: s.slotId,
|
|
@@ -960,10 +964,21 @@ function regionsFrom(body) {
|
|
|
960
964
|
});
|
|
961
965
|
}
|
|
962
966
|
async function fetchRegions(client, projectId, rangeArgs) {
|
|
963
|
-
|
|
964
|
-
|
|
967
|
+
var _a, _b;
|
|
968
|
+
const id = encodeURIComponent(projectId);
|
|
969
|
+
const [body, defs] = await Promise.all([
|
|
970
|
+
client.get(`/projects/${id}/slots${rangeQuery(rangeArgs)}`),
|
|
971
|
+
// Sources are a label: without them the arm-id rule still answers.
|
|
972
|
+
client.get(`/projects/${id}/slot-definitions`).catch(() => null)
|
|
973
|
+
]);
|
|
974
|
+
const sources = /* @__PURE__ */ new Map();
|
|
975
|
+
for (const d of (_a = defs == null ? void 0 : defs.slots) != null ? _a : []) {
|
|
976
|
+
if (typeof d.slot_id !== "string") continue;
|
|
977
|
+
sources.set(d.slot_id, new Map(((_b = d.arms) != null ? _b : []).filter((a2) => typeof a2.id === "string" && typeof a2.source === "string").map((a2) => [a2.id, a2.source])));
|
|
978
|
+
}
|
|
979
|
+
return regionsFrom(body, sources);
|
|
965
980
|
}
|
|
966
|
-
var SOURCE_LABEL = { original: "original", code: "written in code", generated: "generated" };
|
|
981
|
+
var SOURCE_LABEL = { original: "original", code: "written in code", generated: "generated", written: "written by a person" };
|
|
967
982
|
function regionText(r, untrusted2) {
|
|
968
983
|
var _a;
|
|
969
984
|
const head = `${untrusted2(r.componentId)} \u2014 region, ${r.versions.length} version${r.versions.length === 1 ? "" : "s"}` + (r.windowVisitors !== null ? ` \xB7 ${r.windowVisitors} People served in this window, ${(_a = r.windowConversions) != null ? _a : 0} converted` : "");
|
|
@@ -2087,7 +2102,7 @@ function registerPageElementTools(server, client) {
|
|
|
2087
2102
|
"get_page_elements",
|
|
2088
2103
|
{
|
|
2089
2104
|
title: "Page elements Sentient found on your site",
|
|
2090
|
-
description: "The buttons, headlines, forms and other elements the latest site check found, each with an `id`, what kind it is, its label, its current text and the page it is on. Use an `id` as `targetId` for manage_generation open_pr, which writes the change into your site's code and sends it to your developers as a pull request (the project needs a connected GitHub repo first \u2014 that one step is done in the dashboard, because GitHub asks the repo owner to approve the app). open_pr body: { targetId, label, goalId, arms: [{ displayName, ops }] } with 2\u20134 arms, the first being the element as it is now (ops {}). ops may set: text (plain text), hidden (boolean), href and imageSrc (https URLs), imageAlt, and style with these properties only: color, background, fontSize, fontWeight, textAlign, padding, margin, borderRadius, width, height, maxWidth, border, boxShadow, opacity, lineHeight, letterSpacing, textTransform, gap, fontFamily. Pass `pageUrl` to keep one page. When the site has not been checked yet, ask for a check with manage_settings rescan_site; results land in a few minutes." + UNTRUSTED_FIELDS_NOTE,
|
|
2105
|
+
description: "The buttons, headlines, forms and other elements the latest site check found, each with an `id`, what kind it is, its label, its current text and the page it is on. Use an `id` as `targetId` for manage_generation open_pr, which writes the change into your site's code and sends it to your developers as a pull request (the project needs a connected GitHub repo first \u2014 that one step is done in the dashboard, Settings \u2192 GitHub, because GitHub asks the repo owner to approve the app). An element with no text (a whole form, an image with no id) cannot be found in the code and is refused for open_pr \u2014 offer the no-code path for it. open_pr body: { targetId, label, goalId, arms: [{ displayName, ops }] } with 2\u20134 arms, the first being the element as it is now (ops {}). ops may set: text (plain text), hidden (boolean), href and imageSrc (https URLs), imageAlt, and style with these properties only: color, background, fontSize, fontWeight, textAlign, padding, margin, borderRadius, width, height, maxWidth, border, boxShadow, opacity, lineHeight, letterSpacing, textTransform, gap, fontFamily. Pass `pageUrl` to keep one page. When the site has not been checked yet, ask for a check with manage_settings rescan_site; results land in a few minutes." + UNTRUSTED_FIELDS_NOTE,
|
|
2091
2106
|
inputSchema: {
|
|
2092
2107
|
projectId: projectIdSchema,
|
|
2093
2108
|
pageUrl: import_v312.z.string().max(500).optional().describe("Only elements on this page (a path like /pricing, or a full URL)")
|
|
@@ -3898,7 +3913,7 @@ function registerInternalTrafficTools(server, client) {
|
|
|
3898
3913
|
"get_internal_traffic_rules",
|
|
3899
3914
|
{
|
|
3900
3915
|
title: "Internal traffic rules",
|
|
3901
|
-
description: `Read how this project keeps its own team and test sites out of its numbers (dashboard Settings \u2192 Internal traffic): which allowed domains are internal sites, the team email domains and masked exact emails, whether a "mark this browser" link exists, and how many sessions each way marked internal in the last 7 days. Internal visits still see versions (QA works) but never count in any report or teach the optimizer; get_traffic_breakdown lists them as "${INTERNAL_TRAFFIC_LABEL}". Exact emails are stored only as a hash \u2014 this tool returns the masked form, never an address or the hash. Rules apply from when they are turned on
|
|
3916
|
+
description: `Read how this project keeps its own team and test sites out of its numbers (dashboard Settings \u2192 Internal traffic): which allowed domains are internal sites, the team email domains and masked exact emails, whether a "mark this browser" link exists, and how many sessions each way marked internal in the last 7 days. Internal visits still see versions (QA works) but never count in any report or teach the optimizer; get_traffic_breakdown lists them as "${INTERNAL_TRAFFIC_LABEL}". Exact emails are stored only as a hash \u2014 this tool returns the masked form, never an address or the hash. Rules apply from when they are turned on. To change them: manage_settings set_internal_sites, add_internal_email, remove_internal_email.`,
|
|
3902
3917
|
inputSchema: { projectId: projectIdSchema },
|
|
3903
3918
|
outputSchema: {
|
|
3904
3919
|
internalOrigins: import_v324.z.array(import_v324.z.string()).describe("Allowed domains whose every visit is marked internal"),
|
|
@@ -4005,7 +4020,7 @@ function registerCellTools(server, client) {
|
|
|
4005
4020
|
"get_cell_matrix",
|
|
4006
4021
|
{
|
|
4007
4022
|
title: "Persona \xD7 slot cell matrix",
|
|
4008
|
-
description: 'The "Who sees what" matrix: which visitor types (personas) have an AI-generated version live in each personalizable region (slot), with per-persona traffic share and the first-miss auto-fill setting. A cell with no row means that visitor type sees the original.' + UNTRUSTED_FIELDS_NOTE,
|
|
4023
|
+
description: 'The "Who sees what" matrix: which visitor types (personas) have an AI-generated version live in each personalizable region (slot), with per-persona traffic share and the first-miss auto-fill setting. A cell with no row means nothing has been written for that visitor type in that region \u2014 not that it sees only the original: a region can still be testing shared versions (an editor or dashboard alternative) on everyone, which list_components lists with their numbers.' + UNTRUSTED_FIELDS_NOTE,
|
|
4009
4024
|
inputSchema: { projectId: projectIdSchema },
|
|
4010
4025
|
outputSchema: {
|
|
4011
4026
|
slots: import_v325.z.array(
|
|
@@ -4818,7 +4833,13 @@ var ACTIONS = {
|
|
|
4818
4833
|
save_insight: a("POST", "structured-insights/:insightId/save", { body: "opt" }),
|
|
4819
4834
|
// Who counts as already past the main goal (spec 2026-11-17).
|
|
4820
4835
|
set_gate_settings: a("PUT", "gate-settings", { body: "req" }),
|
|
4821
|
-
import_known_people: a("POST", "known-people/import", { body: "req" })
|
|
4836
|
+
import_known_people: a("POST", "known-people/import", { body: "req" }),
|
|
4837
|
+
// Internal traffic (2026-11-19): read-only until now, but the API already
|
|
4838
|
+
// let agents change it under the Project settings switch — the MCP was
|
|
4839
|
+
// the only thing in the way of "keep our staging site out of the numbers".
|
|
4840
|
+
set_internal_sites: a("PUT", "internal-traffic/origins", { body: "req" }),
|
|
4841
|
+
add_internal_email: a("POST", "internal-traffic/emails", { body: "req" }),
|
|
4842
|
+
remove_internal_email: a("DELETE", "internal-traffic/emails", { body: "req" })
|
|
4822
4843
|
}
|
|
4823
4844
|
};
|
|
4824
4845
|
var REFUSAL_NOTE = " If this project has turned off agent access for this area, the call is refused with a sentence saying so \u2014 tell the user, don't retry.";
|
|
@@ -4851,7 +4872,7 @@ var TOOLS = {
|
|
|
4851
4872
|
manage_settings: {
|
|
4852
4873
|
title: "Manage project settings",
|
|
4853
4874
|
destructive: true,
|
|
4854
|
-
description:
|
|
4875
|
+
description: 'Change project settings: rename or edit the project, remove an allowed origin, add, remove or test a webhook, remove a captured style, rescan the site, set page meaning, create, refresh or remove a report share link, set previews and the layout and slot models, send a test event, and accept, dismiss or save a structured insight. Also who counts as already converted: set_gate_settings (body { identifiedIsConverted: boolean } \u2014 true only when reaching the main goal is what creates the account, i.e. the main goal is sign-up; not available on stores) and import_known_people (body { people: [{ userId, convertedAt?, converted?, orderCount?, totalSpent?, currency?, lastOrderAt?, customerSince?, tags? }] }, at most 2000 per call \u2014 the site\'s own user ids for people who already reached the main goal; never names, emails, phone numbers or addresses, which are refused). Who counts as your team or a test site (Settings \u2192 Internal traffic; read the rules first with get_internal_traffic_rules): set_internal_sites (body { origins: [...] } \u2014 the WHOLE list of internal sites, each one already an allowed origin; an origin left out stops being internal), add_internal_email (body { value } \u2014 a team email domain such as "@acme.com", or one exact address, which is stored only as a hash) and remove_internal_email (body { domain } or { hash } from get_internal_traffic_rules). Internal visits still see versions but never count or teach the optimizer, from the moment a rule is on; earlier visits are separated where the rule can tell. Confirm the list with the user first. Removals cannot be undone. The three insight actions (accept_insight, dismiss_insight, save_insight) are always allowed: the Project settings switch does not govern them. Pick one `action`; pass the ids it needs.' + REFUSAL_NOTE
|
|
4855
4876
|
}
|
|
4856
4877
|
};
|
|
4857
4878
|
var pathParams = (route) => [...route.matchAll(/:([A-Za-z]+)/g)].map((m) => m[1]);
|
|
@@ -4935,7 +4956,7 @@ Server goal, exact shape (server only, never the browser):
|
|
|
4935
4956
|
await trackServerGoal({ serverKey: process.env.SENTIENT_SECRET_KEY!, userId: user.id, name: 'subscribed', dedupeKey: user.id });
|
|
4936
4957
|
userId must be the id the site identifies the visitor with (<AdaptiveRoot userId={user.id}>); in the visitor's own request pass sessionId: readSessionCookie(cookies, publicKey) instead.
|
|
4937
4958
|
|
|
4938
|
-
Excluding the team and test sites (dashboard Settings -> Internal traffic): visits marked internal still see versions (QA works) but never count in any report and never teach the optimizer; get_traffic_breakdown lists them as "Your team / test sites". They are marked by internal sites (allowed domains such as staging or localhost), team emails and domains (they match visitors the site identifies with identify(userId, { email }); the SDK sends only a SHA-256 of the address and its domain, never the address), a browser link, or the code flag (the internal prop on <AdaptiveRoot>/<AdaptiveProvider>, init({ internal }), window.sentient.internal). There is no report filter or IP rule, and visits from before a rule was turned on cannot be separated. Read the rules with get_internal_traffic_rules;
|
|
4959
|
+
Excluding the team and test sites (dashboard Settings -> Internal traffic): visits marked internal still see versions (QA works) but never count in any report and never teach the optimizer; get_traffic_breakdown lists them as "Your team / test sites". They are marked by internal sites (allowed domains such as staging or localhost), team emails and domains (they match visitors the site identifies with identify(userId, { email }); the SDK sends only a SHA-256 of the address and its domain, never the address), a browser link, or the code flag (the internal prop on <AdaptiveRoot>/<AdaptiveProvider>, init({ internal }), window.sentient.internal). There is no report filter or IP rule, and visits from before a rule was turned on cannot be separated. Read the rules with get_internal_traffic_rules; change them with manage_settings set_internal_sites / add_internal_email / remove_internal_email (Agent access: Project settings), after confirming the list with the user.
|
|
4939
4960
|
|
|
4940
4961
|
The main funnel (get_main_funnel): "how is my funnel doing" is answered by the one journey that ends at the project's main goal \u2014 Arrived, the marketer's own steps, the main goal \u2014 counted in people, with those who had already converted left out. It is chosen with manage_goals set_main_funnel and must end at the main goal; with none chosen it is just Arrived -> main goal. Stores get their checkout journey as the main funnel on connect. Use get_funnel_report only for a side journey: it counts one funnel's goals inside a window and includes people who had already converted, so its numbers and the main funnel's do not add up.
|
|
4941
4962
|
|
|
@@ -4946,7 +4967,7 @@ Known people (get_known_people): a person is "known" once they have reached the
|
|
|
4946
4967
|
Write tools change what real visitors see: confirm with the user first. Call get_agent_access before a manage_* write.`;
|
|
4947
4968
|
|
|
4948
4969
|
// src/server.ts
|
|
4949
|
-
var PKG_VERSION = true ? "0.
|
|
4970
|
+
var PKG_VERSION = true ? "0.29.0" : "0.0.0-dev";
|
|
4950
4971
|
function createMcpServer(client) {
|
|
4951
4972
|
const server = new import_mcp.McpServer(
|
|
4952
4973
|
{
|
package/dist/lib.js
CHANGED