@probelabs/visor 0.1.166-ee → 0.1.167-ee

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 (43) hide show
  1. package/dist/config.d.ts.map +1 -1
  2. package/dist/frontends/github-frontend.d.ts.map +1 -1
  3. package/dist/index.js +343 -28
  4. package/dist/sdk/{check-provider-registry-PU67PWTU.mjs → check-provider-registry-6WR2SG66.mjs} +3 -3
  5. package/dist/sdk/{check-provider-registry-TGPICTHD.mjs → check-provider-registry-CWLPAM5U.mjs} +3 -3
  6. package/dist/sdk/{chunk-WSYVK6ML.mjs → chunk-2G2PJKHM.mjs} +297 -31
  7. package/dist/sdk/chunk-2G2PJKHM.mjs.map +1 -0
  8. package/dist/sdk/{chunk-P5P6BOO7.mjs → chunk-3LXYZ2OQ.mjs} +297 -31
  9. package/dist/sdk/chunk-3LXYZ2OQ.mjs.map +1 -0
  10. package/dist/sdk/{chunk-DEAPFYNX.mjs → chunk-KYBKVKBS.mjs} +7 -1
  11. package/dist/sdk/{chunk-DEAPFYNX.mjs.map → chunk-KYBKVKBS.mjs.map} +1 -1
  12. package/dist/sdk/{config-D6WF2U4B.mjs → config-DP5QU3XC.mjs} +2 -2
  13. package/dist/sdk/{github-frontend-P274ISBJ.mjs → github-frontend-VM52NX7N.mjs} +19 -1
  14. package/dist/sdk/{github-frontend-P274ISBJ.mjs.map → github-frontend-VM52NX7N.mjs.map} +1 -1
  15. package/dist/sdk/{host-AIMRV5YL.mjs → host-7MGCKSHM.mjs} +2 -2
  16. package/dist/sdk/{host-QYPOS4R6.mjs → host-BTHRY6NS.mjs} +2 -2
  17. package/dist/sdk/{schedule-tool-5FVFYH2A.mjs → schedule-tool-KKQ4W7KU.mjs} +3 -3
  18. package/dist/sdk/{schedule-tool-MQHISNJ6.mjs → schedule-tool-MPHHE2IM.mjs} +3 -3
  19. package/dist/sdk/{schedule-tool-handler-4TCT2P7A.mjs → schedule-tool-handler-6NUB2IHV.mjs} +3 -3
  20. package/dist/sdk/{schedule-tool-handler-TZYXM664.mjs → schedule-tool-handler-V7A4AQGS.mjs} +3 -3
  21. package/dist/sdk/sdk.js +311 -21
  22. package/dist/sdk/sdk.js.map +1 -1
  23. package/dist/sdk/sdk.mjs +2 -2
  24. package/dist/sdk/{workflow-check-provider-BE2SVYWW.mjs → workflow-check-provider-N4ZTFOH6.mjs} +3 -3
  25. package/dist/sdk/{workflow-check-provider-QKHL6AFT.mjs → workflow-check-provider-PI7VJT25.mjs} +3 -3
  26. package/dist/state-machine/context/build-engine-context.d.ts.map +1 -1
  27. package/dist/utils/fair-concurrency-limiter.d.ts +56 -0
  28. package/dist/utils/fair-concurrency-limiter.d.ts.map +1 -0
  29. package/dist/utils/interactive-prompt.d.ts.map +1 -1
  30. package/package.json +1 -1
  31. package/dist/sdk/chunk-P5P6BOO7.mjs.map +0 -1
  32. package/dist/sdk/chunk-WSYVK6ML.mjs.map +0 -1
  33. /package/dist/sdk/{check-provider-registry-PU67PWTU.mjs.map → check-provider-registry-6WR2SG66.mjs.map} +0 -0
  34. /package/dist/sdk/{check-provider-registry-TGPICTHD.mjs.map → check-provider-registry-CWLPAM5U.mjs.map} +0 -0
  35. /package/dist/sdk/{config-D6WF2U4B.mjs.map → config-DP5QU3XC.mjs.map} +0 -0
  36. /package/dist/sdk/{host-AIMRV5YL.mjs.map → host-7MGCKSHM.mjs.map} +0 -0
  37. /package/dist/sdk/{host-QYPOS4R6.mjs.map → host-BTHRY6NS.mjs.map} +0 -0
  38. /package/dist/sdk/{schedule-tool-5FVFYH2A.mjs.map → schedule-tool-KKQ4W7KU.mjs.map} +0 -0
  39. /package/dist/sdk/{schedule-tool-MQHISNJ6.mjs.map → schedule-tool-MPHHE2IM.mjs.map} +0 -0
  40. /package/dist/sdk/{schedule-tool-handler-4TCT2P7A.mjs.map → schedule-tool-handler-6NUB2IHV.mjs.map} +0 -0
  41. /package/dist/sdk/{schedule-tool-handler-TZYXM664.mjs.map → schedule-tool-handler-V7A4AQGS.mjs.map} +0 -0
  42. /package/dist/sdk/{workflow-check-provider-BE2SVYWW.mjs.map → workflow-check-provider-N4ZTFOH6.mjs.map} +0 -0
  43. /package/dist/sdk/{workflow-check-provider-QKHL6AFT.mjs.map → workflow-check-provider-PI7VJT25.mjs.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"","sourceRoot":"","sources":["file:///home/runner/work/visor/visor/src/config.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,WAAW,EAGX,YAAY,EAIZ,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAOzC;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,SAAS,YAAY,EAU9C,CAAC;AAEX;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,eAAe,CAgBrB;IACF,OAAO,CAAC,kBAAkB,CAA6C;IACvE,OAAO,CAAC,kBAAkB,CAAgE;IAC1F,OAAO,CAAC,mBAAmB,CAA2D;IAEtF;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAU5B;;OAEG;IACU,UAAU,CACrB,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,WAAW,CAAC;IAwHvB;;;OAGG;IACU,oBAAoB,CAC/B,GAAG,EAAE,OAAO,CAAC,WAAW,CAAC,EACzB,OAAO,GAAE,iBAAiB,GAAG;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAO,GACrD,OAAO,CAAC,WAAW,CAAC;IAoDvB;;OAEG;IACU,iBAAiB,CAAC,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,WAAW,CAAC;IA4CrF;;OAEG;YACW,qBAAqB;IAiBnC;;OAEG;IACU,gBAAgB,IAAI,OAAO,CAAC,WAAW,CAAC;IAgBrD;;OAEG;IACI,wBAAwB,IAAI,WAAW,GAAG,IAAI;IA0FrD;;O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;IAY1B,OAAO,CAAC,cAAc;IAetB;;;;;;;;OAQG;YACW,oBAAoB;IAgElC;;OAEG;YACW,2BAA2B;IAkEzC,OAAO,CAAC,iBAAiB;YAeX,qBAAqB;IA4CnC,OAAO,CAAC,aAAa;IAoErB,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,kBAAkB;IAS1B,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,kBAAkB;IAY1B,OAAO,CAAC,iBAAiB;IAczB;;;OAGG;YACW,sBAAsB;IA6DpC,OAAO,CAAC,cAAc;YAgBR,QAAQ;IAWtB;;OAEG;IACH,OAAO,CAAC,KAAK;CAGd"}
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- process.env.VISOR_VERSION = '0.1.166';
2
+ process.env.VISOR_VERSION = '0.1.167';
3
3
  process.env.PROBE_VERSION = '0.6.0-rc280';
4
- process.env.VISOR_COMMIT_SHA = 'eff5ed2df07d89e22e1c88d7d96b97572b0fd908';
5
- process.env.VISOR_COMMIT_SHORT = 'eff5ed2';
4
+ process.env.VISOR_COMMIT_SHA = '1e0341f43c4243f35be19f2043e34b954fdecde1';
5
+ process.env.VISOR_COMMIT_SHORT = '1e0341f';
6
6
  /******/ (() => { // webpackBootstrap
7
7
  /******/ var __webpack_modules__ = ({
8
8
 
@@ -164097,6 +164097,12 @@ class ConfigManager {
164097
164097
  if (workflowData.on) {
164098
164098
  visorConfig.on = workflowData.on;
164099
164099
  }
164100
+ if (workflowData.sandboxes) {
164101
+ visorConfig.sandboxes = workflowData.sandboxes;
164102
+ }
164103
+ if (workflowData.sandbox) {
164104
+ visorConfig.sandbox = workflowData.sandbox;
164105
+ }
164100
164106
  logger_1.logger.debug(`Standalone workflow config has ${Object.keys(workflowSteps).length} workflow steps as checks`);
164101
164107
  logger_1.logger.debug(`Workflow step names: ${Object.keys(workflowSteps).join(', ')}`);
164102
164108
  logger_1.logger.debug(`Config keys after conversion: ${Object.keys(visorConfig).join(', ')}`);
@@ -169982,8 +169988,14 @@ ${end}`);
169982
169988
  // Immediately set our lock so subsequent callers will wait for us
169983
169989
  this.updateLocks.set(group, ourLock);
169984
169990
  try {
169985
- // Wait for the previous lock to complete (if any)
169991
+ // Wait for the previous update to complete (if any)
169986
169992
  if (existingLock) {
169993
+ logger_1.logger.info(`[github-frontend] Comment update for group "${group}" queued, waiting for previous update to finish...`);
169994
+ const queuedAt = Date.now();
169995
+ const reminder = setInterval(() => {
169996
+ const waited = Math.round((Date.now() - queuedAt) / 1000);
169997
+ logger_1.logger.info(`[github-frontend] Comment update for group "${group}" still queued (${waited}s).`);
169998
+ }, 10000);
169987
169999
  try {
169988
170000
  await existingLock;
169989
170001
  }
@@ -169991,6 +170003,13 @@ ${end}`);
169991
170003
  logger_1.logger.warn(`[github-frontend] Previous update for group ${group} failed: ${error instanceof Error ? error.message : error}`);
169992
170004
  // Continue with current update despite previous failure
169993
170005
  }
170006
+ finally {
170007
+ clearInterval(reminder);
170008
+ const waitedMs = Date.now() - queuedAt;
170009
+ if (waitedMs > 100) {
170010
+ logger_1.logger.info(`[github-frontend] Comment update for group "${group}" dequeued after ${Math.round(waitedMs / 1000)}s.`);
170011
+ }
170012
+ }
169994
170013
  }
169995
170014
  // Now perform our update
169996
170015
  await this.performGroupedCommentUpdate(ctx, comments, group, changedIds);
@@ -203104,20 +203123,7 @@ const memory_store_1 = __nccwpck_require__(18216);
203104
203123
  const human_id_1 = __nccwpck_require__(30920);
203105
203124
  const logger_1 = __nccwpck_require__(86999);
203106
203125
  const workspace_manager_1 = __nccwpck_require__(6134);
203107
- // Lazy-resolve DelegationManager from @probelabs/probe.
203108
- // The class may not be exported in older published versions, so we
203109
- // fall back gracefully to avoid breaking the build.
203110
- let _DelegationManager = null;
203111
- try {
203112
- // eslint-disable-next-line @typescript-eslint/no-var-requires
203113
- const probe = __nccwpck_require__(83841);
203114
- if (probe && typeof probe.DelegationManager === 'function') {
203115
- _DelegationManager = probe.DelegationManager;
203116
- }
203117
- }
203118
- catch {
203119
- // Not available — max_ai_concurrency will be silently ignored
203120
- }
203126
+ const fair_concurrency_limiter_1 = __nccwpck_require__(13656);
203121
203127
  /**
203122
203128
  * Apply minimal criticality defaults in-place.
203123
203129
  * This is a no-behavior-change scaffold: we only default missing
@@ -203191,14 +203197,40 @@ function buildEngineContextForRun(workingDirectory, config, prInfo, debug, maxPa
203191
203197
  // Initialize journal and memory
203192
203198
  const journal = new snapshot_store_1.ExecutionJournal();
203193
203199
  const memory = memory_store_1.MemoryStore.getInstance(clonedConfig.memory);
203194
- // Create shared AI concurrency limiter if configured
203200
+ // Create shared AI concurrency limiter if configured.
203201
+ // Uses a global singleton fair limiter: round-robin across sessions so
203202
+ // no single user/task can starve others.
203195
203203
  let sharedConcurrencyLimiter = undefined;
203196
- if (clonedConfig.max_ai_concurrency && _DelegationManager) {
203197
- sharedConcurrencyLimiter = new _DelegationManager({
203198
- maxConcurrent: clonedConfig.max_ai_concurrency,
203199
- maxPerSession: 999, // No per-session limit needed for global AI gating
203200
- });
203201
- logger_1.logger.debug(`[EngineContext] Created shared AI concurrency limiter (max: ${clonedConfig.max_ai_concurrency})`);
203204
+ const sessionId = (0, human_id_1.generateHumanId)();
203205
+ if (clonedConfig.max_ai_concurrency) {
203206
+ const fairLimiter = fair_concurrency_limiter_1.FairConcurrencyLimiter.getInstance(clonedConfig.max_ai_concurrency);
203207
+ // Bind this engine run's session ID into acquire/release so the fair limiter
203208
+ // knows which user/task each call belongs to. Probe calls acquire(null)
203209
+ // we intercept and inject our session ID.
203210
+ sharedConcurrencyLimiter = {
203211
+ async acquire(parentSessionId, _dbg, queueTimeout) {
203212
+ // Use visor session ID if probe didn't provide one
203213
+ const sid = parentSessionId || sessionId;
203214
+ return fairLimiter.acquire(sid, _dbg, queueTimeout);
203215
+ },
203216
+ release(parentSessionId, _dbg) {
203217
+ const sid = parentSessionId || sessionId;
203218
+ return fairLimiter.release(sid, _dbg);
203219
+ },
203220
+ tryAcquire(parentSessionId) {
203221
+ const sid = parentSessionId || sessionId;
203222
+ return fairLimiter.tryAcquire(sid);
203223
+ },
203224
+ getStats() {
203225
+ return fairLimiter.getStats();
203226
+ },
203227
+ shutdown() {
203228
+ // Don't destroy the singleton — other sessions may still use it
203229
+ },
203230
+ cleanup() {
203231
+ // Don't destroy the singleton — other sessions may still use it
203232
+ },
203233
+ };
203202
203234
  }
203203
203235
  return {
203204
203236
  mode: 'state-machine',
@@ -203208,7 +203240,7 @@ function buildEngineContextForRun(workingDirectory, config, prInfo, debug, maxPa
203208
203240
  memory,
203209
203241
  workingDirectory,
203210
203242
  originalWorkingDirectory: workingDirectory,
203211
- sessionId: (0, human_id_1.generateHumanId)(),
203243
+ sessionId,
203212
203244
  event: prInfo.eventType,
203213
203245
  debug,
203214
203246
  maxParallelism,
@@ -206638,7 +206670,27 @@ async function executeCheckGroup(checks, context, state, maxParallelism, emitEve
206638
206670
  catch { }
206639
206671
  // Wait if pool is full
206640
206672
  if (pool.length >= maxParallelism) {
206641
- await Promise.race(pool);
206673
+ const activeCount = pool.filter(p => !p._settled).length;
206674
+ logger_1.logger.info(`[LevelDispatch] Check pool full (${activeCount}/${maxParallelism} active). ` +
206675
+ `Check "${checkId}" queued, waiting for a slot...`);
206676
+ const queuedAt = Date.now();
206677
+ // Periodic reminder while waiting
206678
+ const reminder = setInterval(() => {
206679
+ const waited = Math.round((Date.now() - queuedAt) / 1000);
206680
+ const stillActive = pool.filter(p => !p._settled).length;
206681
+ logger_1.logger.info(`[LevelDispatch] Check "${checkId}" still queued (${waited}s). ` +
206682
+ `${stillActive}/${maxParallelism} slots busy.`);
206683
+ }, 15000);
206684
+ try {
206685
+ await Promise.race(pool);
206686
+ }
206687
+ finally {
206688
+ clearInterval(reminder);
206689
+ }
206690
+ const waitedMs = Date.now() - queuedAt;
206691
+ if (waitedMs > 100) {
206692
+ logger_1.logger.info(`[LevelDispatch] Check "${checkId}" dequeued after ${Math.round(waitedMs / 1000)}s wait.`);
206693
+ }
206642
206694
  // Remove completed promises
206643
206695
  pool.splice(0, pool.length, ...pool.filter(p => {
206644
206696
  const settled = p._settled;
@@ -222224,6 +222276,254 @@ class EnvironmentResolver {
222224
222276
  exports.EnvironmentResolver = EnvironmentResolver;
222225
222277
 
222226
222278
 
222279
+ /***/ }),
222280
+
222281
+ /***/ 13656:
222282
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
222283
+
222284
+ "use strict";
222285
+
222286
+ /**
222287
+ * Fair round-robin concurrency limiter.
222288
+ *
222289
+ * Single global limiter for all AI/delegation calls in the process.
222290
+ * Instead of FIFO (which lets one session hog all slots), this grants
222291
+ * slots in round-robin order across sessions so every user gets fair access.
222292
+ *
222293
+ * Usage:
222294
+ * const limiter = FairConcurrencyLimiter.getInstance(maxConcurrent);
222295
+ * await limiter.acquire(sessionId); // blocks until slot available
222296
+ * try { ... } finally { limiter.release(sessionId); }
222297
+ */
222298
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
222299
+ exports.FairConcurrencyLimiter = void 0;
222300
+ const logger_1 = __nccwpck_require__(86999);
222301
+ class FairConcurrencyLimiter {
222302
+ maxConcurrent;
222303
+ globalActive = 0;
222304
+ // Per-session FIFO queues
222305
+ sessionQueues = new Map();
222306
+ // Round-robin order of sessions with waiting entries
222307
+ roundRobinSessions = [];
222308
+ roundRobinIndex = 0;
222309
+ // Per-session active count (for stats)
222310
+ sessionActive = new Map();
222311
+ constructor(maxConcurrent) {
222312
+ this.maxConcurrent = maxConcurrent;
222313
+ }
222314
+ static getInstance(maxConcurrent) {
222315
+ const key = Symbol.for('visor.fairConcurrencyLimiter');
222316
+ let instance = globalThis[key];
222317
+ if (!instance) {
222318
+ instance = new FairConcurrencyLimiter(maxConcurrent);
222319
+ globalThis[key] = instance;
222320
+ logger_1.logger.info(`[FairLimiter] Created global fair concurrency limiter (max: ${maxConcurrent})`);
222321
+ }
222322
+ else if (instance.maxConcurrent !== maxConcurrent) {
222323
+ // Config changed — update max (live resize)
222324
+ const old = instance.maxConcurrent;
222325
+ instance.maxConcurrent = maxConcurrent;
222326
+ logger_1.logger.info(`[FairLimiter] Updated max concurrency: ${old} -> ${maxConcurrent}`);
222327
+ // Process queue in case new slots opened up
222328
+ instance._processQueue();
222329
+ }
222330
+ return instance;
222331
+ }
222332
+ /**
222333
+ * Try to acquire a slot immediately (non-blocking).
222334
+ */
222335
+ tryAcquire(sessionId) {
222336
+ if (this.globalActive >= this.maxConcurrent) {
222337
+ return false;
222338
+ }
222339
+ this.globalActive++;
222340
+ const sid = sessionId || '__anonymous__';
222341
+ this.sessionActive.set(sid, (this.sessionActive.get(sid) || 0) + 1);
222342
+ return true;
222343
+ }
222344
+ /**
222345
+ * Acquire a slot, waiting in a fair queue if necessary.
222346
+ * Sessions are served round-robin so no single session can starve others.
222347
+ */
222348
+ async acquire(sessionId, _debug, queueTimeout) {
222349
+ const sid = sessionId || '__anonymous__';
222350
+ // Fast path — slot available
222351
+ if (this.tryAcquire(sid)) {
222352
+ return true;
222353
+ }
222354
+ // Compute queue stats for logging
222355
+ const totalQueued = this._totalQueued();
222356
+ const sessionsWaiting = this.sessionQueues.size;
222357
+ const sessionQueueLen = this.sessionQueues.get(sid)?.length || 0;
222358
+ logger_1.logger.info(`[FairLimiter] Slot unavailable (${this.globalActive}/${this.maxConcurrent} active). ` +
222359
+ `Session "${sid}" queued (${sessionQueueLen} own + ${totalQueued} total across ${sessionsWaiting} sessions). Waiting...`);
222360
+ const queuedAt = Date.now();
222361
+ const effectiveTimeout = queueTimeout ?? 120000; // default 2 min
222362
+ return new Promise((resolve, reject) => {
222363
+ const entry = { resolve, reject, queuedAt };
222364
+ // Periodic reminder every 15s
222365
+ entry.reminder = setInterval(() => {
222366
+ const waited = Math.round((Date.now() - queuedAt) / 1000);
222367
+ const curQueued = this._totalQueued();
222368
+ const curSessions = this._waitingSessions();
222369
+ logger_1.logger.info(`[FairLimiter] Session "${sid}" still waiting (${waited}s). ` +
222370
+ `${this.globalActive}/${this.maxConcurrent} active, ` +
222371
+ `${curQueued} queued across ${curSessions} sessions.`);
222372
+ }, 15000);
222373
+ // Add to this session's queue
222374
+ let queue = this.sessionQueues.get(sid);
222375
+ if (!queue) {
222376
+ queue = [];
222377
+ this.sessionQueues.set(sid, queue);
222378
+ // Add to round-robin rotation
222379
+ this.roundRobinSessions.push(sid);
222380
+ }
222381
+ queue.push(entry);
222382
+ // Timeout
222383
+ if (effectiveTimeout > 0) {
222384
+ setTimeout(() => {
222385
+ // Remove from queue if still there
222386
+ const q = this.sessionQueues.get(sid);
222387
+ if (q) {
222388
+ const idx = q.indexOf(entry);
222389
+ if (idx !== -1) {
222390
+ q.splice(idx, 1);
222391
+ if (q.length === 0) {
222392
+ this.sessionQueues.delete(sid);
222393
+ this._removeFromRoundRobin(sid);
222394
+ }
222395
+ this._clearReminder(entry);
222396
+ reject(new Error(`[FairLimiter] Queue timeout: session "${sid}" waited ${effectiveTimeout}ms for a slot`));
222397
+ }
222398
+ }
222399
+ }, effectiveTimeout);
222400
+ }
222401
+ });
222402
+ }
222403
+ /**
222404
+ * Release a slot and grant the next one fairly (round-robin across sessions).
222405
+ */
222406
+ release(sessionId, _debug) {
222407
+ const sid = sessionId || '__anonymous__';
222408
+ this.globalActive = Math.max(0, this.globalActive - 1);
222409
+ const active = this.sessionActive.get(sid);
222410
+ if (active !== undefined) {
222411
+ if (active <= 1) {
222412
+ this.sessionActive.delete(sid);
222413
+ }
222414
+ else {
222415
+ this.sessionActive.set(sid, active - 1);
222416
+ }
222417
+ }
222418
+ this._processQueue();
222419
+ }
222420
+ /**
222421
+ * Round-robin queue processing: cycle through sessions and grant one slot per session per round.
222422
+ */
222423
+ _processQueue() {
222424
+ const toGrant = [];
222425
+ while (this.globalActive < this.maxConcurrent && this.roundRobinSessions.length > 0) {
222426
+ // Wrap index
222427
+ if (this.roundRobinIndex >= this.roundRobinSessions.length) {
222428
+ this.roundRobinIndex = 0;
222429
+ }
222430
+ const sid = this.roundRobinSessions[this.roundRobinIndex];
222431
+ const queue = this.sessionQueues.get(sid);
222432
+ if (!queue || queue.length === 0) {
222433
+ // Session has no more waiters — remove from rotation
222434
+ this.sessionQueues.delete(sid);
222435
+ this.roundRobinSessions.splice(this.roundRobinIndex, 1);
222436
+ // Don't increment index — next session slides into this position
222437
+ continue;
222438
+ }
222439
+ // Grant the oldest entry from this session
222440
+ const entry = queue.shift();
222441
+ if (queue.length === 0) {
222442
+ this.sessionQueues.delete(sid);
222443
+ this.roundRobinSessions.splice(this.roundRobinIndex, 1);
222444
+ // Don't increment — next session slides in
222445
+ }
222446
+ else {
222447
+ this.roundRobinIndex++;
222448
+ }
222449
+ this.globalActive++;
222450
+ this.sessionActive.set(sid, (this.sessionActive.get(sid) || 0) + 1);
222451
+ toGrant.push({ entry, sid });
222452
+ }
222453
+ // Resolve outside the loop to avoid reentrancy issues
222454
+ for (const { entry, sid } of toGrant) {
222455
+ this._clearReminder(entry);
222456
+ const waitedMs = Date.now() - entry.queuedAt;
222457
+ if (waitedMs > 100) {
222458
+ logger_1.logger.info(`[FairLimiter] Session "${sid}" acquired slot after ${Math.round(waitedMs / 1000)}s wait.`);
222459
+ }
222460
+ // Defer to next tick to avoid blocking event loop
222461
+ setImmediate(() => entry.resolve(true));
222462
+ }
222463
+ }
222464
+ getStats() {
222465
+ const perSession = {};
222466
+ const allSessions = new Set([...this.sessionActive.keys(), ...this.sessionQueues.keys()]);
222467
+ for (const sid of allSessions) {
222468
+ perSession[sid] = {
222469
+ active: this.sessionActive.get(sid) || 0,
222470
+ queued: this.sessionQueues.get(sid)?.length || 0,
222471
+ };
222472
+ }
222473
+ return {
222474
+ globalActive: this.globalActive,
222475
+ maxConcurrent: this.maxConcurrent,
222476
+ queueSize: this._totalQueued(),
222477
+ waitingSessions: this._waitingSessions(),
222478
+ perSession,
222479
+ };
222480
+ }
222481
+ cleanup() {
222482
+ // Clear all reminders
222483
+ for (const queue of this.sessionQueues.values()) {
222484
+ for (const entry of queue) {
222485
+ this._clearReminder(entry);
222486
+ }
222487
+ }
222488
+ this.sessionQueues.clear();
222489
+ this.roundRobinSessions = [];
222490
+ this.roundRobinIndex = 0;
222491
+ // Remove singleton
222492
+ const key = Symbol.for('visor.fairConcurrencyLimiter');
222493
+ delete globalThis[key];
222494
+ }
222495
+ shutdown() {
222496
+ this.cleanup();
222497
+ }
222498
+ // -- helpers --
222499
+ _totalQueued() {
222500
+ let n = 0;
222501
+ for (const q of this.sessionQueues.values())
222502
+ n += q.length;
222503
+ return n;
222504
+ }
222505
+ _waitingSessions() {
222506
+ return this.roundRobinSessions.length;
222507
+ }
222508
+ _removeFromRoundRobin(sid) {
222509
+ const idx = this.roundRobinSessions.indexOf(sid);
222510
+ if (idx !== -1) {
222511
+ this.roundRobinSessions.splice(idx, 1);
222512
+ if (this.roundRobinIndex > idx) {
222513
+ this.roundRobinIndex--;
222514
+ }
222515
+ }
222516
+ }
222517
+ _clearReminder(entry) {
222518
+ if (entry.reminder) {
222519
+ clearInterval(entry.reminder);
222520
+ entry.reminder = undefined;
222521
+ }
222522
+ }
222523
+ }
222524
+ exports.FairConcurrencyLimiter = FairConcurrencyLimiter;
222525
+
222526
+
222227
222527
  /***/ }),
222228
222528
 
222229
222529
  /***/ 69342:
@@ -222622,7 +222922,22 @@ async function acquirePromptLock() {
222622
222922
  activePrompt = true;
222623
222923
  return;
222624
222924
  }
222625
- await new Promise(resolve => waiters.push(resolve));
222925
+ console.error(`[human-input] Prompt queued, waiting for active prompt to finish (${waiters.length} already waiting).`);
222926
+ const queuedAt = Date.now();
222927
+ const reminder = setInterval(() => {
222928
+ const waited = Math.round((Date.now() - queuedAt) / 1000);
222929
+ console.error(`[human-input] Still waiting for prompt lock (${waited}s, ${waiters.length} in queue).`);
222930
+ }, 10000);
222931
+ try {
222932
+ await new Promise(resolve => waiters.push(resolve));
222933
+ }
222934
+ finally {
222935
+ clearInterval(reminder);
222936
+ const waitedMs = Date.now() - queuedAt;
222937
+ if (waitedMs > 100) {
222938
+ console.error(`[human-input] Prompt lock acquired after ${Math.round(waitedMs / 1000)}s wait.`);
222939
+ }
222940
+ }
222626
222941
  activePrompt = true;
222627
222942
  }
222628
222943
  function releasePromptLock() {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  CheckProviderRegistry,
3
3
  init_check_provider_registry
4
- } from "./chunk-P5P6BOO7.mjs";
4
+ } from "./chunk-2G2PJKHM.mjs";
5
5
  import "./chunk-KFKHU6CM.mjs";
6
6
  import "./chunk-AVMMKGLQ.mjs";
7
7
  import "./chunk-LG4AUKHB.mjs";
@@ -9,7 +9,7 @@ import "./chunk-B7BVQM5K.mjs";
9
9
  import "./chunk-XXAEN5KU.mjs";
10
10
  import "./chunk-GEW6LS32.mjs";
11
11
  import "./chunk-NZADFXHE.mjs";
12
- import "./chunk-DEAPFYNX.mjs";
12
+ import "./chunk-KYBKVKBS.mjs";
13
13
  import "./chunk-NCWIZVOT.mjs";
14
14
  import "./chunk-RV5SK4FZ.mjs";
15
15
  import "./chunk-E7NRUDWL.mjs";
@@ -26,4 +26,4 @@ init_check_provider_registry();
26
26
  export {
27
27
  CheckProviderRegistry
28
28
  };
29
- //# sourceMappingURL=check-provider-registry-PU67PWTU.mjs.map
29
+ //# sourceMappingURL=check-provider-registry-6WR2SG66.mjs.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  CheckProviderRegistry,
3
3
  init_check_provider_registry
4
- } from "./chunk-WSYVK6ML.mjs";
4
+ } from "./chunk-3LXYZ2OQ.mjs";
5
5
  import "./chunk-KFKHU6CM.mjs";
6
6
  import "./chunk-AVMMKGLQ.mjs";
7
7
  import "./chunk-LG4AUKHB.mjs";
@@ -9,7 +9,7 @@ import "./chunk-B7BVQM5K.mjs";
9
9
  import "./chunk-XXAEN5KU.mjs";
10
10
  import "./chunk-GEW6LS32.mjs";
11
11
  import "./chunk-NZADFXHE.mjs";
12
- import "./chunk-DEAPFYNX.mjs";
12
+ import "./chunk-KYBKVKBS.mjs";
13
13
  import "./chunk-NCWIZVOT.mjs";
14
14
  import "./chunk-RV5SK4FZ.mjs";
15
15
  import "./chunk-E7NRUDWL.mjs";
@@ -26,4 +26,4 @@ init_check_provider_registry();
26
26
  export {
27
27
  CheckProviderRegistry
28
28
  };
29
- //# sourceMappingURL=check-provider-registry-TGPICTHD.mjs.map
29
+ //# sourceMappingURL=check-provider-registry-CWLPAM5U.mjs.map