@walkeros/mcp 4.3.1 → 4.3.2
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/index.d.ts +104 -1
- package/dist/index.js +654 -269
- package/dist/index.js.map +1 -1
- package/dist/stdio.js +367 -15
- package/dist/stdio.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -571,6 +571,7 @@ var PREVIEW_SUMMARY_FIELDS = [
|
|
|
571
571
|
"grant",
|
|
572
572
|
"sessionGrant",
|
|
573
573
|
"sessionExpiresAt",
|
|
574
|
+
"sessionId",
|
|
574
575
|
"status",
|
|
575
576
|
"observeFeed",
|
|
576
577
|
"createdBy",
|
|
@@ -594,6 +595,18 @@ function redactPreviewList(data) {
|
|
|
594
595
|
...data.total !== void 0 ? { total: data.total } : {}
|
|
595
596
|
};
|
|
596
597
|
}
|
|
598
|
+
async function resolveLiveSessionId(client, flowId, projectId) {
|
|
599
|
+
try {
|
|
600
|
+
const result = await client.listJourneys({
|
|
601
|
+
flowId,
|
|
602
|
+
...projectId !== void 0 && { projectId },
|
|
603
|
+
limit: 1
|
|
604
|
+
});
|
|
605
|
+
return result.sessionId;
|
|
606
|
+
} catch {
|
|
607
|
+
return null;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
597
610
|
function createFlowManageToolSpec(client) {
|
|
598
611
|
return {
|
|
599
612
|
name: "flow_manage",
|
|
@@ -845,16 +858,17 @@ async function flowManageHandlerBody(client, input) {
|
|
|
845
858
|
new Error("preview_regrant is not supported by this client")
|
|
846
859
|
);
|
|
847
860
|
}
|
|
861
|
+
const pairedSessionId = sessionId ?? await resolveLiveSessionId(client, flowId, resolvedProjectId);
|
|
848
862
|
const data = await client.regrantPreview({
|
|
849
863
|
projectId: resolvedProjectId,
|
|
850
864
|
flowId,
|
|
851
865
|
previewId,
|
|
852
866
|
origins: origins ?? [],
|
|
853
|
-
...
|
|
867
|
+
...pairedSessionId ? { sessionId: pairedSessionId } : {}
|
|
854
868
|
});
|
|
855
869
|
return mcpResult3(redactPreview(data), {
|
|
856
870
|
next: [
|
|
857
|
-
|
|
871
|
+
pairedSessionId ? "Open activationUrl on the target origin: it activates the web preview AND forwards its events to the observe session. Use sessionGrant as the X-Walkeros-Preview header for direct server-hop test events." : "Open activationUrl on the target origin to activate preview mode."
|
|
858
872
|
]
|
|
859
873
|
});
|
|
860
874
|
}
|
|
@@ -1333,30 +1347,336 @@ function registerObserveJourneysTool(server, client) {
|
|
|
1333
1347
|
);
|
|
1334
1348
|
}
|
|
1335
1349
|
|
|
1336
|
-
// src/tools/
|
|
1350
|
+
// src/tools/observe-session.ts
|
|
1337
1351
|
import { z as z7 } from "zod";
|
|
1338
1352
|
import { mcpResult as mcpResult7, mcpError as mcpError7 } from "@walkeros/core";
|
|
1339
|
-
var TITLE7 = "
|
|
1340
|
-
var DESCRIPTION7 = "
|
|
1353
|
+
var TITLE7 = "Observe Session";
|
|
1354
|
+
var DESCRIPTION7 = "Open, inspect, or end an Observe session: a time-boxed window on one flow that runtimes attach to as arms. A preview arm streams from a browser, a container arm runs server-side, and both feed ONE shared journeys feed. start opens the window (arms picks which runtimes attach), status reports per-arm state plus recordsReceived and expiresAt, stop ends the whole session including every arm. A flow has at most one session, so status/stop resolve it from flowId when sessionId is omitted. Read the events with observe_journeys; this tool never returns event data and never judges whether events are correct.";
|
|
1355
|
+
var HINT_SIMULATE_FIRST = "Simulate before preview: flow_simulate checks mapping with no browser.";
|
|
1356
|
+
var HINT_PREVIEW_STREAMS = "Preview streams into this session: mint a link with flow_manage preview_regrant, then open it on your site.";
|
|
1357
|
+
var HINT_READ = "Read with observe_journeys (flowId); it is the only read.";
|
|
1358
|
+
var HINT_STOP = "End both arms with observe_session stop.";
|
|
1359
|
+
var HINT_EMPTY_FEED = "recordsReceived is 0: nothing has reached the feed yet. Drive traffic on an attached arm.";
|
|
1360
|
+
var HINT_ENDED = "Session ended and both arms detached. Start a new one with observe_session start.";
|
|
1361
|
+
var HINT_NO_WINDOW = "No Observe session on this flow. Open one with observe_session start.";
|
|
1341
1362
|
var inputSchema7 = {
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1363
|
+
action: z7.enum(["start", "status", "stop"]).describe(
|
|
1364
|
+
"start opens a session, status reports arm state, stop ends the whole session."
|
|
1365
|
+
),
|
|
1366
|
+
flowId: z7.string().describe("Flow the Observe session runs on."),
|
|
1367
|
+
projectId: z7.string().optional().describe("Project ID. Optional; falls back to the default project."),
|
|
1368
|
+
sessionId: z7.string().optional().describe(
|
|
1369
|
+
"Session to act on for status/stop. Optional; the flow has at most one session and it is resolved for you."
|
|
1370
|
+
),
|
|
1371
|
+
arms: z7.object({
|
|
1372
|
+
container: z7.literal(true).optional().describe(
|
|
1373
|
+
"Pass true to attach the server container arm, which selects the flow's server settings when no preview arm is named. Only true is accepted: a web settings that references a server flow always brings its container arm along, so a container cannot be suppressed here."
|
|
1374
|
+
),
|
|
1375
|
+
preview: z7.string().optional().describe(
|
|
1376
|
+
"Name the flow settings this session observes. A web settings attaches the browser preview arm (plus the container arm of any server flow it references); a server settings attaches the container arm alone. Omit to use the flow's single web settings."
|
|
1377
|
+
)
|
|
1378
|
+
}).optional().describe(
|
|
1379
|
+
"Which runtimes attach. Omit to attach the default preview arm; a web settings that references a server flow brings its container arm with it."
|
|
1380
|
+
),
|
|
1381
|
+
origins: z7.array(z7.string()).optional().describe(
|
|
1382
|
+
"Bare https origins (https://host[:port]) the session may ingest web events from."
|
|
1383
|
+
),
|
|
1384
|
+
level: z7.enum(["off", "standard", "trace"]).optional().describe("Container observation verbosity. Defaults to the app's own."),
|
|
1385
|
+
replace: z7.boolean().optional().describe(
|
|
1386
|
+
"Replace the flow's existing window instead of attaching to it. Re-provisions from the new config."
|
|
1345
1387
|
)
|
|
1346
1388
|
};
|
|
1347
1389
|
var annotations7 = {
|
|
1348
1390
|
readOnlyHint: false,
|
|
1349
|
-
destructiveHint:
|
|
1391
|
+
destructiveHint: true,
|
|
1350
1392
|
idempotentHint: false,
|
|
1351
1393
|
openWorldHint: true
|
|
1352
1394
|
};
|
|
1353
|
-
function
|
|
1395
|
+
function readSettings(flow) {
|
|
1396
|
+
if (!flow || typeof flow !== "object") return [];
|
|
1397
|
+
const settings = flow.settings;
|
|
1398
|
+
if (!Array.isArray(settings)) return [];
|
|
1399
|
+
const entries = [];
|
|
1400
|
+
for (const entry of settings) {
|
|
1401
|
+
if (!entry || typeof entry !== "object") continue;
|
|
1402
|
+
const { name, platform } = entry;
|
|
1403
|
+
if (typeof name !== "string") continue;
|
|
1404
|
+
if (platform !== "web" && platform !== "server") continue;
|
|
1405
|
+
entries.push({ name, platform });
|
|
1406
|
+
}
|
|
1407
|
+
return entries;
|
|
1408
|
+
}
|
|
1409
|
+
function resolveSettingsName(settings, arms) {
|
|
1410
|
+
if (arms?.preview !== void 0) {
|
|
1411
|
+
const named = settings.find((entry) => entry.name === arms.preview);
|
|
1412
|
+
if (!named) {
|
|
1413
|
+
throw new Error(
|
|
1414
|
+
`This flow has no settings named "${arms.preview}". Available: ${describeSettings(settings)}`
|
|
1415
|
+
);
|
|
1416
|
+
}
|
|
1417
|
+
return named.name;
|
|
1418
|
+
}
|
|
1419
|
+
if (arms?.container === true) {
|
|
1420
|
+
const servers = settings.filter((entry) => entry.platform === "server");
|
|
1421
|
+
const only = servers[0];
|
|
1422
|
+
if (!only) {
|
|
1423
|
+
throw new Error(
|
|
1424
|
+
`The container arm needs a server settings, and this flow has no server settings. Available: ${describeSettings(settings)}`
|
|
1425
|
+
);
|
|
1426
|
+
}
|
|
1427
|
+
if (servers.length > 1) {
|
|
1428
|
+
throw new Error(
|
|
1429
|
+
`This flow has several server settings. Name one with arms.preview. Available: ${describeSettings(settings)}`
|
|
1430
|
+
);
|
|
1431
|
+
}
|
|
1432
|
+
return only.name;
|
|
1433
|
+
}
|
|
1434
|
+
const webs = settings.filter((entry) => entry.platform === "web");
|
|
1435
|
+
const onlyWeb = webs[0];
|
|
1436
|
+
if (onlyWeb && webs.length === 1) return onlyWeb.name;
|
|
1437
|
+
if (webs.length > 1) {
|
|
1438
|
+
throw new Error(
|
|
1439
|
+
`This flow has several web settings. Name one with arms.preview. Available: ${describeSettings(settings)}`
|
|
1440
|
+
);
|
|
1441
|
+
}
|
|
1442
|
+
const onlySettings = settings[0];
|
|
1443
|
+
if (onlySettings && settings.length === 1) return onlySettings.name;
|
|
1444
|
+
throw new Error(
|
|
1445
|
+
`Could not pick a settings to observe. Name one with arms.preview. Available: ${describeSettings(settings)}`
|
|
1446
|
+
);
|
|
1447
|
+
}
|
|
1448
|
+
function describeSettings(settings) {
|
|
1449
|
+
if (settings.length === 0) return "none";
|
|
1450
|
+
return settings.map((entry) => `${entry.name} (${entry.platform})`).join(", ");
|
|
1451
|
+
}
|
|
1452
|
+
function toArms(session) {
|
|
1354
1453
|
return {
|
|
1355
|
-
|
|
1454
|
+
preview: {
|
|
1455
|
+
attached: session.web !== null,
|
|
1456
|
+
settingsName: session.observedFlowName,
|
|
1457
|
+
activationUrl: session.web?.activationUrl ?? null,
|
|
1458
|
+
previewEnabled: session.web?.previewEnabled ?? false
|
|
1459
|
+
},
|
|
1460
|
+
container: {
|
|
1461
|
+
attached: session.server !== null,
|
|
1462
|
+
settingsName: session.serverFlowName,
|
|
1463
|
+
endpoint: session.server?.endpoint ?? null
|
|
1464
|
+
}
|
|
1465
|
+
};
|
|
1466
|
+
}
|
|
1467
|
+
function toSummary(session) {
|
|
1468
|
+
return {
|
|
1469
|
+
sessionId: session.id,
|
|
1470
|
+
flowId: session.flowId,
|
|
1471
|
+
status: session.status,
|
|
1472
|
+
errorMessage: session.errorMessage,
|
|
1473
|
+
expiresAt: session.expiresAt,
|
|
1474
|
+
recordsReceived: session.recordsReceived,
|
|
1475
|
+
arms: toArms(session)
|
|
1476
|
+
};
|
|
1477
|
+
}
|
|
1478
|
+
var SESSION_RESOLUTION_FAILED = "Could not resolve this flow's Observe session because the journeys read that identifies it is unavailable. Pass sessionId explicitly to act on the session without that lookup.";
|
|
1479
|
+
var SessionResolutionError = class extends Error {
|
|
1480
|
+
code;
|
|
1481
|
+
details;
|
|
1482
|
+
constructor(message, cause) {
|
|
1483
|
+
super(message, { cause });
|
|
1484
|
+
this.name = "SessionResolutionError";
|
|
1485
|
+
this.code = readStringField(cause, "code");
|
|
1486
|
+
this.details = readArrayField(cause, "details");
|
|
1487
|
+
}
|
|
1488
|
+
};
|
|
1489
|
+
function readStringField(source, key) {
|
|
1490
|
+
if (source === null || typeof source !== "object" || !(key in source))
|
|
1491
|
+
return void 0;
|
|
1492
|
+
const value = Reflect.get(source, key);
|
|
1493
|
+
return typeof value === "string" ? value : void 0;
|
|
1494
|
+
}
|
|
1495
|
+
function readArrayField(source, key) {
|
|
1496
|
+
if (source === null || typeof source !== "object" || !(key in source))
|
|
1497
|
+
return void 0;
|
|
1498
|
+
const value = Reflect.get(source, key);
|
|
1499
|
+
return Array.isArray(value) ? value : void 0;
|
|
1500
|
+
}
|
|
1501
|
+
async function resolveSessionId(client, options) {
|
|
1502
|
+
try {
|
|
1503
|
+
const result = await client.listJourneys({
|
|
1504
|
+
flowId: options.flowId,
|
|
1505
|
+
...options.projectId !== void 0 && { projectId: options.projectId },
|
|
1506
|
+
limit: 1
|
|
1507
|
+
});
|
|
1508
|
+
return result.sessionId;
|
|
1509
|
+
} catch (error) {
|
|
1510
|
+
if (isAuthError(error)) throw error;
|
|
1511
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
1512
|
+
throw new SessionResolutionError(
|
|
1513
|
+
`${SESSION_RESOLUTION_FAILED} (${detail})`,
|
|
1514
|
+
error
|
|
1515
|
+
);
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
function resolveProjectId(client, projectId) {
|
|
1519
|
+
return projectId ?? client.getDefaultProject();
|
|
1520
|
+
}
|
|
1521
|
+
var NO_DEFAULT_PROJECT_ERROR2 = "No project ID given and no default project set. Pass projectId or set one with project_manage set_default.";
|
|
1522
|
+
function createObserveSessionToolSpec(client) {
|
|
1523
|
+
return {
|
|
1524
|
+
name: "observe_session",
|
|
1356
1525
|
title: TITLE7,
|
|
1357
1526
|
description: DESCRIPTION7,
|
|
1358
1527
|
inputSchema: inputSchema7,
|
|
1359
1528
|
annotations: annotations7,
|
|
1529
|
+
handler: (input) => observeSessionHandlerBody(client, input)
|
|
1530
|
+
};
|
|
1531
|
+
}
|
|
1532
|
+
async function observeSessionHandlerBody(client, input) {
|
|
1533
|
+
const {
|
|
1534
|
+
action,
|
|
1535
|
+
flowId,
|
|
1536
|
+
projectId,
|
|
1537
|
+
sessionId,
|
|
1538
|
+
arms,
|
|
1539
|
+
origins,
|
|
1540
|
+
level,
|
|
1541
|
+
replace
|
|
1542
|
+
} = input ?? {};
|
|
1543
|
+
if (!flowId) {
|
|
1544
|
+
return mcpError7(new Error("flowId is required for observe_session."));
|
|
1545
|
+
}
|
|
1546
|
+
const resolvedProjectId = resolveProjectId(client, projectId);
|
|
1547
|
+
if (!resolvedProjectId) {
|
|
1548
|
+
return mcpError7(new Error(NO_DEFAULT_PROJECT_ERROR2));
|
|
1549
|
+
}
|
|
1550
|
+
try {
|
|
1551
|
+
switch (action) {
|
|
1552
|
+
case "start": {
|
|
1553
|
+
if (!client.startObserveSession) {
|
|
1554
|
+
return mcpError7(
|
|
1555
|
+
new Error("observe_session start is not supported by this client.")
|
|
1556
|
+
);
|
|
1557
|
+
}
|
|
1558
|
+
const settings = readSettings(
|
|
1559
|
+
await client.getFlow({
|
|
1560
|
+
flowId,
|
|
1561
|
+
projectId: resolvedProjectId,
|
|
1562
|
+
fields: ["settings"]
|
|
1563
|
+
})
|
|
1564
|
+
);
|
|
1565
|
+
const settingsName = resolveSettingsName(settings, arms);
|
|
1566
|
+
const session = await client.startObserveSession({
|
|
1567
|
+
projectId: resolvedProjectId,
|
|
1568
|
+
flowId,
|
|
1569
|
+
settingsName,
|
|
1570
|
+
...origins !== void 0 && { origins },
|
|
1571
|
+
...level !== void 0 && { level },
|
|
1572
|
+
...replace !== void 0 && { replace }
|
|
1573
|
+
});
|
|
1574
|
+
return mcpResult7(toSummary(session), {
|
|
1575
|
+
next: [HINT_SIMULATE_FIRST, HINT_PREVIEW_STREAMS, HINT_READ]
|
|
1576
|
+
});
|
|
1577
|
+
}
|
|
1578
|
+
case "status": {
|
|
1579
|
+
if (!client.getObserveSession) {
|
|
1580
|
+
return mcpError7(
|
|
1581
|
+
new Error(
|
|
1582
|
+
"observe_session status is not supported by this client."
|
|
1583
|
+
)
|
|
1584
|
+
);
|
|
1585
|
+
}
|
|
1586
|
+
const resolvedSessionId = sessionId ?? await resolveSessionId(client, {
|
|
1587
|
+
flowId,
|
|
1588
|
+
projectId: resolvedProjectId
|
|
1589
|
+
});
|
|
1590
|
+
if (!resolvedSessionId) {
|
|
1591
|
+
return mcpResult7(
|
|
1592
|
+
{ sessionId: null, flowId },
|
|
1593
|
+
{ next: [HINT_NO_WINDOW, HINT_SIMULATE_FIRST] }
|
|
1594
|
+
);
|
|
1595
|
+
}
|
|
1596
|
+
const session = await client.getObserveSession({
|
|
1597
|
+
projectId: resolvedProjectId,
|
|
1598
|
+
flowId,
|
|
1599
|
+
sessionId: resolvedSessionId
|
|
1600
|
+
});
|
|
1601
|
+
return mcpResult7(toSummary(session), {
|
|
1602
|
+
next: session.recordsReceived === 0 ? [HINT_EMPTY_FEED, HINT_READ, HINT_STOP] : [HINT_READ, HINT_STOP]
|
|
1603
|
+
});
|
|
1604
|
+
}
|
|
1605
|
+
case "stop": {
|
|
1606
|
+
if (!client.endObserveSession) {
|
|
1607
|
+
return mcpError7(
|
|
1608
|
+
new Error("observe_session stop is not supported by this client.")
|
|
1609
|
+
);
|
|
1610
|
+
}
|
|
1611
|
+
const resolvedSessionId = sessionId ?? await resolveSessionId(client, {
|
|
1612
|
+
flowId,
|
|
1613
|
+
projectId: resolvedProjectId
|
|
1614
|
+
});
|
|
1615
|
+
if (!resolvedSessionId) {
|
|
1616
|
+
return mcpResult7(
|
|
1617
|
+
{ sessionId: null, flowId, ended: false },
|
|
1618
|
+
{ next: [HINT_NO_WINDOW] }
|
|
1619
|
+
);
|
|
1620
|
+
}
|
|
1621
|
+
await client.endObserveSession({
|
|
1622
|
+
projectId: resolvedProjectId,
|
|
1623
|
+
flowId,
|
|
1624
|
+
sessionId: resolvedSessionId
|
|
1625
|
+
});
|
|
1626
|
+
return mcpResult7(
|
|
1627
|
+
{ sessionId: resolvedSessionId, flowId, ended: true },
|
|
1628
|
+
{ next: [HINT_ENDED] }
|
|
1629
|
+
);
|
|
1630
|
+
}
|
|
1631
|
+
default:
|
|
1632
|
+
throw new Error(
|
|
1633
|
+
`Unknown action: ${String(action)}. Use one of: start, status, stop`
|
|
1634
|
+
);
|
|
1635
|
+
}
|
|
1636
|
+
} catch (error) {
|
|
1637
|
+
return mcpError7(error, isAuthError(error) ? AUTH_HINT : void 0);
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1640
|
+
function registerObserveSessionTool(server, client) {
|
|
1641
|
+
const spec = createObserveSessionToolSpec(client);
|
|
1642
|
+
server.registerTool(
|
|
1643
|
+
spec.name,
|
|
1644
|
+
{
|
|
1645
|
+
title: spec.title,
|
|
1646
|
+
description: spec.description,
|
|
1647
|
+
inputSchema: spec.inputSchema,
|
|
1648
|
+
annotations: spec.annotations
|
|
1649
|
+
},
|
|
1650
|
+
// SDK infers handler type from inputSchema shape; ToolSpec.handler is the
|
|
1651
|
+
// type-erased (input: unknown) => Promise<unknown> form by design.
|
|
1652
|
+
spec.handler
|
|
1653
|
+
);
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
// src/tools/feedback.ts
|
|
1657
|
+
import { z as z8 } from "zod";
|
|
1658
|
+
import { mcpResult as mcpResult8, mcpError as mcpError8 } from "@walkeros/core";
|
|
1659
|
+
var TITLE8 = "Send Feedback";
|
|
1660
|
+
var DESCRIPTION8 = "Send feedback about walkerOS";
|
|
1661
|
+
var inputSchema8 = {
|
|
1662
|
+
text: z8.string().describe("Your feedback text"),
|
|
1663
|
+
anonymous: z8.boolean().optional().describe(
|
|
1664
|
+
"Include user/project info? false = include, true = anonymous. Only needed on first call if not yet configured."
|
|
1665
|
+
)
|
|
1666
|
+
};
|
|
1667
|
+
var annotations8 = {
|
|
1668
|
+
readOnlyHint: false,
|
|
1669
|
+
destructiveHint: false,
|
|
1670
|
+
idempotentHint: false,
|
|
1671
|
+
openWorldHint: true
|
|
1672
|
+
};
|
|
1673
|
+
function createFeedbackToolSpec(client) {
|
|
1674
|
+
return {
|
|
1675
|
+
name: "feedback",
|
|
1676
|
+
title: TITLE8,
|
|
1677
|
+
description: DESCRIPTION8,
|
|
1678
|
+
inputSchema: inputSchema8,
|
|
1679
|
+
annotations: annotations8,
|
|
1360
1680
|
handler: (input) => feedbackHandlerBody(client, input)
|
|
1361
1681
|
};
|
|
1362
1682
|
}
|
|
@@ -1365,7 +1685,7 @@ async function feedbackHandlerBody(client, input) {
|
|
|
1365
1685
|
try {
|
|
1366
1686
|
let anonymous = client.getFeedbackPreference();
|
|
1367
1687
|
if (anonymous === void 0 && explicitAnonymous === void 0) {
|
|
1368
|
-
return
|
|
1688
|
+
return mcpResult8(
|
|
1369
1689
|
{ needsConsent: true },
|
|
1370
1690
|
{
|
|
1371
1691
|
next: [
|
|
@@ -1382,11 +1702,11 @@ async function feedbackHandlerBody(client, input) {
|
|
|
1382
1702
|
const isAnonymous = explicitAnonymous ?? anonymous ?? true;
|
|
1383
1703
|
await client.submitFeedback(text, {
|
|
1384
1704
|
anonymous: isAnonymous,
|
|
1385
|
-
version: "4.3.
|
|
1705
|
+
version: "4.3.2"
|
|
1386
1706
|
});
|
|
1387
|
-
return
|
|
1707
|
+
return mcpResult8({ ok: true });
|
|
1388
1708
|
} catch (error) {
|
|
1389
|
-
return
|
|
1709
|
+
return mcpError8(error);
|
|
1390
1710
|
}
|
|
1391
1711
|
}
|
|
1392
1712
|
function registerFeedbackTool(server, client) {
|
|
@@ -1408,93 +1728,93 @@ function registerFeedbackTool(server, client) {
|
|
|
1408
1728
|
// src/tools/validate.ts
|
|
1409
1729
|
import { validate, loadJsonConfig } from "@walkeros/cli";
|
|
1410
1730
|
import { schemas } from "@walkeros/cli/dev";
|
|
1411
|
-
import { mcpResult as
|
|
1731
|
+
import { mcpResult as mcpResult9, mcpError as mcpError9 } from "@walkeros/core";
|
|
1412
1732
|
|
|
1413
1733
|
// src/schemas/output.ts
|
|
1414
|
-
import { z as
|
|
1734
|
+
import { z as z9 } from "zod";
|
|
1415
1735
|
var ValidateOutputShape = {
|
|
1416
|
-
valid:
|
|
1417
|
-
type:
|
|
1418
|
-
|
|
1419
|
-
|
|
1736
|
+
valid: z9.boolean().describe("Whether validation passed"),
|
|
1737
|
+
type: z9.union([
|
|
1738
|
+
z9.enum(["contract", "entry", "event", "flow", "mapping"]),
|
|
1739
|
+
z9.string().regex(/^(destinations|sources|transformers)\.\w+$/)
|
|
1420
1740
|
]).describe("What was validated"),
|
|
1421
|
-
errors:
|
|
1422
|
-
|
|
1423
|
-
path:
|
|
1424
|
-
message:
|
|
1425
|
-
value:
|
|
1426
|
-
code:
|
|
1741
|
+
errors: z9.array(
|
|
1742
|
+
z9.object({
|
|
1743
|
+
path: z9.string(),
|
|
1744
|
+
message: z9.string(),
|
|
1745
|
+
value: z9.unknown().optional(),
|
|
1746
|
+
code: z9.string().optional()
|
|
1427
1747
|
})
|
|
1428
1748
|
).describe("Validation errors"),
|
|
1429
|
-
warnings:
|
|
1430
|
-
|
|
1431
|
-
path:
|
|
1432
|
-
message:
|
|
1433
|
-
suggestion:
|
|
1749
|
+
warnings: z9.array(
|
|
1750
|
+
z9.object({
|
|
1751
|
+
path: z9.string(),
|
|
1752
|
+
message: z9.string(),
|
|
1753
|
+
suggestion: z9.string().optional()
|
|
1434
1754
|
})
|
|
1435
1755
|
).describe("Validation warnings"),
|
|
1436
|
-
details:
|
|
1756
|
+
details: z9.record(z9.string(), z9.unknown()).describe("Additional validation details")
|
|
1437
1757
|
};
|
|
1438
1758
|
var BundleOutputShape = {
|
|
1439
|
-
success:
|
|
1440
|
-
totalSize:
|
|
1441
|
-
buildTime:
|
|
1442
|
-
packages:
|
|
1443
|
-
|
|
1444
|
-
name:
|
|
1759
|
+
success: z9.boolean().describe("Whether bundling succeeded"),
|
|
1760
|
+
totalSize: z9.number().optional().describe("Total bundle size in bytes"),
|
|
1761
|
+
buildTime: z9.number().optional().describe("Build time in milliseconds"),
|
|
1762
|
+
packages: z9.array(
|
|
1763
|
+
z9.object({
|
|
1764
|
+
name: z9.string()
|
|
1445
1765
|
})
|
|
1446
1766
|
).optional().describe("Names of packages included in the bundle"),
|
|
1447
|
-
treeshakingEffective:
|
|
1448
|
-
message:
|
|
1767
|
+
treeshakingEffective: z9.boolean().optional().describe("Whether tree-shaking was effective"),
|
|
1768
|
+
message: z9.string().optional().describe("Status message")
|
|
1449
1769
|
};
|
|
1450
1770
|
var SimulateOutputShape = {
|
|
1451
|
-
success:
|
|
1452
|
-
error:
|
|
1453
|
-
summary:
|
|
1454
|
-
destinations:
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
received:
|
|
1458
|
-
calls:
|
|
1459
|
-
payload:
|
|
1771
|
+
success: z9.boolean().describe("Whether simulation succeeded"),
|
|
1772
|
+
error: z9.string().optional().describe("Error message if failed"),
|
|
1773
|
+
summary: z9.string().describe("One-line result summary"),
|
|
1774
|
+
destinations: z9.record(
|
|
1775
|
+
z9.string(),
|
|
1776
|
+
z9.object({
|
|
1777
|
+
received: z9.boolean().describe("Whether destination received the event"),
|
|
1778
|
+
calls: z9.number().describe("Number of API calls made"),
|
|
1779
|
+
payload: z9.unknown().optional().describe("All intercepted API calls (only when verbose: true)")
|
|
1460
1780
|
})
|
|
1461
1781
|
).optional().describe("Per-destination results"),
|
|
1462
|
-
capturedEvents:
|
|
1463
|
-
duration:
|
|
1782
|
+
capturedEvents: z9.array(z9.record(z9.string(), z9.unknown())).optional().describe("Events captured by source simulation"),
|
|
1783
|
+
duration: z9.number().optional().describe("Simulation duration in ms")
|
|
1464
1784
|
};
|
|
1465
1785
|
var PushOutputShape = {
|
|
1466
|
-
success:
|
|
1467
|
-
elbResult:
|
|
1468
|
-
duration:
|
|
1469
|
-
error:
|
|
1786
|
+
success: z9.boolean().describe("Whether push succeeded"),
|
|
1787
|
+
elbResult: z9.unknown().optional().describe("Push result from the collector"),
|
|
1788
|
+
duration: z9.number().describe("Push duration in milliseconds"),
|
|
1789
|
+
error: z9.string().optional().describe("Error message if push failed")
|
|
1470
1790
|
};
|
|
1471
1791
|
var ExamplesListOutputShape = {
|
|
1472
|
-
flow:
|
|
1473
|
-
count:
|
|
1474
|
-
examples:
|
|
1475
|
-
|
|
1476
|
-
step:
|
|
1477
|
-
stepType:
|
|
1478
|
-
stepName:
|
|
1479
|
-
exampleName:
|
|
1480
|
-
source:
|
|
1792
|
+
flow: z9.string().describe("Flow name"),
|
|
1793
|
+
count: z9.number().describe("Number of examples found"),
|
|
1794
|
+
examples: z9.array(
|
|
1795
|
+
z9.object({
|
|
1796
|
+
step: z9.string().describe('Step location (e.g., "destination.gtag")'),
|
|
1797
|
+
stepType: z9.enum(["source", "transformer", "destination"]).describe("Step type"),
|
|
1798
|
+
stepName: z9.string().describe("Step name"),
|
|
1799
|
+
exampleName: z9.string().describe("Example name"),
|
|
1800
|
+
source: z9.enum(["inline", "package"]).describe(
|
|
1481
1801
|
'Where the example came from: "inline" (defined in the flow step) or "package" (shipped by the referenced package)'
|
|
1482
1802
|
),
|
|
1483
|
-
title:
|
|
1484
|
-
description:
|
|
1485
|
-
public:
|
|
1803
|
+
title: z9.string().optional().describe("Human-readable title if set"),
|
|
1804
|
+
description: z9.string().optional().describe("Short human-readable description"),
|
|
1805
|
+
public: z9.boolean().optional().describe(
|
|
1486
1806
|
"Whether the example is public (defaults to true if omitted)"
|
|
1487
1807
|
),
|
|
1488
|
-
hasIn:
|
|
1489
|
-
hasOut:
|
|
1490
|
-
hasMapping:
|
|
1491
|
-
hasTrigger:
|
|
1492
|
-
in:
|
|
1493
|
-
out:
|
|
1494
|
-
mapping:
|
|
1495
|
-
trigger:
|
|
1496
|
-
type:
|
|
1497
|
-
options:
|
|
1808
|
+
hasIn: z9.boolean().describe("Whether the example has an input value"),
|
|
1809
|
+
hasOut: z9.boolean().describe("Whether the example has an output value"),
|
|
1810
|
+
hasMapping: z9.boolean().describe("Whether the example has a mapping configuration"),
|
|
1811
|
+
hasTrigger: z9.boolean().describe("Whether the example has trigger metadata"),
|
|
1812
|
+
in: z9.unknown().optional().describe("Input event data"),
|
|
1813
|
+
out: z9.unknown().optional().describe("Expected output data"),
|
|
1814
|
+
mapping: z9.unknown().optional().describe("Mapping configuration for destinations"),
|
|
1815
|
+
trigger: z9.object({
|
|
1816
|
+
type: z9.string().optional(),
|
|
1817
|
+
options: z9.unknown().optional()
|
|
1498
1818
|
}).optional().describe("Trigger metadata for source simulation")
|
|
1499
1819
|
})
|
|
1500
1820
|
).describe("Step examples")
|
|
@@ -1529,10 +1849,10 @@ function detectDeprecatedStorePackages(config) {
|
|
|
1529
1849
|
}
|
|
1530
1850
|
return errors;
|
|
1531
1851
|
}
|
|
1532
|
-
var
|
|
1533
|
-
var
|
|
1534
|
-
var
|
|
1535
|
-
var
|
|
1852
|
+
var TITLE9 = "Validate Flow";
|
|
1853
|
+
var DESCRIPTION9 = "Validate walkerOS events, flow configurations, mapping rules, or data contracts. Accepts JSON strings, file paths, or URLs as input. Returns validation results with errors, warnings, and details.";
|
|
1854
|
+
var inputSchema9 = schemas.ValidateInputShape;
|
|
1855
|
+
var annotations9 = {
|
|
1536
1856
|
readOnlyHint: true,
|
|
1537
1857
|
destructiveHint: false,
|
|
1538
1858
|
idempotentHint: true,
|
|
@@ -1541,10 +1861,10 @@ var annotations8 = {
|
|
|
1541
1861
|
function createFlowValidateToolSpec() {
|
|
1542
1862
|
return {
|
|
1543
1863
|
name: "flow_validate",
|
|
1544
|
-
title:
|
|
1545
|
-
description:
|
|
1546
|
-
inputSchema:
|
|
1547
|
-
annotations:
|
|
1864
|
+
title: TITLE9,
|
|
1865
|
+
description: DESCRIPTION9,
|
|
1866
|
+
inputSchema: inputSchema9,
|
|
1867
|
+
annotations: annotations9,
|
|
1548
1868
|
handler: (input) => flowValidateHandlerBody(input)
|
|
1549
1869
|
};
|
|
1550
1870
|
}
|
|
@@ -1586,9 +1906,9 @@ async function flowValidateHandlerBody(input) {
|
|
|
1586
1906
|
"Read walkeros://reference/flow-schema for correct structure"
|
|
1587
1907
|
]
|
|
1588
1908
|
};
|
|
1589
|
-
return
|
|
1909
|
+
return mcpResult9(augmented, hints);
|
|
1590
1910
|
} catch (error) {
|
|
1591
|
-
return
|
|
1911
|
+
return mcpError9(
|
|
1592
1912
|
error,
|
|
1593
1913
|
"Check the input parameter \u2014 expected a JSON string, file path, or URL"
|
|
1594
1914
|
);
|
|
@@ -1615,7 +1935,7 @@ function registerFlowValidateTool(server) {
|
|
|
1615
1935
|
// src/tools/bundle.ts
|
|
1616
1936
|
import { bundle } from "@walkeros/cli";
|
|
1617
1937
|
import { schemas as schemas2 } from "@walkeros/cli/dev";
|
|
1618
|
-
import { mcpResult as
|
|
1938
|
+
import { mcpResult as mcpResult10, mcpError as mcpError10 } from "@walkeros/core";
|
|
1619
1939
|
|
|
1620
1940
|
// src/tools/resolve-config-path.ts
|
|
1621
1941
|
var API_ID_PREFIX = /^(flow|cfg)_/;
|
|
@@ -1627,12 +1947,12 @@ async function resolveConfigPath(client, configPath) {
|
|
|
1627
1947
|
}
|
|
1628
1948
|
|
|
1629
1949
|
// src/tools/bundle.ts
|
|
1630
|
-
var
|
|
1631
|
-
var
|
|
1632
|
-
var
|
|
1950
|
+
var TITLE10 = "Bundle Flow";
|
|
1951
|
+
var DESCRIPTION10 = "Bundle a walkerOS flow configuration into deployable JavaScript. Resolves all destinations, sources, and transformers, then outputs a tree-shaken production bundle. Returns bundle statistics.";
|
|
1952
|
+
var inputSchema10 = {
|
|
1633
1953
|
...schemas2.BundleInputShape
|
|
1634
1954
|
};
|
|
1635
|
-
var
|
|
1955
|
+
var annotations10 = {
|
|
1636
1956
|
readOnlyHint: false,
|
|
1637
1957
|
destructiveHint: false,
|
|
1638
1958
|
idempotentHint: false,
|
|
@@ -1641,10 +1961,10 @@ var annotations9 = {
|
|
|
1641
1961
|
function createFlowBundleToolSpec(client) {
|
|
1642
1962
|
return {
|
|
1643
1963
|
name: "flow_bundle",
|
|
1644
|
-
title:
|
|
1645
|
-
description:
|
|
1646
|
-
inputSchema:
|
|
1647
|
-
annotations:
|
|
1964
|
+
title: TITLE10,
|
|
1965
|
+
description: DESCRIPTION10,
|
|
1966
|
+
inputSchema: inputSchema10,
|
|
1967
|
+
annotations: annotations10,
|
|
1648
1968
|
handler: (input) => flowBundleHandlerBody(client, input)
|
|
1649
1969
|
};
|
|
1650
1970
|
}
|
|
@@ -1658,7 +1978,7 @@ async function flowBundleHandlerBody(client, input) {
|
|
|
1658
1978
|
buildOverrides: output ? { output } : void 0
|
|
1659
1979
|
});
|
|
1660
1980
|
if (!result) {
|
|
1661
|
-
return
|
|
1981
|
+
return mcpResult10(
|
|
1662
1982
|
{ success: false, message: "Bundle produced no output" },
|
|
1663
1983
|
{
|
|
1664
1984
|
warnings: [
|
|
@@ -1669,7 +1989,7 @@ async function flowBundleHandlerBody(client, input) {
|
|
|
1669
1989
|
);
|
|
1670
1990
|
}
|
|
1671
1991
|
const output_ = result;
|
|
1672
|
-
return
|
|
1992
|
+
return mcpResult10(
|
|
1673
1993
|
{ success: true, ...output_ },
|
|
1674
1994
|
{
|
|
1675
1995
|
next: [
|
|
@@ -1679,7 +1999,7 @@ async function flowBundleHandlerBody(client, input) {
|
|
|
1679
1999
|
}
|
|
1680
2000
|
);
|
|
1681
2001
|
} catch (error) {
|
|
1682
|
-
return
|
|
2002
|
+
return mcpError10(error, "Run flow_validate for detailed error messages");
|
|
1683
2003
|
}
|
|
1684
2004
|
}
|
|
1685
2005
|
function registerFlowBundleTool(server, client) {
|
|
@@ -1701,7 +2021,7 @@ function registerFlowBundleTool(server, client) {
|
|
|
1701
2021
|
}
|
|
1702
2022
|
|
|
1703
2023
|
// src/tools/simulate.ts
|
|
1704
|
-
import { z as
|
|
2024
|
+
import { z as z10 } from "zod";
|
|
1705
2025
|
import {
|
|
1706
2026
|
simulateSource,
|
|
1707
2027
|
simulateTransformer,
|
|
@@ -1709,7 +2029,7 @@ import {
|
|
|
1709
2029
|
simulateCollector
|
|
1710
2030
|
} from "@walkeros/cli";
|
|
1711
2031
|
import { schemas as schemas3 } from "@walkeros/cli/dev";
|
|
1712
|
-
import { mcpResult as
|
|
2032
|
+
import { mcpResult as mcpResult11, mcpError as mcpError11 } from "@walkeros/core";
|
|
1713
2033
|
|
|
1714
2034
|
// src/tools/bundle-cache.ts
|
|
1715
2035
|
import { createHash } from "crypto";
|
|
@@ -1797,34 +2117,34 @@ async function getOrBuildBundle(resolvedConfig) {
|
|
|
1797
2117
|
}
|
|
1798
2118
|
|
|
1799
2119
|
// src/tools/simulate.ts
|
|
1800
|
-
var
|
|
1801
|
-
var
|
|
1802
|
-
var
|
|
2120
|
+
var TITLE11 = "Simulate Flow";
|
|
2121
|
+
var DESCRIPTION11 = 'Simulate events through a walkerOS flow without making real API calls. For destinations: event is a walkerOS event { name: "entity action", data: {...} }. For sources: event is { content, trigger?: { type?, options? } }, where content is the walkerOS event { name: "entity action", data: {...} }. step (required) targets the step to simulate, e.g. "destination.gtag". Use flow_examples to discover available test data. IMPORTANT: Destinations with require (e.g. require: ["consent"]) stay pending until that collector event fires \u2014 simulation will error "not found" if require is not satisfied. Remove require from config or provide consent/user events before simulating. Separately, destinations with consent (e.g. consent: { marketing: true }) only receive events where the event includes matching consent. Mapping transforms event names and data at the destination level. Policy redacts or injects fields before mapping runs.';
|
|
2122
|
+
var inputSchema11 = {
|
|
1803
2123
|
configPath: schemas3.SimulateInputShape.configPath,
|
|
1804
|
-
event:
|
|
2124
|
+
event: z10.union([z10.record(z10.string(), z10.unknown()), z10.string()]).optional().describe(
|
|
1805
2125
|
"For destinations: { name, data, consent? }. Include consent (e.g. { marketing: true }) to satisfy destination consent requirements. For sources: { content, trigger? } where content is the walkerOS event { name, data }. Can also be a JSON string or file path."
|
|
1806
2126
|
),
|
|
1807
2127
|
flow: schemas3.SimulateInputShape.flow,
|
|
1808
2128
|
platform: schemas3.SimulateInputShape.platform,
|
|
1809
2129
|
// Override the (optional) CLI `step` shape: the simulate handler hard-requires
|
|
1810
2130
|
// a target step (no all-steps mode), so the registered schema must be honest.
|
|
1811
|
-
step:
|
|
2131
|
+
step: z10.string().describe(
|
|
1812
2132
|
'Required. Target step as "type.name" \u2014 e.g. "source.demo", "destination.gtag", "transformer.router".'
|
|
1813
2133
|
),
|
|
1814
|
-
verbose:
|
|
1815
|
-
ingest:
|
|
2134
|
+
verbose: z10.boolean().optional().describe("Include full payload per destination (default: false)"),
|
|
2135
|
+
ingest: z10.record(z10.string(), z10.unknown()).optional().describe(
|
|
1816
2136
|
"Pipeline context a transformer reads via ctx.ingest, e.g. { url } for a request decoder. Only used for transformer steps."
|
|
1817
2137
|
),
|
|
1818
|
-
state:
|
|
1819
|
-
consent:
|
|
1820
|
-
user:
|
|
1821
|
-
globals:
|
|
1822
|
-
timing:
|
|
2138
|
+
state: z10.object({
|
|
2139
|
+
consent: z10.record(z10.string(), z10.unknown()).optional(),
|
|
2140
|
+
user: z10.record(z10.string(), z10.unknown()).optional(),
|
|
2141
|
+
globals: z10.record(z10.string(), z10.unknown()).optional(),
|
|
2142
|
+
timing: z10.number().optional()
|
|
1823
2143
|
}).optional().describe(
|
|
1824
2144
|
"Collector-state snapshot for collector steps: consent/user/globals/timing. Seeds the collector before enrichment runs."
|
|
1825
2145
|
)
|
|
1826
2146
|
};
|
|
1827
|
-
var
|
|
2147
|
+
var annotations11 = {
|
|
1828
2148
|
readOnlyHint: true,
|
|
1829
2149
|
destructiveHint: false,
|
|
1830
2150
|
idempotentHint: true,
|
|
@@ -1833,10 +2153,10 @@ var annotations10 = {
|
|
|
1833
2153
|
function createFlowSimulateToolSpec(client) {
|
|
1834
2154
|
return {
|
|
1835
2155
|
name: "flow_simulate",
|
|
1836
|
-
title:
|
|
1837
|
-
description:
|
|
1838
|
-
inputSchema:
|
|
1839
|
-
annotations:
|
|
2156
|
+
title: TITLE11,
|
|
2157
|
+
description: DESCRIPTION11,
|
|
2158
|
+
inputSchema: inputSchema11,
|
|
2159
|
+
annotations: annotations11,
|
|
1840
2160
|
handler: (input) => flowSimulateHandlerBody(client, input)
|
|
1841
2161
|
};
|
|
1842
2162
|
}
|
|
@@ -1936,7 +2256,7 @@ async function flowSimulateHandlerBody(client, input) {
|
|
|
1936
2256
|
if (result.step === "source") {
|
|
1937
2257
|
const eventCount = result.events.length;
|
|
1938
2258
|
const summary = `Source captured ${eventCount} event${eventCount !== 1 ? "s" : ""}`;
|
|
1939
|
-
return
|
|
2259
|
+
return mcpResult11(
|
|
1940
2260
|
{
|
|
1941
2261
|
success,
|
|
1942
2262
|
error: errorMessage,
|
|
@@ -1954,7 +2274,7 @@ async function flowSimulateHandlerBody(client, input) {
|
|
|
1954
2274
|
);
|
|
1955
2275
|
}
|
|
1956
2276
|
if (result.step === "transformer") {
|
|
1957
|
-
return
|
|
2277
|
+
return mcpResult11(
|
|
1958
2278
|
{
|
|
1959
2279
|
success,
|
|
1960
2280
|
error: errorMessage,
|
|
@@ -1968,7 +2288,7 @@ async function flowSimulateHandlerBody(client, input) {
|
|
|
1968
2288
|
);
|
|
1969
2289
|
}
|
|
1970
2290
|
if (result.step === "collector") {
|
|
1971
|
-
return
|
|
2291
|
+
return mcpResult11(
|
|
1972
2292
|
{
|
|
1973
2293
|
success,
|
|
1974
2294
|
error: errorMessage,
|
|
@@ -2008,7 +2328,7 @@ async function flowSimulateHandlerBody(client, input) {
|
|
|
2008
2328
|
destinations,
|
|
2009
2329
|
duration: result.duration
|
|
2010
2330
|
};
|
|
2011
|
-
return
|
|
2331
|
+
return mcpResult11(resultObj, {
|
|
2012
2332
|
next: ["Use flow_bundle to build for production"],
|
|
2013
2333
|
...warnings.length > 0 ? { warnings } : {}
|
|
2014
2334
|
});
|
|
@@ -2018,7 +2338,7 @@ async function flowSimulateHandlerBody(client, input) {
|
|
|
2018
2338
|
if (msg.includes("not found in collector")) {
|
|
2019
2339
|
hint = 'If this destination has require: ["consent"] or require: ["user"], it stays pending until that event fires. For simulation, either remove require from the config or simulate with a flow that omits require on the target destination.';
|
|
2020
2340
|
}
|
|
2021
|
-
return
|
|
2341
|
+
return mcpError11(error, hint);
|
|
2022
2342
|
}
|
|
2023
2343
|
}
|
|
2024
2344
|
function registerFlowSimulateTool(server, client) {
|
|
@@ -2040,21 +2360,21 @@ function registerFlowSimulateTool(server, client) {
|
|
|
2040
2360
|
}
|
|
2041
2361
|
|
|
2042
2362
|
// src/tools/push.ts
|
|
2043
|
-
import { z as
|
|
2363
|
+
import { z as z11 } from "zod";
|
|
2044
2364
|
import { push } from "@walkeros/cli";
|
|
2045
2365
|
import { schemas as schemas4 } from "@walkeros/cli/dev";
|
|
2046
|
-
import { mcpResult as
|
|
2047
|
-
var
|
|
2048
|
-
var
|
|
2049
|
-
var
|
|
2366
|
+
import { mcpResult as mcpResult12, mcpError as mcpError12 } from "@walkeros/core";
|
|
2367
|
+
var TITLE12 = "Push Events";
|
|
2368
|
+
var DESCRIPTION12 = "Push a real event through a walkerOS flow to actual destinations. Makes real API calls to real endpoints. Best suited for server-side flows \u2014 web flows should use flow_simulate for testing.";
|
|
2369
|
+
var inputSchema12 = {
|
|
2050
2370
|
configPath: schemas4.PushInputShape.configPath,
|
|
2051
|
-
event:
|
|
2371
|
+
event: z11.record(z11.string(), z11.unknown()).describe(
|
|
2052
2372
|
'Event object, e.g. { name: "page view", data: { title: "Home" } }'
|
|
2053
2373
|
),
|
|
2054
2374
|
flow: schemas4.PushInputShape.flow,
|
|
2055
2375
|
platform: schemas4.PushInputShape.platform
|
|
2056
2376
|
};
|
|
2057
|
-
var
|
|
2377
|
+
var annotations12 = {
|
|
2058
2378
|
readOnlyHint: false,
|
|
2059
2379
|
destructiveHint: true,
|
|
2060
2380
|
idempotentHint: false,
|
|
@@ -2063,10 +2383,10 @@ var annotations11 = {
|
|
|
2063
2383
|
function createFlowPushToolSpec() {
|
|
2064
2384
|
return {
|
|
2065
2385
|
name: "flow_push",
|
|
2066
|
-
title:
|
|
2067
|
-
description:
|
|
2068
|
-
inputSchema:
|
|
2069
|
-
annotations:
|
|
2386
|
+
title: TITLE12,
|
|
2387
|
+
description: DESCRIPTION12,
|
|
2388
|
+
inputSchema: inputSchema12,
|
|
2389
|
+
annotations: annotations12,
|
|
2070
2390
|
handler: (input) => flowPushHandlerBody(input)
|
|
2071
2391
|
};
|
|
2072
2392
|
}
|
|
@@ -2079,14 +2399,14 @@ async function flowPushHandlerBody(input) {
|
|
|
2079
2399
|
platform
|
|
2080
2400
|
});
|
|
2081
2401
|
if (!result.success) {
|
|
2082
|
-
return
|
|
2402
|
+
return mcpError12(
|
|
2083
2403
|
new Error(result.error || "Push failed"),
|
|
2084
2404
|
"Check destination configuration and connectivity."
|
|
2085
2405
|
);
|
|
2086
2406
|
}
|
|
2087
|
-
return
|
|
2407
|
+
return mcpResult12(result);
|
|
2088
2408
|
} catch (error) {
|
|
2089
|
-
return
|
|
2409
|
+
return mcpError12(
|
|
2090
2410
|
error,
|
|
2091
2411
|
"Check configPath and event format. For web flows, use flow_simulate."
|
|
2092
2412
|
);
|
|
@@ -2111,16 +2431,16 @@ function registerFlowPushTool(server) {
|
|
|
2111
2431
|
}
|
|
2112
2432
|
|
|
2113
2433
|
// src/tools/examples.ts
|
|
2114
|
-
import { z as
|
|
2434
|
+
import { z as z12 } from "zod";
|
|
2115
2435
|
import { loadJsonConfig as loadJsonConfig2 } from "@walkeros/cli";
|
|
2116
|
-
import { fetchPackage, mcpResult as
|
|
2436
|
+
import { fetchPackage, mcpResult as mcpResult13, mcpError as mcpError13 } from "@walkeros/core";
|
|
2117
2437
|
|
|
2118
2438
|
// src/catalog.ts
|
|
2119
2439
|
var NPM_SEARCH_URL = "https://registry.npmjs.org/-/v1/search";
|
|
2120
2440
|
var JSDELIVR_BASE = "https://cdn.jsdelivr.net/npm";
|
|
2121
2441
|
var WALKEROS_JSON_PATH = "dist/walkerOS.json";
|
|
2122
2442
|
var CACHE_TTL = 5 * 60 * 1e3;
|
|
2123
|
-
var CLIENT_HEADER = "walkeros-mcp/4.3.
|
|
2443
|
+
var CLIENT_HEADER = "walkeros-mcp/4.3.2";
|
|
2124
2444
|
function getPackageBaseUrl() {
|
|
2125
2445
|
return process.env.WALKEROS_APP_URL || void 0;
|
|
2126
2446
|
}
|
|
@@ -2273,20 +2593,20 @@ function applyFilters(entries, filters) {
|
|
|
2273
2593
|
}
|
|
2274
2594
|
|
|
2275
2595
|
// src/tools/examples.ts
|
|
2276
|
-
var
|
|
2277
|
-
var
|
|
2278
|
-
var
|
|
2279
|
-
configPath:
|
|
2280
|
-
flow:
|
|
2281
|
-
step:
|
|
2282
|
-
full:
|
|
2596
|
+
var TITLE13 = "Flow Examples";
|
|
2597
|
+
var DESCRIPTION13 = 'List all step examples in a walkerOS flow configuration. Shows example names, step locations, and in/out shapes. Inline examples on a step take precedence; steps without inline examples fall back to the examples shipped by their referenced package. Each result is tagged with its source ("inline" or "package"). Use this to discover available test fixtures and simulation data.';
|
|
2598
|
+
var inputSchema13 = {
|
|
2599
|
+
configPath: z12.string().min(1).describe("Path to flow configuration file, URL, or inline JSON string"),
|
|
2600
|
+
flow: z12.string().optional().describe("Flow name for multi-flow configs"),
|
|
2601
|
+
step: z12.string().optional().describe('Filter to a specific step (e.g., "destination.gtag")'),
|
|
2602
|
+
full: z12.boolean().optional().describe(
|
|
2283
2603
|
"Return full in/out/mapping data for each example (default: false, returns metadata only)"
|
|
2284
2604
|
),
|
|
2285
|
-
includeHidden:
|
|
2605
|
+
includeHidden: z12.boolean().optional().describe(
|
|
2286
2606
|
"Include examples marked public: false (default: false). Set true for test/debug discovery."
|
|
2287
2607
|
)
|
|
2288
2608
|
};
|
|
2289
|
-
var
|
|
2609
|
+
var annotations13 = {
|
|
2290
2610
|
readOnlyHint: true,
|
|
2291
2611
|
destructiveHint: false,
|
|
2292
2612
|
idempotentHint: true,
|
|
@@ -2295,10 +2615,10 @@ var annotations12 = {
|
|
|
2295
2615
|
function createFlowExamplesToolSpec() {
|
|
2296
2616
|
return {
|
|
2297
2617
|
name: "flow_examples",
|
|
2298
|
-
title:
|
|
2299
|
-
description:
|
|
2300
|
-
inputSchema:
|
|
2301
|
-
annotations:
|
|
2618
|
+
title: TITLE13,
|
|
2619
|
+
description: DESCRIPTION13,
|
|
2620
|
+
inputSchema: inputSchema13,
|
|
2621
|
+
annotations: annotations13,
|
|
2302
2622
|
handler: (input) => flowExamplesHandlerBody(input)
|
|
2303
2623
|
};
|
|
2304
2624
|
}
|
|
@@ -2393,9 +2713,9 @@ async function flowExamplesHandlerBody(input) {
|
|
|
2393
2713
|
"No examples found. Add examples to step entries, or reference a package that ships examples (see package_get)."
|
|
2394
2714
|
];
|
|
2395
2715
|
}
|
|
2396
|
-
return
|
|
2716
|
+
return mcpResult13(result, hints);
|
|
2397
2717
|
} catch (error) {
|
|
2398
|
-
return
|
|
2718
|
+
return mcpError13(error, "Check configPath \u2014 expected a flow.json file");
|
|
2399
2719
|
}
|
|
2400
2720
|
}
|
|
2401
2721
|
function registerFlowExamplesTool(server) {
|
|
@@ -2417,9 +2737,9 @@ function registerFlowExamplesTool(server) {
|
|
|
2417
2737
|
}
|
|
2418
2738
|
|
|
2419
2739
|
// src/tools/flow-load.ts
|
|
2420
|
-
import { z as
|
|
2740
|
+
import { z as z13 } from "zod";
|
|
2421
2741
|
import { loadJsonConfig as loadJsonConfig3 } from "@walkeros/cli";
|
|
2422
|
-
import { mcpResult as
|
|
2742
|
+
import { mcpResult as mcpResult14, mcpError as mcpError14 } from "@walkeros/core";
|
|
2423
2743
|
var API_ID_PREFIX2 = /^(flow|cfg)_/;
|
|
2424
2744
|
var WEB_SKELETON = {
|
|
2425
2745
|
version: 4,
|
|
@@ -2441,21 +2761,21 @@ var SERVER_SKELETON = {
|
|
|
2441
2761
|
}
|
|
2442
2762
|
}
|
|
2443
2763
|
};
|
|
2444
|
-
var
|
|
2445
|
-
var
|
|
2446
|
-
var
|
|
2447
|
-
source:
|
|
2764
|
+
var TITLE14 = "Load or Create Flow";
|
|
2765
|
+
var DESCRIPTION14 = "Load an existing flow configuration from a local file path, URL, or walkerOS API (by flow ID). Or create a new empty flow by specifying a platform (web or server). Use the add-step prompt to add sources, destinations, transformers, or stores to the flow.";
|
|
2766
|
+
var inputSchema14 = {
|
|
2767
|
+
source: z13.string().optional().describe(
|
|
2448
2768
|
"Flow source: local file path (./flow.json), URL (https://...), inline JSON string, or API flow ID (cfg_...). Omit to create a new flow."
|
|
2449
2769
|
),
|
|
2450
|
-
platform:
|
|
2770
|
+
platform: z13.enum(["web", "server"]).optional().describe(
|
|
2451
2771
|
"Platform for new flows. Required when source is omitted. web = browser tracking, server = Node.js HTTP."
|
|
2452
2772
|
)
|
|
2453
2773
|
};
|
|
2454
2774
|
var outputSchema = {
|
|
2455
|
-
version:
|
|
2456
|
-
flows:
|
|
2775
|
+
version: z13.number().describe("Flow config version"),
|
|
2776
|
+
flows: z13.record(z13.string(), z13.unknown()).describe("Flow entries")
|
|
2457
2777
|
};
|
|
2458
|
-
var
|
|
2778
|
+
var annotations14 = {
|
|
2459
2779
|
readOnlyHint: true,
|
|
2460
2780
|
destructiveHint: false,
|
|
2461
2781
|
idempotentHint: true,
|
|
@@ -2464,10 +2784,10 @@ var annotations13 = {
|
|
|
2464
2784
|
function createFlowLoadToolSpec(client) {
|
|
2465
2785
|
return {
|
|
2466
2786
|
name: "flow_load",
|
|
2467
|
-
title:
|
|
2468
|
-
description:
|
|
2469
|
-
inputSchema:
|
|
2470
|
-
annotations:
|
|
2787
|
+
title: TITLE14,
|
|
2788
|
+
description: DESCRIPTION14,
|
|
2789
|
+
inputSchema: inputSchema14,
|
|
2790
|
+
annotations: annotations14,
|
|
2471
2791
|
handler: (input) => flowLoadHandlerBody(client, input)
|
|
2472
2792
|
};
|
|
2473
2793
|
}
|
|
@@ -2476,7 +2796,7 @@ async function flowLoadHandlerBody(client, input) {
|
|
|
2476
2796
|
if (source && API_ID_PREFIX2.test(source)) {
|
|
2477
2797
|
const resolvedProjectId = resolveDefaultProject(client, void 0);
|
|
2478
2798
|
if (!resolvedProjectId) {
|
|
2479
|
-
return
|
|
2799
|
+
return mcpError14(new Error(NO_DEFAULT_PROJECT_ERROR));
|
|
2480
2800
|
}
|
|
2481
2801
|
try {
|
|
2482
2802
|
const flow = await client.getFlow({
|
|
@@ -2484,32 +2804,32 @@ async function flowLoadHandlerBody(client, input) {
|
|
|
2484
2804
|
projectId: resolvedProjectId
|
|
2485
2805
|
});
|
|
2486
2806
|
const config = flow.config;
|
|
2487
|
-
return
|
|
2807
|
+
return mcpResult14(
|
|
2488
2808
|
redactNestedStrings(config ?? {}, { skip: keepStructural }),
|
|
2489
2809
|
{
|
|
2490
2810
|
next: ["Use flow_validate to check", "Use add-step prompt to modify"]
|
|
2491
2811
|
}
|
|
2492
2812
|
);
|
|
2493
2813
|
} catch (error) {
|
|
2494
|
-
return
|
|
2814
|
+
return mcpError14(error, isAuthError(error) ? AUTH_HINT : void 0);
|
|
2495
2815
|
}
|
|
2496
2816
|
}
|
|
2497
2817
|
try {
|
|
2498
2818
|
if (source) {
|
|
2499
2819
|
const config = await loadJsonConfig3(source);
|
|
2500
|
-
return
|
|
2820
|
+
return mcpResult14(redactNestedStrings(config, { skip: keepStructural }), {
|
|
2501
2821
|
next: ["Use flow_validate to check", "Use add-step prompt to modify"]
|
|
2502
2822
|
});
|
|
2503
2823
|
}
|
|
2504
2824
|
if (!platform) {
|
|
2505
|
-
return
|
|
2825
|
+
return mcpError14(
|
|
2506
2826
|
new Error(
|
|
2507
2827
|
"Provide source (file path, URL, or flow ID) to load existing flow, or platform (web/server) to create a new one."
|
|
2508
2828
|
)
|
|
2509
2829
|
);
|
|
2510
2830
|
}
|
|
2511
2831
|
const skeleton = platform === "web" ? WEB_SKELETON : SERVER_SKELETON;
|
|
2512
|
-
return
|
|
2832
|
+
return mcpResult14(skeleton, {
|
|
2513
2833
|
next: [
|
|
2514
2834
|
"Read walkeros://reference/flow-schema for config structure",
|
|
2515
2835
|
"Use add-step prompt to add sources and destinations"
|
|
@@ -2518,8 +2838,8 @@ async function flowLoadHandlerBody(client, input) {
|
|
|
2518
2838
|
} catch (error) {
|
|
2519
2839
|
const msg = error instanceof Error ? error.message : "";
|
|
2520
2840
|
if (msg.includes("not found") || msg.includes("ENOENT"))
|
|
2521
|
-
return
|
|
2522
|
-
return
|
|
2841
|
+
return mcpError14(error, "Check configPath \u2014 expected a flow.json file");
|
|
2842
|
+
return mcpError14(error);
|
|
2523
2843
|
}
|
|
2524
2844
|
}
|
|
2525
2845
|
function registerFlowLoadTool(server, client) {
|
|
@@ -2541,18 +2861,18 @@ function registerFlowLoadTool(server, client) {
|
|
|
2541
2861
|
}
|
|
2542
2862
|
|
|
2543
2863
|
// src/tools/package.ts
|
|
2544
|
-
import { z as
|
|
2545
|
-
import { fetchPackage as fetchPackage2, mcpResult as
|
|
2864
|
+
import { z as z14 } from "zod";
|
|
2865
|
+
import { fetchPackage as fetchPackage2, mcpResult as mcpResult15, mcpError as mcpError15 } from "@walkeros/core";
|
|
2546
2866
|
import { mergeConfigSchema } from "@walkeros/core/dev";
|
|
2547
2867
|
var SEARCH_TITLE = "Search Package";
|
|
2548
2868
|
var SEARCH_DESCRIPTION = "Start here for package discovery. Never guess package names: use this tool first to find exact names. Without package name: returns catalog filtered by type/platform. With package name: returns metadata, hint keys, and example summaries.";
|
|
2549
2869
|
var searchInputSchema = {
|
|
2550
|
-
package:
|
|
2870
|
+
package: z14.string().min(1).optional().describe(
|
|
2551
2871
|
"Exact npm package name for detailed lookup (e.g., @walkeros/web-destination-snowplow)"
|
|
2552
2872
|
),
|
|
2553
|
-
type:
|
|
2554
|
-
platform:
|
|
2555
|
-
version:
|
|
2873
|
+
type: z14.enum(["source", "destination", "transformer", "store"]).optional().describe("Filter by package type (browse mode)"),
|
|
2874
|
+
platform: z14.enum(["web", "server"]).optional().describe("Filter by platform (browse mode, includes universal packages)"),
|
|
2875
|
+
version: z14.string().optional().describe("Package version for detailed lookup (default: latest)")
|
|
2556
2876
|
};
|
|
2557
2877
|
var searchAnnotations = {
|
|
2558
2878
|
readOnlyHint: true,
|
|
@@ -2585,7 +2905,7 @@ async function packageSearchHandlerBody(input) {
|
|
|
2585
2905
|
baseUrl
|
|
2586
2906
|
});
|
|
2587
2907
|
const result = { catalog: entries, count: entries.length };
|
|
2588
|
-
return
|
|
2908
|
+
return mcpResult15(result, {
|
|
2589
2909
|
next: ["Use package_get for schemas and examples"],
|
|
2590
2910
|
...warnings.length > 0 ? { warnings } : {}
|
|
2591
2911
|
});
|
|
@@ -2605,11 +2925,11 @@ async function packageSearchHandlerBody(input) {
|
|
|
2605
2925
|
hintKeys: info.hintKeys,
|
|
2606
2926
|
exampleSummaries: info.exampleSummaries
|
|
2607
2927
|
};
|
|
2608
|
-
return
|
|
2928
|
+
return mcpResult15(result, {
|
|
2609
2929
|
next: ["Use package_get for schemas and examples"]
|
|
2610
2930
|
});
|
|
2611
2931
|
} catch (error) {
|
|
2612
|
-
return
|
|
2932
|
+
return mcpError15(
|
|
2613
2933
|
error,
|
|
2614
2934
|
"Package not found. Use package_search without parameters to browse available packages."
|
|
2615
2935
|
);
|
|
@@ -2634,11 +2954,11 @@ function registerPackageSearchTool(server) {
|
|
|
2634
2954
|
var GET_TITLE = "Get Package";
|
|
2635
2955
|
var GET_DESCRIPTION = 'Requires exact package name: do not guess names, use package_search first to find them. Returns schemas + hint texts + example summaries by default (lightweight). Use section parameter for full content: "hints" (with code blocks), "examples" (full in/out data), or "all".';
|
|
2636
2956
|
var getInputSchema = {
|
|
2637
|
-
package:
|
|
2957
|
+
package: z14.string().min(1).describe(
|
|
2638
2958
|
"Exact npm package name (e.g., @walkeros/web-destination-snowplow)"
|
|
2639
2959
|
),
|
|
2640
|
-
version:
|
|
2641
|
-
section:
|
|
2960
|
+
version: z14.string().optional().describe("Package version (default: latest)"),
|
|
2961
|
+
section: z14.enum(["hints", "examples", "all"]).optional().describe(
|
|
2642
2962
|
"Section to expand with full content. Default: summary view with schemas + hint texts + example descriptions"
|
|
2643
2963
|
)
|
|
2644
2964
|
};
|
|
@@ -2707,9 +3027,9 @@ async function packageGetHandlerBody(input) {
|
|
|
2707
3027
|
} else {
|
|
2708
3028
|
result.exampleSummaries = info.exampleSummaries;
|
|
2709
3029
|
}
|
|
2710
|
-
return
|
|
3030
|
+
return mcpResult15(result);
|
|
2711
3031
|
} catch (error) {
|
|
2712
|
-
return
|
|
3032
|
+
return mcpError15(
|
|
2713
3033
|
error,
|
|
2714
3034
|
"Use package_search to browse available package names."
|
|
2715
3035
|
);
|
|
@@ -2733,7 +3053,7 @@ function registerGetPackageSchemaTool(server) {
|
|
|
2733
3053
|
}
|
|
2734
3054
|
|
|
2735
3055
|
// src/tools/diagnostics.ts
|
|
2736
|
-
import { mcpResult as
|
|
3056
|
+
import { mcpResult as mcpResult16 } from "@walkeros/core";
|
|
2737
3057
|
import {
|
|
2738
3058
|
VERSION as CLI_VERSION,
|
|
2739
3059
|
resolveAppUrl,
|
|
@@ -2745,7 +3065,7 @@ var spec_default = {
|
|
|
2745
3065
|
openapi: "3.1.0",
|
|
2746
3066
|
info: {
|
|
2747
3067
|
title: "walkerOS Tag Manager API",
|
|
2748
|
-
version: "4.
|
|
3068
|
+
version: "4.1.0",
|
|
2749
3069
|
description: "API for managing walkerOS flows, projects, and real-time event observation.",
|
|
2750
3070
|
contact: {
|
|
2751
3071
|
name: "elbwalker",
|
|
@@ -5064,6 +5384,9 @@ var spec_default = {
|
|
|
5064
5384
|
},
|
|
5065
5385
|
sessionGrant: {
|
|
5066
5386
|
type: "string"
|
|
5387
|
+
},
|
|
5388
|
+
sessionId: {
|
|
5389
|
+
type: "string"
|
|
5067
5390
|
}
|
|
5068
5391
|
},
|
|
5069
5392
|
required: ["grant", "activationUrl", "sessionExpiresAt"]
|
|
@@ -5159,6 +5482,13 @@ var spec_default = {
|
|
|
5159
5482
|
bundleUrl: {
|
|
5160
5483
|
type: "string",
|
|
5161
5484
|
format: "uri"
|
|
5485
|
+
},
|
|
5486
|
+
url: {
|
|
5487
|
+
type: "string",
|
|
5488
|
+
format: "uri"
|
|
5489
|
+
},
|
|
5490
|
+
binding: {
|
|
5491
|
+
type: "string"
|
|
5162
5492
|
}
|
|
5163
5493
|
},
|
|
5164
5494
|
required: [
|
|
@@ -17114,10 +17444,10 @@ var spec_default = {
|
|
|
17114
17444
|
|
|
17115
17445
|
// src/tools/diagnostics.ts
|
|
17116
17446
|
var CONTRACT_OPENAPI_VERSION = spec_default.info.version;
|
|
17117
|
-
var
|
|
17118
|
-
var
|
|
17119
|
-
var
|
|
17120
|
-
var
|
|
17447
|
+
var TITLE15 = "Diagnostics";
|
|
17448
|
+
var DESCRIPTION15 = "Report the MCP runtime surface: MCP and CLI versions, the resolved app URL and its source, app /api/health reachability, the bundled OpenAPI contract version, and which source served the last package catalog fetch. Read-only and callable when logged out; use it when a request fails to see which versions and backend you are on.";
|
|
17449
|
+
var inputSchema15 = {};
|
|
17450
|
+
var annotations15 = {
|
|
17121
17451
|
readOnlyHint: true,
|
|
17122
17452
|
destructiveHint: false,
|
|
17123
17453
|
idempotentHint: true,
|
|
@@ -17126,10 +17456,10 @@ var annotations14 = {
|
|
|
17126
17456
|
function createDiagnosticsToolSpec(client, packageVersion) {
|
|
17127
17457
|
return {
|
|
17128
17458
|
name: "diagnostics",
|
|
17129
|
-
title:
|
|
17130
|
-
description:
|
|
17131
|
-
inputSchema:
|
|
17132
|
-
annotations:
|
|
17459
|
+
title: TITLE15,
|
|
17460
|
+
description: DESCRIPTION15,
|
|
17461
|
+
inputSchema: inputSchema15,
|
|
17462
|
+
annotations: annotations15,
|
|
17133
17463
|
handler: () => diagnosticsHandlerBody(client, packageVersion)
|
|
17134
17464
|
};
|
|
17135
17465
|
}
|
|
@@ -17188,7 +17518,7 @@ async function diagnosticsHandlerBody(client, packageVersion) {
|
|
|
17188
17518
|
partial: catalogInfo.partial
|
|
17189
17519
|
} : { lastSource: void 0, lastCount: void 0, partial: void 0 }
|
|
17190
17520
|
};
|
|
17191
|
-
return
|
|
17521
|
+
return mcpResult16(result, warnings.length > 0 ? { warnings } : void 0);
|
|
17192
17522
|
}
|
|
17193
17523
|
function registerDiagnosticsTool(server, client, packageVersion) {
|
|
17194
17524
|
const spec = createDiagnosticsToolSpec(client, packageVersion);
|
|
@@ -17479,17 +17809,17 @@ function registerReferenceResources(server) {
|
|
|
17479
17809
|
}
|
|
17480
17810
|
|
|
17481
17811
|
// src/prompts/add-step.ts
|
|
17482
|
-
import { z as
|
|
17812
|
+
import { z as z15 } from "zod";
|
|
17483
17813
|
function registerAddStepPrompt(server) {
|
|
17484
17814
|
server.registerPrompt(
|
|
17485
17815
|
"add-step",
|
|
17486
17816
|
{
|
|
17487
17817
|
description: "Add a source, destination, transformer, or store step to a flow configuration. Guides through package selection, config scaffolding, and wiring.",
|
|
17488
17818
|
argsSchema: {
|
|
17489
|
-
stepType:
|
|
17819
|
+
stepType: z15.string().optional().describe(
|
|
17490
17820
|
"Type of step to add: source, destination, transformer, or store"
|
|
17491
17821
|
),
|
|
17492
|
-
flowPath:
|
|
17822
|
+
flowPath: z15.string().optional().describe("Path to the flow.json file to modify")
|
|
17493
17823
|
}
|
|
17494
17824
|
},
|
|
17495
17825
|
async ({ stepType, flowPath }) => ({
|
|
@@ -17534,14 +17864,14 @@ function registerAddStepPrompt(server) {
|
|
|
17534
17864
|
}
|
|
17535
17865
|
|
|
17536
17866
|
// src/prompts/setup-mapping.ts
|
|
17537
|
-
import { z as
|
|
17867
|
+
import { z as z16 } from "zod";
|
|
17538
17868
|
function registerSetupMappingPrompt(server) {
|
|
17539
17869
|
server.registerPrompt(
|
|
17540
17870
|
"setup-mapping",
|
|
17541
17871
|
{
|
|
17542
17872
|
description: "Set up event mapping for any step in a flow. Teaches mapping syntax and uses package examples as templates.",
|
|
17543
17873
|
argsSchema: {
|
|
17544
|
-
stepName:
|
|
17874
|
+
stepName: z16.string().optional().describe('Step name in the flow (e.g., "gtag", "meta", "express")')
|
|
17545
17875
|
}
|
|
17546
17876
|
},
|
|
17547
17877
|
async ({ stepName }) => ({
|
|
@@ -17579,14 +17909,14 @@ function registerSetupMappingPrompt(server) {
|
|
|
17579
17909
|
}
|
|
17580
17910
|
|
|
17581
17911
|
// src/prompts/manage-contract.ts
|
|
17582
|
-
import { z as
|
|
17912
|
+
import { z as z17 } from "zod";
|
|
17583
17913
|
function registerManageContractPrompt(server) {
|
|
17584
17914
|
server.registerPrompt(
|
|
17585
17915
|
"manage-contract",
|
|
17586
17916
|
{
|
|
17587
17917
|
description: "Create or update event contracts for a flow. Can generate contracts from existing mappings or scaffold mappings from contracts.",
|
|
17588
17918
|
argsSchema: {
|
|
17589
|
-
direction:
|
|
17919
|
+
direction: z17.string().optional().describe(
|
|
17590
17920
|
'Direction: "from-mappings" (extract contract from existing mappings), "from-scratch" (create new contract), or "to-mappings" (scaffold mappings from contract)'
|
|
17591
17921
|
)
|
|
17592
17922
|
}
|
|
@@ -17648,6 +17978,9 @@ var SERVER_INSTRUCTIONS = `walkerOS is an open-source, privacy-first event data
|
|
|
17648
17978
|
10. \`flow_simulate({ configPath: "flow.json", event: "..." })\` \u2014 test
|
|
17649
17979
|
11. \`flow_manage({ action: "update", flowId: "...", content: {...} })\` \u2014 save to cloud
|
|
17650
17980
|
12. \`deploy_manage({ action: "deploy", flowId: "..." })\` \u2014 deploy
|
|
17981
|
+
13. \`observe_session({ action: "start", flowId: "..." })\` - open an Observe session: a time-boxed window on one flow that runtimes attach to as arms
|
|
17982
|
+
14. \`flow_manage({ action: "preview_regrant", flowId: "...", previewId: "...", origins: [...] })\` - mint an activation link; minted while the flow is observed, it pairs with that Observe session automatically, so the previewed page streams into the same feed
|
|
17983
|
+
15. \`observe_journeys({ flowId: "..." })\` - read what arrived; it is the only read, and it never judges whether events are correct
|
|
17651
17984
|
|
|
17652
17985
|
## Architecture: Source \u2192 Collector \u2192 Destination(s)
|
|
17653
17986
|
|
|
@@ -17775,6 +18108,7 @@ function createWalkerOSMcpServer(opts) {
|
|
|
17775
18108
|
registerFlowManageTool(server, opts.client);
|
|
17776
18109
|
registerDeployTool(server, opts.client);
|
|
17777
18110
|
registerSecretManageTool(server, opts.client);
|
|
18111
|
+
registerObserveSessionTool(server, opts.client);
|
|
17778
18112
|
registerObserveJourneysTool(server, opts.client);
|
|
17779
18113
|
registerFeedbackTool(server, opts.client);
|
|
17780
18114
|
registerDiagnosticsTool(server, opts.client, packageVersion);
|
|
@@ -17841,6 +18175,9 @@ import {
|
|
|
17841
18175
|
getDeploymentBySlug,
|
|
17842
18176
|
deleteDeployment,
|
|
17843
18177
|
listJourneys,
|
|
18178
|
+
startObserveSession,
|
|
18179
|
+
getObserveSession,
|
|
18180
|
+
endObserveSession,
|
|
17844
18181
|
requestDeviceCode,
|
|
17845
18182
|
pollForToken,
|
|
17846
18183
|
whoami,
|
|
@@ -17936,6 +18273,21 @@ var HttpToolClient = class {
|
|
|
17936
18273
|
async listJourneys(options) {
|
|
17937
18274
|
return listJourneys(options);
|
|
17938
18275
|
}
|
|
18276
|
+
/**
|
|
18277
|
+
* Observe session lifecycle over the CLI's authenticated boundary. The trio
|
|
18278
|
+
* routes through the same `apiFetch` as every other method here, so token
|
|
18279
|
+
* resolution, base URL, and `ApiError` shaping (which `isAuthError` reads)
|
|
18280
|
+
* stay identical to the rest of the client.
|
|
18281
|
+
*/
|
|
18282
|
+
async startObserveSession(options) {
|
|
18283
|
+
return startObserveSession(options);
|
|
18284
|
+
}
|
|
18285
|
+
async getObserveSession(options) {
|
|
18286
|
+
return getObserveSession(options);
|
|
18287
|
+
}
|
|
18288
|
+
async endObserveSession(options) {
|
|
18289
|
+
return endObserveSession(options);
|
|
18290
|
+
}
|
|
17939
18291
|
async requestDeviceCode() {
|
|
17940
18292
|
return requestDeviceCode();
|
|
17941
18293
|
}
|
|
@@ -18007,7 +18359,7 @@ function createStreamableHttpHandler(server, opts = {}) {
|
|
|
18007
18359
|
}
|
|
18008
18360
|
|
|
18009
18361
|
// src/tool-definitions.ts
|
|
18010
|
-
import { z as
|
|
18362
|
+
import { z as z18 } from "zod";
|
|
18011
18363
|
import { schemas as schemas6 } from "@walkeros/cli/dev";
|
|
18012
18364
|
var TOOL_DEFINITIONS = [
|
|
18013
18365
|
{
|
|
@@ -18015,8 +18367,8 @@ var TOOL_DEFINITIONS = [
|
|
|
18015
18367
|
title: "Authentication",
|
|
18016
18368
|
description: "Manage walkerOS authentication. Check login status, log in via device code flow, or log out. No terminal or browser required, the MCP client handles the authorization URL.",
|
|
18017
18369
|
inputSchema: {
|
|
18018
|
-
action:
|
|
18019
|
-
deviceCode:
|
|
18370
|
+
action: z18.enum(["status", "login", "logout"]),
|
|
18371
|
+
deviceCode: z18.string().optional()
|
|
18020
18372
|
},
|
|
18021
18373
|
annotations: {
|
|
18022
18374
|
readOnlyHint: false,
|
|
@@ -18030,7 +18382,7 @@ var TOOL_DEFINITIONS = [
|
|
|
18030
18382
|
title: "Project Management",
|
|
18031
18383
|
description: "Manage walkerOS projects. List, create, update, delete projects, or set a default project for CLI operations.",
|
|
18032
18384
|
inputSchema: {
|
|
18033
|
-
action:
|
|
18385
|
+
action: z18.enum([
|
|
18034
18386
|
"list",
|
|
18035
18387
|
"get",
|
|
18036
18388
|
"create",
|
|
@@ -18038,8 +18390,8 @@ var TOOL_DEFINITIONS = [
|
|
|
18038
18390
|
"delete",
|
|
18039
18391
|
"set_default"
|
|
18040
18392
|
]),
|
|
18041
|
-
projectId:
|
|
18042
|
-
name:
|
|
18393
|
+
projectId: z18.string().optional(),
|
|
18394
|
+
name: z18.string().optional()
|
|
18043
18395
|
},
|
|
18044
18396
|
annotations: {
|
|
18045
18397
|
readOnlyHint: false,
|
|
@@ -18053,7 +18405,7 @@ var TOOL_DEFINITIONS = [
|
|
|
18053
18405
|
title: "Flow Management",
|
|
18054
18406
|
description: "Manage walkerOS flows and their previews. List/get/create/update/delete/duplicate flows, or create/inspect/delete preview bundles for testing flow changes on live sites.",
|
|
18055
18407
|
inputSchema: {
|
|
18056
|
-
action:
|
|
18408
|
+
action: z18.enum([
|
|
18057
18409
|
"list",
|
|
18058
18410
|
"get",
|
|
18059
18411
|
"create",
|
|
@@ -18065,19 +18417,19 @@ var TOOL_DEFINITIONS = [
|
|
|
18065
18417
|
"preview_create",
|
|
18066
18418
|
"preview_delete"
|
|
18067
18419
|
]),
|
|
18068
|
-
flowId:
|
|
18069
|
-
projectId:
|
|
18070
|
-
name:
|
|
18071
|
-
content:
|
|
18072
|
-
patch:
|
|
18073
|
-
fields:
|
|
18074
|
-
sort:
|
|
18075
|
-
order:
|
|
18076
|
-
includeDeleted:
|
|
18077
|
-
previewId:
|
|
18078
|
-
flowName:
|
|
18079
|
-
flowSettingsId:
|
|
18080
|
-
siteUrl:
|
|
18420
|
+
flowId: z18.string().optional(),
|
|
18421
|
+
projectId: z18.string().optional(),
|
|
18422
|
+
name: z18.string().optional(),
|
|
18423
|
+
content: z18.record(z18.string(), z18.unknown()).optional(),
|
|
18424
|
+
patch: z18.boolean().optional(),
|
|
18425
|
+
fields: z18.array(z18.string()).optional(),
|
|
18426
|
+
sort: z18.enum(["name", "updated_at", "created_at"]).optional(),
|
|
18427
|
+
order: z18.enum(["asc", "desc"]).optional(),
|
|
18428
|
+
includeDeleted: z18.boolean().optional(),
|
|
18429
|
+
previewId: z18.string().optional(),
|
|
18430
|
+
flowName: z18.string().optional(),
|
|
18431
|
+
flowSettingsId: z18.string().optional(),
|
|
18432
|
+
siteUrl: z18.string().optional()
|
|
18081
18433
|
},
|
|
18082
18434
|
annotations: {
|
|
18083
18435
|
readOnlyHint: false,
|
|
@@ -18091,14 +18443,14 @@ var TOOL_DEFINITIONS = [
|
|
|
18091
18443
|
title: "Deploy Management",
|
|
18092
18444
|
description: "Deploy walkerOS flows and manage deployments. For get/delete actions pass flowId (required) plus optional slug to disambiguate when a flow has multiple active deployments. If a flow has >=2 active deployments and no slug is supplied, the tool returns a MULTIPLE_DEPLOYMENTS error with a details[] list showing each deployment's slug, type, status, and updatedAt.",
|
|
18093
18445
|
inputSchema: {
|
|
18094
|
-
action:
|
|
18095
|
-
projectId:
|
|
18096
|
-
flowId:
|
|
18097
|
-
slug:
|
|
18098
|
-
type:
|
|
18099
|
-
status:
|
|
18100
|
-
wait:
|
|
18101
|
-
flowName:
|
|
18446
|
+
action: z18.enum(["deploy", "list", "get", "delete"]),
|
|
18447
|
+
projectId: z18.string().optional(),
|
|
18448
|
+
flowId: z18.string().optional(),
|
|
18449
|
+
slug: z18.string().optional(),
|
|
18450
|
+
type: z18.enum(["web", "server"]).optional(),
|
|
18451
|
+
status: z18.string().optional(),
|
|
18452
|
+
wait: z18.boolean().optional(),
|
|
18453
|
+
flowName: z18.string().optional()
|
|
18102
18454
|
},
|
|
18103
18455
|
annotations: {
|
|
18104
18456
|
readOnlyHint: false,
|
|
@@ -18112,12 +18464,36 @@ var TOOL_DEFINITIONS = [
|
|
|
18112
18464
|
title: "Secret Management",
|
|
18113
18465
|
description: "Manage a flow\u2019s managed secrets (the $secret.<NAME> values its steps reference at deploy/run time). Actions: list (metadata only), set (create), update (rotate value), delete. Secrets are write-mostly: values are encrypted at rest and are NEVER returned, listed, or echoed. Reference a secret from a flow step as $secret.<NAME> (credentials, tokens, and private keys use $secret, not $env).",
|
|
18114
18466
|
inputSchema: {
|
|
18115
|
-
action:
|
|
18116
|
-
projectId:
|
|
18117
|
-
flowId:
|
|
18118
|
-
name:
|
|
18119
|
-
value:
|
|
18120
|
-
secretId:
|
|
18467
|
+
action: z18.enum(["list", "set", "update", "delete"]),
|
|
18468
|
+
projectId: z18.string().optional(),
|
|
18469
|
+
flowId: z18.string(),
|
|
18470
|
+
name: z18.string().optional(),
|
|
18471
|
+
value: z18.string().optional(),
|
|
18472
|
+
secretId: z18.string().optional()
|
|
18473
|
+
},
|
|
18474
|
+
annotations: {
|
|
18475
|
+
readOnlyHint: false,
|
|
18476
|
+
destructiveHint: true,
|
|
18477
|
+
idempotentHint: false,
|
|
18478
|
+
openWorldHint: true
|
|
18479
|
+
}
|
|
18480
|
+
},
|
|
18481
|
+
{
|
|
18482
|
+
name: "observe_session",
|
|
18483
|
+
title: "Observe Session",
|
|
18484
|
+
description: "Open, inspect, or end an Observe session: a time-boxed window on one flow that runtimes attach to as arms. A preview arm streams from a browser, a container arm runs server-side, and both feed ONE shared journeys feed. start opens the window (arms picks which runtimes attach), status reports per-arm state plus recordsReceived and expiresAt, stop ends the whole session including every arm. A flow has at most one session, so status/stop resolve it from flowId when sessionId is omitted. Read the events with observe_journeys; this tool never returns event data and never judges whether events are correct.",
|
|
18485
|
+
inputSchema: {
|
|
18486
|
+
action: z18.enum(["start", "status", "stop"]),
|
|
18487
|
+
flowId: z18.string(),
|
|
18488
|
+
projectId: z18.string().optional(),
|
|
18489
|
+
sessionId: z18.string().optional(),
|
|
18490
|
+
arms: z18.object({
|
|
18491
|
+
container: z18.literal(true).optional(),
|
|
18492
|
+
preview: z18.string().optional()
|
|
18493
|
+
}).optional(),
|
|
18494
|
+
origins: z18.array(z18.string()).optional(),
|
|
18495
|
+
level: z18.enum(["off", "standard", "trace"]).optional(),
|
|
18496
|
+
replace: z18.boolean().optional()
|
|
18121
18497
|
},
|
|
18122
18498
|
annotations: {
|
|
18123
18499
|
readOnlyHint: false,
|
|
@@ -18131,10 +18507,10 @@ var TOOL_DEFINITIONS = [
|
|
|
18131
18507
|
title: "Observe Journeys",
|
|
18132
18508
|
description: "Read the assembled, cross-runtime journeys for a flow that is currently being observed (an active Observe session). Pass flowId; the active session is resolved for you (a flow has at most one). Each journey is one traced event reconstructed end to end across web and server: its ordered hops, per-hop status, captured in/out payloads, consent, and vendor calls. When the flow has no active session the result is { sessionId: null, journeys: [], gaps: [] }. Narrow with traceId (one trace) and limit (1-100, most recent kept; default 50). Read-only.",
|
|
18133
18509
|
inputSchema: {
|
|
18134
|
-
flowId:
|
|
18135
|
-
projectId:
|
|
18136
|
-
traceId:
|
|
18137
|
-
limit:
|
|
18510
|
+
flowId: z18.string(),
|
|
18511
|
+
projectId: z18.string().optional(),
|
|
18512
|
+
traceId: z18.string().optional(),
|
|
18513
|
+
limit: z18.number().int().min(1).max(100).optional()
|
|
18138
18514
|
},
|
|
18139
18515
|
annotations: {
|
|
18140
18516
|
readOnlyHint: true,
|
|
@@ -18161,8 +18537,8 @@ var TOOL_DEFINITIONS = [
|
|
|
18161
18537
|
description: "Bundle a walkerOS flow configuration into deployable JavaScript. Resolves all destinations, sources, and transformers, then outputs a tree-shaken production bundle. Returns bundle statistics. Set remote: true to use the walkerOS cloud service instead of local build tools.",
|
|
18162
18538
|
inputSchema: {
|
|
18163
18539
|
...schemas6.BundleInputShape,
|
|
18164
|
-
remote:
|
|
18165
|
-
content:
|
|
18540
|
+
remote: z18.boolean().optional(),
|
|
18541
|
+
content: z18.record(z18.string(), z18.unknown()).optional()
|
|
18166
18542
|
},
|
|
18167
18543
|
annotations: {
|
|
18168
18544
|
readOnlyHint: false,
|
|
@@ -18177,11 +18553,11 @@ var TOOL_DEFINITIONS = [
|
|
|
18177
18553
|
description: 'Simulate events through a walkerOS flow without making real API calls. For destinations: event is a walkerOS event { name: "entity action", data: {...} }. For sources: event is { content: ..., trigger?: { type?, options? }, env?: {...} }. Use step to target a specific step. Use flow_examples to discover available test data. IMPORTANT: Destinations with require (e.g. require: ["consent"]) stay pending until that collector event fires, simulation will error "not found" if require is not satisfied. Remove require from config or provide consent/user events before simulating. Separately, destinations with consent (e.g. consent: { marketing: true }) only receive events where the event includes matching consent. Mapping transforms event names and data at the destination level. Policy redacts or injects fields before mapping runs.',
|
|
18178
18554
|
inputSchema: {
|
|
18179
18555
|
configPath: schemas6.SimulateInputShape.configPath,
|
|
18180
|
-
event:
|
|
18556
|
+
event: z18.union([z18.record(z18.string(), z18.unknown()), z18.string()]).optional(),
|
|
18181
18557
|
flow: schemas6.SimulateInputShape.flow,
|
|
18182
18558
|
platform: schemas6.SimulateInputShape.platform,
|
|
18183
18559
|
step: schemas6.SimulateInputShape.step,
|
|
18184
|
-
verbose:
|
|
18560
|
+
verbose: z18.boolean().optional()
|
|
18185
18561
|
},
|
|
18186
18562
|
annotations: {
|
|
18187
18563
|
readOnlyHint: true,
|
|
@@ -18196,7 +18572,7 @@ var TOOL_DEFINITIONS = [
|
|
|
18196
18572
|
description: "Push a real event through a walkerOS flow to actual destinations. Makes real API calls to real endpoints. Best suited for server-side flows, web flows should use flow_simulate for testing.",
|
|
18197
18573
|
inputSchema: {
|
|
18198
18574
|
configPath: schemas6.PushInputShape.configPath,
|
|
18199
|
-
event:
|
|
18575
|
+
event: z18.record(z18.string(), z18.unknown()),
|
|
18200
18576
|
flow: schemas6.PushInputShape.flow,
|
|
18201
18577
|
platform: schemas6.PushInputShape.platform
|
|
18202
18578
|
},
|
|
@@ -18212,11 +18588,11 @@ var TOOL_DEFINITIONS = [
|
|
|
18212
18588
|
title: "Flow Examples",
|
|
18213
18589
|
description: "List all step examples in a walkerOS flow configuration. Shows example names, step locations, and in/out shapes. Use this to discover available test fixtures and simulation data.",
|
|
18214
18590
|
inputSchema: {
|
|
18215
|
-
configPath:
|
|
18216
|
-
flow:
|
|
18217
|
-
step:
|
|
18218
|
-
full:
|
|
18219
|
-
includeHidden:
|
|
18591
|
+
configPath: z18.string().min(1),
|
|
18592
|
+
flow: z18.string().optional(),
|
|
18593
|
+
step: z18.string().optional(),
|
|
18594
|
+
full: z18.boolean().optional(),
|
|
18595
|
+
includeHidden: z18.boolean().optional()
|
|
18220
18596
|
},
|
|
18221
18597
|
annotations: {
|
|
18222
18598
|
readOnlyHint: true,
|
|
@@ -18230,8 +18606,8 @@ var TOOL_DEFINITIONS = [
|
|
|
18230
18606
|
title: "Load or Create Flow",
|
|
18231
18607
|
description: "Load an existing flow configuration from a local file path, URL, or walkerOS API (by flow ID). Or create a new empty flow by specifying a platform (web or server). Use the add-step prompt to add sources, destinations, transformers, or stores to the flow.",
|
|
18232
18608
|
inputSchema: {
|
|
18233
|
-
source:
|
|
18234
|
-
platform:
|
|
18609
|
+
source: z18.string().optional(),
|
|
18610
|
+
platform: z18.enum(["web", "server"]).optional()
|
|
18235
18611
|
},
|
|
18236
18612
|
annotations: {
|
|
18237
18613
|
readOnlyHint: true,
|
|
@@ -18245,10 +18621,10 @@ var TOOL_DEFINITIONS = [
|
|
|
18245
18621
|
title: "Search Package",
|
|
18246
18622
|
description: "Start here for package discovery. Never guess package names, use this tool first to find exact names. Without package name: returns catalog filtered by type/platform. With package name: returns metadata, hint keys, and example summaries.",
|
|
18247
18623
|
inputSchema: {
|
|
18248
|
-
package:
|
|
18249
|
-
type:
|
|
18250
|
-
platform:
|
|
18251
|
-
version:
|
|
18624
|
+
package: z18.string().min(1).optional(),
|
|
18625
|
+
type: z18.enum(["source", "destination", "transformer", "store"]).optional(),
|
|
18626
|
+
platform: z18.enum(["web", "server"]).optional(),
|
|
18627
|
+
version: z18.string().optional()
|
|
18252
18628
|
},
|
|
18253
18629
|
annotations: {
|
|
18254
18630
|
readOnlyHint: true,
|
|
@@ -18262,9 +18638,9 @@ var TOOL_DEFINITIONS = [
|
|
|
18262
18638
|
title: "Get Package",
|
|
18263
18639
|
description: 'Requires exact package name, do not guess names, use package_search first to find them. Returns schemas + hint texts + example summaries by default (lightweight). Use section parameter for full content: "hints" (with code blocks), "examples" (full in/out data), or "all".',
|
|
18264
18640
|
inputSchema: {
|
|
18265
|
-
package:
|
|
18266
|
-
version:
|
|
18267
|
-
section:
|
|
18641
|
+
package: z18.string().min(1),
|
|
18642
|
+
version: z18.string().optional(),
|
|
18643
|
+
section: z18.enum(["hints", "examples", "all"]).optional()
|
|
18268
18644
|
},
|
|
18269
18645
|
annotations: {
|
|
18270
18646
|
readOnlyHint: true,
|
|
@@ -18278,8 +18654,8 @@ var TOOL_DEFINITIONS = [
|
|
|
18278
18654
|
title: "Send Feedback",
|
|
18279
18655
|
description: "Send feedback about walkerOS",
|
|
18280
18656
|
inputSchema: {
|
|
18281
|
-
text:
|
|
18282
|
-
anonymous:
|
|
18657
|
+
text: z18.string(),
|
|
18658
|
+
anonymous: z18.boolean().optional()
|
|
18283
18659
|
},
|
|
18284
18660
|
annotations: {
|
|
18285
18661
|
readOnlyHint: false,
|
|
@@ -18298,6 +18674,7 @@ function createToolHandlers(client, packageVersion = "0.0.0") {
|
|
|
18298
18674
|
createFlowManageToolSpec(client),
|
|
18299
18675
|
createDeployManageToolSpec(client),
|
|
18300
18676
|
createSecretManageToolSpec(client),
|
|
18677
|
+
createObserveSessionToolSpec(client),
|
|
18301
18678
|
createObserveJourneysToolSpec(client),
|
|
18302
18679
|
createFeedbackToolSpec(client),
|
|
18303
18680
|
createFlowValidateToolSpec(),
|
|
@@ -18313,7 +18690,15 @@ function createToolHandlers(client, packageVersion = "0.0.0") {
|
|
|
18313
18690
|
return Object.fromEntries(specs.map((s) => [s.name, s]));
|
|
18314
18691
|
}
|
|
18315
18692
|
export {
|
|
18693
|
+
HINT_EMPTY_FEED,
|
|
18694
|
+
HINT_ENDED,
|
|
18695
|
+
HINT_NO_WINDOW,
|
|
18696
|
+
HINT_PREVIEW_STREAMS,
|
|
18697
|
+
HINT_READ,
|
|
18698
|
+
HINT_SIMULATE_FIRST,
|
|
18699
|
+
HINT_STOP,
|
|
18316
18700
|
HttpToolClient,
|
|
18701
|
+
DESCRIPTION7 as OBSERVE_SESSION_DESCRIPTION,
|
|
18317
18702
|
TOOL_DEFINITIONS,
|
|
18318
18703
|
createStreamableHttpHandler,
|
|
18319
18704
|
createToolHandlers,
|