@rulvar/core 1.81.1 → 1.81.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.
Files changed (2) hide show
  1. package/dist/index.js +7 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3490,6 +3490,7 @@ function mcp(cfg) {
3490
3490
  validateConfig(cfg);
3491
3491
  let clientPromise;
3492
3492
  let cache;
3493
+ let generation = 0;
3493
3494
  const connect = async () => {
3494
3495
  const client = new Client({
3495
3496
  name: "rulvar",
@@ -3515,6 +3516,7 @@ function mcp(cfg) {
3515
3516
  throw error;
3516
3517
  }
3517
3518
  client.setNotificationHandler(ToolListChangedNotificationSchema, () => {
3519
+ generation += 1;
3518
3520
  cache = void 0;
3519
3521
  });
3520
3522
  return client;
@@ -3526,7 +3528,7 @@ function mcp(cfg) {
3526
3528
  const page = await client.listTools(cursor === void 0 ? {} : { cursor });
3527
3529
  tools.push(...page.tools);
3528
3530
  cursor = page.nextCursor;
3529
- } while (cursor !== void 0);
3531
+ } while (cursor !== void 0 && cursor !== "");
3530
3532
  return tools;
3531
3533
  };
3532
3534
  const needsApprovalFor = (originalName) => {
@@ -3567,11 +3569,13 @@ function mcp(cfg) {
3567
3569
  if (cache !== void 0) return cache;
3568
3570
  clientPromise ??= connect();
3569
3571
  const client = await clientPromise;
3572
+ const fetchedAt = generation;
3570
3573
  const wireTools = await listAll(client);
3571
3574
  const denySet = new Set(cfg.deny ?? []);
3572
3575
  const allowSet = cfg.allow === void 0 ? void 0 : new Set(cfg.allow);
3573
- cache = wireTools.filter((wire) => !denySet.has(wire.name) && (allowSet === void 0 || allowSet.has(wire.name))).map((wire) => toDef(client, wire));
3574
- return cache;
3576
+ const defs = wireTools.filter((wire) => !denySet.has(wire.name) && (allowSet === void 0 || allowSet.has(wire.name))).map((wire) => toDef(client, wire));
3577
+ if (generation === fetchedAt) cache = defs;
3578
+ return defs;
3575
3579
  },
3576
3580
  close: async () => {
3577
3581
  const pending = clientPromise;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulvar/core",
3
- "version": "1.81.1",
3
+ "version": "1.81.2",
4
4
  "description": "Rulvar core: L0 contracts, journal kernel, ctx primitives, agent runtime, model router, tool system, dynamic orchestrator, InMemory and JSONL stores, event stream.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",