@rynfar/meridian 1.62.2 → 1.62.3

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.
@@ -6516,19 +6516,34 @@ function resolveMaxConcurrent(source = process.env, warn = console.warn) {
6516
6516
  }
6517
6517
  return DEFAULT_MAX_CONCURRENT;
6518
6518
  }
6519
+ function assertPositiveLimit(limit) {
6520
+ if (!Number.isSafeInteger(limit) || limit <= 0) {
6521
+ throw new RangeError("Semaphore limit must be a positive integer");
6522
+ }
6523
+ return limit;
6524
+ }
6519
6525
 
6520
6526
  class AbortableSemaphore {
6521
- limit;
6522
6527
  activeCount = 0;
6528
+ currentLimit;
6523
6529
  waiters = [];
6524
6530
  constructor(limit) {
6525
- this.limit = limit;
6526
- if (!Number.isSafeInteger(limit) || limit <= 0) {
6527
- throw new RangeError("Semaphore limit must be a positive integer");
6528
- }
6531
+ this.currentLimit = assertPositiveLimit(limit);
6532
+ }
6533
+ get limit() {
6534
+ return this.currentLimit;
6535
+ }
6536
+ setLimit(next) {
6537
+ const limit = assertPositiveLimit(next);
6538
+ if (limit === this.currentLimit)
6539
+ return;
6540
+ const raised = limit > this.currentLimit;
6541
+ this.currentLimit = limit;
6542
+ if (raised)
6543
+ this.grantNext();
6529
6544
  }
6530
6545
  get snapshot() {
6531
- return { active: this.activeCount, queued: this.waiters.length, limit: this.limit };
6546
+ return { active: this.activeCount, queued: this.waiters.length, limit: this.currentLimit };
6532
6547
  }
6533
6548
  acquire(signal) {
6534
6549
  if (signal?.aborted)
@@ -6584,7 +6599,12 @@ class AbortableSemaphore {
6584
6599
  }
6585
6600
  }
6586
6601
  function getProcessSdkSemaphore() {
6587
- processSdkSemaphore ??= new AbortableSemaphore(resolveMaxConcurrent());
6602
+ const limit = resolveMaxConcurrent();
6603
+ if (!processSdkSemaphore) {
6604
+ processSdkSemaphore = new AbortableSemaphore(limit);
6605
+ return processSdkSemaphore;
6606
+ }
6607
+ processSdkSemaphore.setLimit(limit);
6588
6608
  return processSdkSemaphore;
6589
6609
  }
6590
6610
 
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  startProxyServer
4
- } from "./cli-7jgse65q.js";
4
+ } from "./cli-3ysfatce.js";
5
5
  import"./cli-m0p2bc8v.js";
6
6
  import"./cli-sry5aqdj.js";
7
7
  import"./cli-xmweegb1.js";
@@ -11,10 +11,22 @@ export declare function requestCancelledError(reason?: unknown): Error;
11
11
  export declare function resolveMaxConcurrent(source?: NodeJS.ProcessEnv, warn?: (message: string) => void): number;
12
12
  /** FIFO semaphore whose queued acquisitions can be cancelled safely. */
13
13
  export declare class AbortableSemaphore {
14
- readonly limit: number;
15
14
  private activeCount;
15
+ private currentLimit;
16
16
  private readonly waiters;
17
17
  constructor(limit: number);
18
+ get limit(): number;
19
+ /**
20
+ * Change the budget in place.
21
+ *
22
+ * Mutating beats swapping the instance: queued waiters and in-flight leases
23
+ * belong to this object, so replacing it would strand them holding permits
24
+ * nobody counts. Raising the limit immediately grants whoever is already
25
+ * waiting; lowering it never revokes a live lease — the extra permits simply
26
+ * stop being reissued as the current holders release, so the semaphore
27
+ * converges on the new budget without killing work already underway.
28
+ */
29
+ setLimit(next: number): void;
18
30
  get snapshot(): SemaphoreSnapshot;
19
31
  acquire(signal?: AbortSignal): Promise<SemaphoreLease>;
20
32
  private createLease;
@@ -22,7 +34,12 @@ export declare class AbortableSemaphore {
22
34
  }
23
35
  /**
24
36
  * One SDK subprocess budget per process, shared by every ProxyServer instance.
25
- * The environment is intentionally read once, when the first proxy asks for it.
37
+ *
38
+ * The identity of the semaphore is stable — every caller gets the same object,
39
+ * which is the whole point of a shared budget — but its limit is reconciled
40
+ * against the environment on each call. Caching the limit at first use made the
41
+ * value depend on which proxy happened to start first, so a later instance (or
42
+ * a test that set MERIDIAN_MAX_CONCURRENT) was silently ignored.
26
43
  */
27
44
  export declare function getProcessSdkSemaphore(): AbortableSemaphore;
28
45
  /** Reset process-scoped state between tests that override concurrency env vars. */
@@ -1 +1 @@
1
- {"version":3,"file":"concurrency.d.ts","sourceRoot":"","sources":["../../src/proxy/concurrency.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,OAAO,IAAI,IAAI,CAAA;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;AAcD,wBAAgB,qBAAqB,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,KAAK,CAM7D;AAED,wBAAgB,oBAAoB,CAClC,MAAM,GAAE,MAAM,CAAC,UAAwB,EACvC,IAAI,GAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAmB,GAC7C,MAAM,CAcR;AAED,wEAAwE;AACxE,qBAAa,kBAAkB;IAIjB,QAAQ,CAAC,KAAK,EAAE,MAAM;IAHlC,OAAO,CAAC,WAAW,CAAI;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAe;gBAElB,KAAK,EAAE,MAAM;IAMlC,IAAI,QAAQ,IAAI,iBAAiB,CAEhC;IAED,OAAO,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC;IAwBtD,OAAO,CAAC,WAAW;IAanB,OAAO,CAAC,SAAS;CAelB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,kBAAkB,CAG3D;AAED,mFAAmF;AACnF,wBAAgB,gCAAgC,IAAI,IAAI,CAGvD"}
1
+ {"version":3,"file":"concurrency.d.ts","sourceRoot":"","sources":["../../src/proxy/concurrency.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,OAAO,IAAI,IAAI,CAAA;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;AAcD,wBAAgB,qBAAqB,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,KAAK,CAM7D;AAED,wBAAgB,oBAAoB,CAClC,MAAM,GAAE,MAAM,CAAC,UAAwB,EACvC,IAAI,GAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAmB,GAC7C,MAAM,CAcR;AASD,wEAAwE;AACxE,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,WAAW,CAAI;IACvB,OAAO,CAAC,YAAY,CAAQ;IAC5B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAe;gBAE3B,KAAK,EAAE,MAAM;IAIzB,IAAI,KAAK,IAAI,MAAM,CAElB;IAED;;;;;;;;;OASG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAQ5B,IAAI,QAAQ,IAAI,iBAAiB,CAEhC;IAED,OAAO,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC;IAwBtD,OAAO,CAAC,WAAW;IAanB,OAAO,CAAC,SAAS;CAelB;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,IAAI,kBAAkB,CAQ3D;AAED,mFAAmF;AACnF,wBAAgB,gCAAgC,IAAI,IAAI,CAGvD"}
package/dist/server.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  runObserveHook,
12
12
  runTransformHook,
13
13
  startProxyServer
14
- } from "./cli-7jgse65q.js";
14
+ } from "./cli-3ysfatce.js";
15
15
  import"./cli-m0p2bc8v.js";
16
16
  import"./cli-sry5aqdj.js";
17
17
  import"./cli-xmweegb1.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rynfar/meridian",
3
- "version": "1.62.2",
3
+ "version": "1.62.3",
4
4
  "description": "Local Anthropic API powered by your Claude Max subscription. One subscription, every agent.",
5
5
  "type": "module",
6
6
  "main": "./dist/server.js",