@walkeros/mcp 4.7.1 → 4.7.2-next-1791147139360

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/stdio.js CHANGED
@@ -826,7 +826,7 @@ var NPM_SEARCH_URL = "https://registry.npmjs.org/-/v1/search";
826
826
  var JSDELIVR_BASE = "https://cdn.jsdelivr.net/npm";
827
827
  var WALKEROS_JSON_PATH = "dist/walkerOS.json";
828
828
  var CACHE_TTL = 5 * 60 * 1e3;
829
- var CLIENT_HEADER = "walkeros-mcp/4.7.1";
829
+ var CLIENT_HEADER = "walkeros-mcp/4.7.2-next-1791147139360";
830
830
  function getPackageBaseUrl() {
831
831
  return process.env.WALKEROS_APP_URL || void 0;
832
832
  }
@@ -1413,16 +1413,15 @@ import { z as z7 } from "zod";
1413
1413
  import { mcpResult as mcpResult7, mcpError as mcpError9 } from "@walkeros/core";
1414
1414
 
1415
1415
  // src/types.ts
1416
- function isAuthError(error) {
1416
+ function isAuthenticationError(error) {
1417
1417
  if (!(error instanceof Error)) return false;
1418
- const msg = error.message.toLowerCase();
1419
- if (msg.includes("unauthorized") || msg.includes("forbidden") || msg.includes("invalid token") || msg.includes("token expired") || msg.includes("not authenticated")) {
1420
- return true;
1421
- }
1422
- const code = error.code;
1423
- if (!code) return false;
1424
- const upperCode = code.toUpperCase();
1425
- return upperCode === "UNAUTHORIZED" || upperCode === "FORBIDDEN" || upperCode === "401" || upperCode === "403" || upperCode.startsWith("AUTH_");
1418
+ if ("status" in error && error.status === 401) return true;
1419
+ return "code" in error && error.code === "UNAUTHORIZED";
1420
+ }
1421
+ function isAccessRefusal(error) {
1422
+ if (!(error instanceof Error)) return false;
1423
+ if ("status" in error && error.status === 403) return true;
1424
+ return "code" in error && (error.code === "FORBIDDEN" || error.code === "INSUFFICIENT_SCOPE");
1426
1425
  }
1427
1426
  var AUTH_HINT = 'Are you logged in? Use auth(action: "status") to check.';
1428
1427
 
@@ -1565,7 +1564,10 @@ async function flowLoadHandlerBody(client, runtime, input) {
1565
1564
  }
1566
1565
  );
1567
1566
  } catch (error) {
1568
- return mcpError9(error, isAuthError(error) ? AUTH_HINT : void 0);
1567
+ return mcpError9(
1568
+ error,
1569
+ isAuthenticationError(error) ? AUTH_HINT : void 0
1570
+ );
1569
1571
  }
1570
1572
  }
1571
1573
  try {
@@ -1664,7 +1666,7 @@ async function feedbackHandlerBody(client, input) {
1664
1666
  const isAnonymous = explicitAnonymous ?? anonymous ?? true;
1665
1667
  await client.submitFeedback(text, {
1666
1668
  anonymous: isAnonymous,
1667
- version: "4.7.1"
1669
+ version: "4.7.2-next-1791147139360"
1668
1670
  });
1669
1671
  return mcpResult8({ ok: true });
1670
1672
  } catch (error) {
@@ -2168,7 +2170,10 @@ async function projectManageHandlerBody(client, input) {
2168
2170
  );
2169
2171
  }
2170
2172
  } catch (error) {
2171
- return mcpError12(error, isAuthError(error) ? AUTH_HINT : void 0);
2173
+ return mcpError12(
2174
+ error,
2175
+ isAuthenticationError(error) ? AUTH_HINT : void 0
2176
+ );
2172
2177
  }
2173
2178
  }
2174
2179
  function registerProjectManageTool(server, client) {
@@ -2732,7 +2737,10 @@ async function flowManageHandlerBody(client, input) {
2732
2737
  );
2733
2738
  }
2734
2739
  } catch (error) {
2735
- return mcpError13(error, isAuthError(error) ? AUTH_HINT : void 0);
2740
+ return mcpError13(
2741
+ error,
2742
+ isAuthenticationError(error) ? AUTH_HINT : void 0
2743
+ );
2736
2744
  }
2737
2745
  }
2738
2746
  function registerFlowManageTool(server, client) {
@@ -2994,7 +3002,10 @@ async function deployManageHandlerBody(client, input) {
2994
3002
  );
2995
3003
  }
2996
3004
  } catch (error) {
2997
- return mcpError14(error, isAuthError(error) ? AUTH_HINT : void 0);
3005
+ return mcpError14(
3006
+ error,
3007
+ isAuthenticationError(error) ? AUTH_HINT : void 0
3008
+ );
2998
3009
  }
2999
3010
  }
3000
3011
  function registerDeployTool(server, client) {
@@ -3126,7 +3137,10 @@ async function secretManageHandlerBody(client, input) {
3126
3137
  );
3127
3138
  }
3128
3139
  } catch (error) {
3129
- return mcpError15(error, isAuthError(error) ? AUTH_HINT : void 0);
3140
+ return mcpError15(
3141
+ error,
3142
+ isAuthenticationError(error) ? AUTH_HINT : void 0
3143
+ );
3130
3144
  }
3131
3145
  }
3132
3146
  function registerSecretManageTool(server, client) {
@@ -3241,7 +3255,10 @@ async function observeJourneysHandlerBody(client, input) {
3241
3255
  ]
3242
3256
  });
3243
3257
  } catch (error) {
3244
- return mcpError16(error, isAuthError(error) ? AUTH_HINT : void 0);
3258
+ return mcpError16(
3259
+ error,
3260
+ isAuthenticationError(error) ? AUTH_HINT : void 0
3261
+ );
3245
3262
  }
3246
3263
  }
3247
3264
  function registerObserveJourneysTool(server, client) {
@@ -3261,6 +3278,28 @@ function registerObserveJourneysTool(server, client) {
3261
3278
  // src/tools/observe-session.ts
3262
3279
  import { z as z15 } from "zod";
3263
3280
  import { mcpResult as mcpResult16, mcpError as mcpError17 } from "@walkeros/core";
3281
+
3282
+ // src/tools/feature-gate.ts
3283
+ var FEATURE_NOT_AVAILABLE = "FEATURE_NOT_AVAILABLE";
3284
+ function codeOf(error) {
3285
+ if (!(error instanceof Error) || !("code" in error)) return void 0;
3286
+ const code = error.code;
3287
+ return typeof code === "string" ? code : void 0;
3288
+ }
3289
+ function isFeatureDenial(error) {
3290
+ return codeOf(error) === FEATURE_NOT_AVAILABLE;
3291
+ }
3292
+ function featureDenialHint(feature) {
3293
+ return `The "${feature}" feature is not enabled for this project. Tell the person that "${feature}" needs a plan or project entitlement that unlocks it, which is changed in the app, not through this tool.`;
3294
+ }
3295
+ function errorHint(error, feature, notFoundHint) {
3296
+ if (isFeatureDenial(error)) return featureDenialHint(feature);
3297
+ if (isAuthenticationError(error)) return AUTH_HINT;
3298
+ if (codeOf(error) === "NOT_FOUND") return notFoundHint;
3299
+ return void 0;
3300
+ }
3301
+
3302
+ // src/tools/observe-session.ts
3264
3303
  var TITLE15 = "Observe Session";
3265
3304
  var DESCRIPTION14 = "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.";
3266
3305
  var HINT_SIMULATE_FIRST = "Simulate before preview: flow_simulate checks mapping with no browser.";
@@ -3418,7 +3457,8 @@ async function resolveSessionId(client, options) {
3418
3457
  });
3419
3458
  return result.sessionId;
3420
3459
  } catch (error) {
3421
- if (isAuthError(error)) throw error;
3460
+ if (isAuthenticationError(error) || isAccessRefusal(error) || isFeatureDenial(error))
3461
+ throw error;
3422
3462
  const detail = error instanceof Error ? error.message : String(error);
3423
3463
  throw new SessionResolutionError(
3424
3464
  `${SESSION_RESOLUTION_FAILED} (${detail})`,
@@ -3547,7 +3587,10 @@ async function observeSessionHandlerBody(client, input) {
3547
3587
  );
3548
3588
  }
3549
3589
  } catch (error) {
3550
- return mcpError17(error, isAuthError(error) ? AUTH_HINT : void 0);
3590
+ return mcpError17(
3591
+ error,
3592
+ isAuthenticationError(error) ? AUTH_HINT : void 0
3593
+ );
3551
3594
  }
3552
3595
  }
3553
3596
  function registerObserveSessionTool(server, client) {
@@ -3567,28 +3610,6 @@ function registerObserveSessionTool(server, client) {
3567
3610
  // src/tools/hub-manage.ts
3568
3611
  import { z as z16 } from "zod";
3569
3612
  import { mcpResult as mcpResult17, mcpError as mcpError18 } from "@walkeros/core";
3570
-
3571
- // src/tools/feature-gate.ts
3572
- var FEATURE_NOT_AVAILABLE = "FEATURE_NOT_AVAILABLE";
3573
- function codeOf(error) {
3574
- if (!(error instanceof Error) || !("code" in error)) return void 0;
3575
- const code = error.code;
3576
- return typeof code === "string" ? code : void 0;
3577
- }
3578
- function isFeatureDenial(error) {
3579
- return codeOf(error) === FEATURE_NOT_AVAILABLE;
3580
- }
3581
- function featureDenialHint(feature) {
3582
- return `The "${feature}" feature is not enabled for this project. Tell the person that "${feature}" needs a plan or project entitlement that unlocks it, which is changed in the app, not through this tool.`;
3583
- }
3584
- function errorHint(error, feature, notFoundHint) {
3585
- if (isFeatureDenial(error)) return featureDenialHint(feature);
3586
- if (isAuthError(error)) return AUTH_HINT;
3587
- if (codeOf(error) === "NOT_FOUND") return notFoundHint;
3588
- return void 0;
3589
- }
3590
-
3591
- // src/tools/hub-manage.ts
3592
3613
  var MAX_ANNOTATION_TEXT_LENGTH = 4e3;
3593
3614
  var MAX_ANCHOR_KEY_LENGTH = 255;
3594
3615
  var MAX_ANCHOR_LABEL_LENGTH = 255;
@@ -4541,7 +4562,7 @@ function registerReferenceResources(server, client) {
4541
4562
  "consent",
4542
4563
  "walkeros://reference/consent",
4543
4564
  {
4544
- description: "JSON Schema for walkerOS consent: destination-level, rule-level, and field-level consent gating",
4565
+ description: "JSON Schema for walkerOS consent: destination-level and field-level consent gating",
4545
4566
  mimeType: "application/json"
4546
4567
  },
4547
4568
  async () => ({
@@ -4783,7 +4804,7 @@ function registerSetupMappingPrompt(server) {
4783
4804
  "Policy and consent in mapping:",
4784
4805
  "- config.policy runs BEFORE mapping rules \u2014 use it to inject or redact fields on the event.",
4785
4806
  "- rule.policy runs after config.policy but before data transformation \u2014 use for event-specific pre-processing.",
4786
- "- config.consent gates ALL events to this destination. rule.consent gates specific event types.",
4807
+ "- config.consent gates ALL events to this destination. rule.consent is not enforced yet.",
4787
4808
  "- Individual value configs support consent: { marketing: true } for field-level gating."
4788
4809
  ].join("\n")
4789
4810
  }
@@ -4898,10 +4919,10 @@ Every component in a flow is a **step**: sources capture events, transformers pr
4898
4919
  - **Mapping** transforms events using data/map/loop/set/condition rules. Same syntax on sources and destinations. Mapping rules use NESTED entity \u2192 action keying: event name "product add" maps to \`{ "product": { "add": Rule } }\`. Wildcards: \`{ "*": { "view": Rule } }\`.
4899
4920
  - **Contracts** define event schemas using entity-action keying. Can generate FROM mappings or scaffold mappings FROM contracts.
4900
4921
  - **Variables** ($var, $env, $secret, $code, $store) enable DRY, environment-aware config. \`$var.name\` is a reusable flow variable from the top-level \`variables\` block; whole-string refs preserve native type (object/array/scalar), inline interpolation requires a scalar, deep paths via \`$var.name.deep.path\`. \`$env.NAME[:default]\` is an environment variable resolved at bundle/deploy time (non-secret config only). \`$secret.NAME\` is a managed secret the deploy pipeline injects into the server runner at runtime; credentials, tokens, and private keys must use \`$secret\`, not \`$env\`.
4901
- - **Consent** gates destinations, mapping rules, and individual fields. Privacy-first by design.
4922
+ - **Consent** gates destinations (\`config.consent\`) and individual fields (a value's \`consent\`). A mapping rule's \`consent\` is not enforced yet. Privacy-first by design.
4902
4923
  - **Routing** uses one grammar in every chain field (\`source.before\`, \`source.next\`, \`transformer.before\`, \`transformer.next\`, \`collector.next\`, \`destination.before\`, \`destination.next\`). A route is a string ID, a sequence (\`["a", "b"]\`), or a RouteConfig: \`{ match?, next }\`, \`{ match?, one: [...] }\` (first match wins), \`{ match?, many: [...] }\` (every match becomes its own copy of the event with its own id and finishes the rest of the path on its own, never merged), or \`{ match?, stop: true }\` (ends that copy). In a sequence, a member's own \`next\` runs right after it, then the sequence continues. \`match\` reads \`{ ingest, event }\` and each route is evaluated when the event reaches it. A \`stop\` in \`collector.next\` drops the event for every destination; per-destination filtering belongs in \`destination.before\`. An array of only route configs is an implicit \`one\`. The optional \`match\` field is omitted to mean always-match (no wildcard literal).
4903
4924
  - **Pass-through steps** are transformer entries with no \`code\` and no \`package\`. The runtime synthesizes the push for them automatically. Three flavors share this shape: a \`before\` / \`next\`-only step (named hop reusable across destinations), a \`cache\`-only step (dedup, rate-limit), and a \`mapping\`-only step (declarative event-to-event transform). A pass-through must declare at least one of \`before\`, \`next\`, \`cache\`, or \`mapping\`.
4904
- - **Mapping at the transformer position** uses the same \`Mapping.Config\` shape as destinations, but the semantic is event-to-event: \`policy\` and per-rule \`policy\`, \`mapping[].name\` (rename), \`mapping[].ignore\` (drop from chain), \`consent\`, and \`include\` apply. Vendor-payload fields (\`data\`, \`silent\`, \`mapping[].data\`) are no-ops at this position.
4925
+ - **Mapping at the transformer position** uses the same \`Mapping.Config\` shape as destinations, but the semantic is event-to-event: \`policy\` and per-rule \`policy\`, \`mapping[].name\` (rename), \`mapping[].ignore\` (drop from chain), and \`include\` apply. \`consent\` is not enforced at this position. Vendor-payload fields (\`data\`, \`silent\`, \`mapping[].data\`) are no-ops at this position.
4905
4926
  - **Closed-schema rule on transformer entries:** known keys only. Operative keys are \`code\`, \`package\`, \`before\`, \`next\`, \`cache\`, \`mapping\`. Combined with structural keys (\`config\`, \`env\`, \`validate\`, \`disabled\`, \`id\`, etc.). Unknown top-level keys on a transformer step are errors (catches typos like \`dedup: {}\` instead of nested under \`cache\`). \`code\` + \`package\` together is a conflict.
4906
4927
  - **Cache** memoizes step output on a configured store. Set \`cache.stop: true\` to short-circuit the chain on HIT (sources default to stop-on-HIT); in a source chain or \`collector.next\` that halts the event for all destinations. Set \`cache.namespace\` to prefix keys; omit it to write keys directly. \`CacheRule.match\` is optional, omit for always-match.
4907
4928
 
@@ -5247,8 +5268,8 @@ var HttpToolClient = class {
5247
5268
  /**
5248
5269
  * Observe session lifecycle over the CLI's authenticated boundary. The trio
5249
5270
  * routes through the same `apiFetch` as every other method here, so token
5250
- * resolution, base URL, and `ApiError` shaping (which `isAuthError` reads)
5251
- * stay identical to the rest of the client.
5271
+ * resolution, base URL, and `ApiError` shaping (which
5272
+ * `isAuthenticationError` reads) stay identical to the rest of the client.
5252
5273
  */
5253
5274
  async startObserveSession(options) {
5254
5275
  return startObserveSession(options);
@@ -5339,7 +5360,7 @@ var HttpToolClient = class {
5339
5360
  async checkContract() {
5340
5361
  return compareContract({
5341
5362
  baseUrl: this.appBaseUrl(),
5342
- client: { type: "mcp", version: "4.7.1" }
5363
+ client: { type: "mcp", version: "4.7.2-next-1791147139360" }
5343
5364
  });
5344
5365
  }
5345
5366
  /** The live public OpenAPI document of `appBaseUrl()`, without a credential. */
@@ -5550,7 +5571,7 @@ function parseJson(content) {
5550
5571
  }
5551
5572
 
5552
5573
  // src/stdio.ts
5553
- setClientContext({ type: "mcp", version: "4.7.1" });
5574
+ setClientContext({ type: "mcp", version: "4.7.2-next-1791147139360" });
5554
5575
  process.on("uncaughtException", (err) => {
5555
5576
  const emitter = getMcpEmitterSingleton();
5556
5577
  if (emitter) {
@@ -5570,7 +5591,7 @@ process.on("unhandledRejection", (reason) => {
5570
5591
  async function main() {
5571
5592
  const server = createWalkerOSMcpServer({
5572
5593
  client: new HttpToolClient(),
5573
- version: "4.7.1",
5594
+ version: "4.7.2-next-1791147139360",
5574
5595
  runtime: createLocalRuntime()
5575
5596
  });
5576
5597
  const transport = new StdioServerTransport();
@@ -5581,7 +5602,7 @@ main().catch(async (error) => {
5581
5602
  try {
5582
5603
  const emitter = await createMcpEmitter({
5583
5604
  clientInfo: void 0,
5584
- packageVersion: "4.7.1"
5605
+ packageVersion: "4.7.2-next-1791147139360"
5585
5606
  });
5586
5607
  await emitter.emitError("startup");
5587
5608
  } catch {