@rulvar/core 1.81.1 → 1.82.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -5481,7 +5481,14 @@ declare class AdmissionController {
5481
5481
  maxDepth?: number;
5482
5482
  maxChildrenPerNode?: number;
5483
5483
  childBudgetFraction?: number;
5484
- flatReserveUsd?: number; /** Per-orchestrate spawn cap (maxSpawns); engine lifetime cap applies regardless. */
5484
+ flatReserveUsd?: number;
5485
+ /**
5486
+ * Controller-lifetime cap on ADMITTED spawns, enforced at this
5487
+ * controller's own gate with the 'lifetime' reject reason, for
5488
+ * hosts driving an AdmissionController directly. Engine runs do
5489
+ * not wire this option: they cap total spawns through the budget
5490
+ * (`budgetDefaults.lifetimeSpawnCap`, the same 'lifetime' reason).
5491
+ */
5485
5492
  maxTotalSpawns?: number;
5486
5493
  mintId?: () => string;
5487
5494
  /**
package/dist/index.js CHANGED
@@ -3490,6 +3490,8 @@ function mcp(cfg) {
3490
3490
  validateConfig(cfg);
3491
3491
  let clientPromise;
3492
3492
  let cache;
3493
+ let generation = 0;
3494
+ let inFlight;
3493
3495
  const connect = async () => {
3494
3496
  const client = new Client({
3495
3497
  name: "rulvar",
@@ -3515,6 +3517,7 @@ function mcp(cfg) {
3515
3517
  throw error;
3516
3518
  }
3517
3519
  client.setNotificationHandler(ToolListChangedNotificationSchema, () => {
3520
+ generation += 1;
3518
3521
  cache = void 0;
3519
3522
  });
3520
3523
  return client;
@@ -3526,7 +3529,7 @@ function mcp(cfg) {
3526
3529
  const page = await client.listTools(cursor === void 0 ? {} : { cursor });
3527
3530
  tools.push(...page.tools);
3528
3531
  cursor = page.nextCursor;
3529
- } while (cursor !== void 0);
3532
+ } while (cursor !== void 0 && cursor !== "");
3530
3533
  return tools;
3531
3534
  };
3532
3535
  const needsApprovalFor = (originalName) => {
@@ -3565,13 +3568,24 @@ function mcp(cfg) {
3565
3568
  id: sourceIdOf(cfg),
3566
3569
  tools: async () => {
3567
3570
  if (cache !== void 0) return cache;
3568
- clientPromise ??= connect();
3569
- const client = await clientPromise;
3570
- const wireTools = await listAll(client);
3571
- const denySet = new Set(cfg.deny ?? []);
3572
- 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;
3571
+ if (inFlight !== void 0) return inFlight;
3572
+ const fetch = (async () => {
3573
+ clientPromise ??= connect();
3574
+ const client = await clientPromise;
3575
+ const fetchedAt = generation;
3576
+ const wireTools = await listAll(client);
3577
+ const denySet = new Set(cfg.deny ?? []);
3578
+ const allowSet = cfg.allow === void 0 ? void 0 : new Set(cfg.allow);
3579
+ const defs = wireTools.filter((wire) => !denySet.has(wire.name) && (allowSet === void 0 || allowSet.has(wire.name))).map((wire) => toDef(client, wire));
3580
+ if (generation === fetchedAt) cache = defs;
3581
+ return defs;
3582
+ })();
3583
+ inFlight = fetch;
3584
+ try {
3585
+ return await fetch;
3586
+ } finally {
3587
+ inFlight = void 0;
3588
+ }
3575
3589
  },
3576
3590
  close: async () => {
3577
3591
  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.82.0",
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",