@merittdev/horus 0.11.0 → 0.12.1

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 (3) hide show
  1. package/README.md +14 -7
  2. package/dist/index.cjs +375 -316
  3. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -14500,7 +14500,7 @@ var require_utils = __commonJS({
14500
14500
  }
14501
14501
  }
14502
14502
  function get(url, options = {}) {
14503
- return new Promise((resolve12, reject) => {
14503
+ return new Promise((resolve13, reject) => {
14504
14504
  let timeoutId;
14505
14505
  const request = http.get(url, options, (response) => {
14506
14506
  response.setEncoding("utf8");
@@ -14508,7 +14508,7 @@ var require_utils = __commonJS({
14508
14508
  response.on("data", (chunk) => body2 += chunk);
14509
14509
  response.on("end", () => {
14510
14510
  (0, timers_1.clearTimeout)(timeoutId);
14511
- resolve12({ status: response.statusCode, body: body2 });
14511
+ resolve13({ status: response.statusCode, body: body2 });
14512
14512
  });
14513
14513
  }).on("error", (error3) => {
14514
14514
  (0, timers_1.clearTimeout)(timeoutId);
@@ -14527,13 +14527,13 @@ var require_utils = __commonJS({
14527
14527
  return host && match.test(host.toLowerCase()) ? true : false;
14528
14528
  }
14529
14529
  function promiseWithResolvers() {
14530
- let resolve12;
14530
+ let resolve13;
14531
14531
  let reject;
14532
14532
  const promise = new Promise(function withResolversExecutor(promiseResolve, promiseReject) {
14533
- resolve12 = promiseResolve;
14533
+ resolve13 = promiseResolve;
14534
14534
  reject = promiseReject;
14535
14535
  });
14536
- return { promise, resolve: resolve12, reject };
14536
+ return { promise, resolve: resolve13, reject };
14537
14537
  }
14538
14538
  function squashError(_error) {
14539
14539
  return;
@@ -14544,8 +14544,8 @@ var require_utils = __commonJS({
14544
14544
  exports2.randomBytes = randomBytes;
14545
14545
  async function once(ee3, name2, options) {
14546
14546
  options?.signal?.throwIfAborted();
14547
- const { promise, resolve: resolve12, reject } = promiseWithResolvers();
14548
- const onEvent = (data) => resolve12(data);
14547
+ const { promise, resolve: resolve13, reject } = promiseWithResolvers();
14548
+ const onEvent = (data) => resolve13(data);
14549
14549
  const onError2 = (error3) => reject(error3);
14550
14550
  const abortListener = addAbortListener(options?.signal, function() {
14551
14551
  reject(this.reason);
@@ -17165,13 +17165,13 @@ var require_mongo_logger = __commonJS({
17165
17165
  function createStdioLogger(stream) {
17166
17166
  return {
17167
17167
  write: (log) => {
17168
- return new Promise((resolve12, reject) => {
17168
+ return new Promise((resolve13, reject) => {
17169
17169
  const logLine = (0, util_1.inspect)(log, { compact: true, breakLength: Infinity });
17170
17170
  stream.write(`${logLine}
17171
17171
  `, "utf-8", (error3) => {
17172
17172
  if (error3)
17173
17173
  return reject(error3);
17174
- resolve12(true);
17174
+ resolve13(true);
17175
17175
  });
17176
17176
  });
17177
17177
  }
@@ -28020,20 +28020,20 @@ var require_compression = __commonJS({
28020
28020
  ]);
28021
28021
  var ZSTD_COMPRESSION_LEVEL = 3;
28022
28022
  var zlibInflate = (buf) => {
28023
- return new Promise((resolve12, reject) => {
28023
+ return new Promise((resolve13, reject) => {
28024
28024
  zlib.inflate(buf, (error3, result) => {
28025
28025
  if (error3)
28026
28026
  return reject(error3);
28027
- resolve12(result);
28027
+ resolve13(result);
28028
28028
  });
28029
28029
  });
28030
28030
  };
28031
28031
  var zlibDeflate = (buf, options) => {
28032
- return new Promise((resolve12, reject) => {
28032
+ return new Promise((resolve13, reject) => {
28033
28033
  zlib.deflate(buf, options, (error3, result) => {
28034
28034
  if (error3)
28035
28035
  return reject(error3);
28036
- resolve12(result);
28036
+ resolve13(result);
28037
28037
  });
28038
28038
  });
28039
28039
  };
@@ -28761,7 +28761,7 @@ var require_state_machine = __commonJS({
28761
28761
  socket = tls2.connect(socketOptions, () => {
28762
28762
  socket.write(message);
28763
28763
  });
28764
- const { promise: willResolveKmsRequest, reject: rejectOnTlsSocketError, resolve: resolve12 } = (0, utils_1.promiseWithResolvers)();
28764
+ const { promise: willResolveKmsRequest, reject: rejectOnTlsSocketError, resolve: resolve13 } = (0, utils_1.promiseWithResolvers)();
28765
28765
  abortListener = (0, utils_1.addAbortListener)(options?.signal, function() {
28766
28766
  destroySockets();
28767
28767
  rejectOnTlsSocketError(this.reason);
@@ -28773,7 +28773,7 @@ var require_state_machine = __commonJS({
28773
28773
  request.addResponse(buffer2.read(bytesNeeded));
28774
28774
  }
28775
28775
  if (request.bytesNeeded <= 0) {
28776
- resolve12();
28776
+ resolve13();
28777
28777
  }
28778
28778
  });
28779
28779
  await (options?.timeoutContext?.csotEnabled() ? Promise.all([
@@ -30365,8 +30365,8 @@ var require_on_data = __commonJS({
30365
30365
  }
30366
30366
  if (finished)
30367
30367
  return closeHandler();
30368
- const { promise, resolve: resolve12, reject } = (0, utils_1.promiseWithResolvers)();
30369
- unconsumedPromises.push({ resolve: resolve12, reject });
30368
+ const { promise, resolve: resolve13, reject } = (0, utils_1.promiseWithResolvers)();
30369
+ unconsumedPromises.push({ resolve: resolve13, reject });
30370
30370
  return promise;
30371
30371
  },
30372
30372
  return() {
@@ -31550,13 +31550,13 @@ var require_connect = __commonJS({
31550
31550
  socket.setNoDelay(noDelay);
31551
31551
  socket.setTimeout(connectTimeoutMS);
31552
31552
  let cancellationHandler = null;
31553
- const { promise: connectedSocket, resolve: resolve12, reject } = (0, utils_1.promiseWithResolvers)();
31553
+ const { promise: connectedSocket, resolve: resolve13, reject } = (0, utils_1.promiseWithResolvers)();
31554
31554
  if (existingSocket) {
31555
- resolve12(socket);
31555
+ resolve13(socket);
31556
31556
  } else {
31557
31557
  const start2 = performance.now();
31558
31558
  const connectEvent = useTLS ? "secureConnect" : "connect";
31559
- socket.once(connectEvent, () => resolve12(socket)).once("error", (cause) => reject(new error_1.MongoNetworkError(error_1.MongoError.buildErrorMessage(cause), { cause }))).once("timeout", () => {
31559
+ socket.once(connectEvent, () => resolve13(socket)).once("error", (cause) => reject(new error_1.MongoNetworkError(error_1.MongoError.buildErrorMessage(cause), { cause }))).once("timeout", () => {
31560
31560
  reject(new error_1.MongoNetworkTimeoutError(`Socket '${connectEvent}' timed out after ${performance.now() - start2 | 0}ms (connectTimeoutMS: ${connectTimeoutMS})`));
31561
31561
  }).once("close", () => reject(new error_1.MongoNetworkError(`Socket closed after ${performance.now() - start2 | 0} during connection establishment`)));
31562
31562
  if (options.cancellationToken != null) {
@@ -32117,10 +32117,10 @@ var require_connection_pool = __commonJS({
32117
32117
  async checkOut(options) {
32118
32118
  const checkoutTime = (0, utils_1.processTimeMS)();
32119
32119
  this.emitAndLog(_ConnectionPool.CONNECTION_CHECK_OUT_STARTED, new connection_pool_events_1.ConnectionCheckOutStartedEvent(this));
32120
- const { promise, resolve: resolve12, reject } = (0, utils_1.promiseWithResolvers)();
32120
+ const { promise, resolve: resolve13, reject } = (0, utils_1.promiseWithResolvers)();
32121
32121
  const timeout = options.timeoutContext.connectionCheckoutTimeout;
32122
32122
  const waitQueueMember = {
32123
- resolve: resolve12,
32123
+ resolve: resolve13,
32124
32124
  reject,
32125
32125
  cancelled: false,
32126
32126
  checkoutTime
@@ -33359,13 +33359,13 @@ var require_connection_string = __commonJS({
33359
33359
  var LB_REPLICA_SET_ERROR = "loadBalanced option not supported with a replicaSet option";
33360
33360
  var LB_DIRECT_CONNECTION_ERROR = "loadBalanced option not supported when directConnection is provided";
33361
33361
  function retryDNSTimeoutFor(rrtype) {
33362
- const resolve12 = rrtype === "SRV" ? (address) => dns.promises.resolve(address, "SRV") : (address) => dns.promises.resolve(address, "TXT");
33362
+ const resolve13 = rrtype === "SRV" ? (address) => dns.promises.resolve(address, "SRV") : (address) => dns.promises.resolve(address, "TXT");
33363
33363
  return async function dnsReqRetryTimeout(lookupAddress) {
33364
33364
  try {
33365
- return await resolve12(lookupAddress);
33365
+ return await resolve13(lookupAddress);
33366
33366
  } catch (firstDNSError) {
33367
33367
  if (firstDNSError.code === dns.TIMEOUT) {
33368
- return await resolve12(lookupAddress);
33368
+ return await resolve13(lookupAddress);
33369
33369
  } else {
33370
33370
  throw firstDNSError;
33371
33371
  }
@@ -37068,13 +37068,13 @@ var require_topology = __commonJS({
37068
37068
  }
37069
37069
  return transaction.server;
37070
37070
  }
37071
- const { promise: serverPromise, resolve: resolve12, reject } = (0, utils_1.promiseWithResolvers)();
37071
+ const { promise: serverPromise, resolve: resolve13, reject } = (0, utils_1.promiseWithResolvers)();
37072
37072
  const waitQueueMember = {
37073
37073
  serverSelector,
37074
37074
  topologyDescription: this.description,
37075
37075
  mongoLogger: this.client.mongoLogger,
37076
37076
  transaction,
37077
- resolve: resolve12,
37077
+ resolve: resolve13,
37078
37078
  reject,
37079
37079
  cancelled: false,
37080
37080
  startTime: (0, utils_1.processTimeMS)(),
@@ -42598,7 +42598,7 @@ var require_dist2 = __commonJS({
42598
42598
  function parse4(stream, callback) {
42599
42599
  const parser = new parser_1.Parser();
42600
42600
  stream.on("data", (buffer2) => parser.parse(buffer2, callback));
42601
- return new Promise((resolve12) => stream.on("end", () => resolve12()));
42601
+ return new Promise((resolve13) => stream.on("end", () => resolve13()));
42602
42602
  }
42603
42603
  }
42604
42604
  });
@@ -43367,12 +43367,12 @@ var require_client = __commonJS({
43367
43367
  this._connect(callback);
43368
43368
  return;
43369
43369
  }
43370
- return new this._Promise((resolve12, reject) => {
43370
+ return new this._Promise((resolve13, reject) => {
43371
43371
  this._connect((error3) => {
43372
43372
  if (error3) {
43373
43373
  reject(error3);
43374
43374
  } else {
43375
- resolve12(this);
43375
+ resolve13(this);
43376
43376
  }
43377
43377
  });
43378
43378
  });
@@ -43719,8 +43719,8 @@ var require_client = __commonJS({
43719
43719
  } else {
43720
43720
  query = new Query3(config2, values2, callback);
43721
43721
  if (!query.callback) {
43722
- result = new this._Promise((resolve12, reject) => {
43723
- query.callback = (err2, res) => err2 ? reject(err2) : resolve12(res);
43722
+ result = new this._Promise((resolve13, reject) => {
43723
+ query.callback = (err2, res) => err2 ? reject(err2) : resolve13(res);
43724
43724
  }).catch((err2) => {
43725
43725
  Error.captureStackTrace(err2);
43726
43726
  throw err2;
@@ -43804,8 +43804,8 @@ var require_client = __commonJS({
43804
43804
  if (cb) {
43805
43805
  this.connection.once("end", cb);
43806
43806
  } else {
43807
- return new this._Promise((resolve12) => {
43808
- this.connection.once("end", resolve12);
43807
+ return new this._Promise((resolve13) => {
43808
+ this.connection.once("end", resolve13);
43809
43809
  });
43810
43810
  }
43811
43811
  }
@@ -43855,8 +43855,8 @@ var require_pg_pool = __commonJS({
43855
43855
  const cb = function(err2, client) {
43856
43856
  err2 ? rej(err2) : res(client);
43857
43857
  };
43858
- const result = new Promise2(function(resolve12, reject) {
43859
- res = resolve12;
43858
+ const result = new Promise2(function(resolve13, reject) {
43859
+ res = resolve13;
43860
43860
  rej = reject;
43861
43861
  }).catch((err2) => {
43862
43862
  Error.captureStackTrace(err2);
@@ -43917,7 +43917,7 @@ var require_pg_pool = __commonJS({
43917
43917
  if (typeof Promise2.try === "function") {
43918
43918
  return Promise2.try(f5);
43919
43919
  }
43920
- return new Promise2((resolve12) => resolve12(f5()));
43920
+ return new Promise2((resolve13) => resolve13(f5()));
43921
43921
  }
43922
43922
  _isFull() {
43923
43923
  return this._clients.length >= this.options.max;
@@ -44311,8 +44311,8 @@ var require_query2 = __commonJS({
44311
44311
  NativeQuery.prototype._getPromise = function() {
44312
44312
  if (this._promise) return this._promise;
44313
44313
  this._promise = new Promise(
44314
- function(resolve12, reject) {
44315
- this._once("end", resolve12);
44314
+ function(resolve13, reject) {
44315
+ this._once("end", resolve13);
44316
44316
  this._once("error", reject);
44317
44317
  }.bind(this)
44318
44318
  );
@@ -44491,12 +44491,12 @@ var require_client2 = __commonJS({
44491
44491
  this._connect(callback);
44492
44492
  return;
44493
44493
  }
44494
- return new this._Promise((resolve12, reject) => {
44494
+ return new this._Promise((resolve13, reject) => {
44495
44495
  this._connect((error3) => {
44496
44496
  if (error3) {
44497
44497
  reject(error3);
44498
44498
  } else {
44499
- resolve12(this);
44499
+ resolve13(this);
44500
44500
  }
44501
44501
  });
44502
44502
  });
@@ -44520,8 +44520,8 @@ var require_client2 = __commonJS({
44520
44520
  query = new NativeQuery(config2, values2, callback);
44521
44521
  if (!query.callback) {
44522
44522
  let resolveOut, rejectOut;
44523
- result = new this._Promise((resolve12, reject) => {
44524
- resolveOut = resolve12;
44523
+ result = new this._Promise((resolve13, reject) => {
44524
+ resolveOut = resolve13;
44525
44525
  rejectOut = reject;
44526
44526
  }).catch((err2) => {
44527
44527
  Error.captureStackTrace(err2);
@@ -44584,8 +44584,8 @@ var require_client2 = __commonJS({
44584
44584
  }
44585
44585
  let result;
44586
44586
  if (!cb) {
44587
- result = new this._Promise(function(resolve12, reject) {
44588
- cb = (err2) => err2 ? reject(err2) : resolve12();
44587
+ result = new this._Promise(function(resolve13, reject) {
44588
+ cb = (err2) => err2 ? reject(err2) : resolve13();
44589
44589
  });
44590
44590
  }
44591
44591
  this.native.end(function() {
@@ -49964,7 +49964,7 @@ var require_Command = __commonJS({
49964
49964
  }
49965
49965
  }
49966
49966
  initPromise() {
49967
- const promise = new Promise((resolve12, reject) => {
49967
+ const promise = new Promise((resolve13, reject) => {
49968
49968
  if (!this.transformed) {
49969
49969
  this.transformed = true;
49970
49970
  const transformer = _Command._transformer.argument[this.name];
@@ -49973,7 +49973,7 @@ var require_Command = __commonJS({
49973
49973
  }
49974
49974
  this.stringifyArguments();
49975
49975
  }
49976
- this.resolve = this._convertValue(resolve12);
49976
+ this.resolve = this._convertValue(resolve13);
49977
49977
  this.reject = (err2) => {
49978
49978
  this._clearTimers();
49979
49979
  if (this.errorStack) {
@@ -50006,11 +50006,11 @@ var require_Command = __commonJS({
50006
50006
  /**
50007
50007
  * Convert the value from buffer to the target encoding.
50008
50008
  */
50009
- _convertValue(resolve12) {
50009
+ _convertValue(resolve13) {
50010
50010
  return (value) => {
50011
50011
  try {
50012
50012
  this._clearTimers();
50013
- resolve12(this.transformReply(value));
50013
+ resolve13(this.transformReply(value));
50014
50014
  this.isResolved = true;
50015
50015
  } catch (err2) {
50016
50016
  this.reject(err2);
@@ -50306,13 +50306,13 @@ var require_autoPipelining = __commonJS({
50306
50306
  if (client.isCluster && !client.slots.length) {
50307
50307
  if (client.status === "wait")
50308
50308
  client.connect().catch(lodash_1.noop);
50309
- return (0, standard_as_callback_1.default)(new Promise(function(resolve12, reject) {
50309
+ return (0, standard_as_callback_1.default)(new Promise(function(resolve13, reject) {
50310
50310
  client.delayUntilReady((err2) => {
50311
50311
  if (err2) {
50312
50312
  reject(err2);
50313
50313
  return;
50314
50314
  }
50315
- executeWithAutoPipelining(client, functionName, commandName, args2, null).then(resolve12, reject);
50315
+ executeWithAutoPipelining(client, functionName, commandName, args2, null).then(resolve13, reject);
50316
50316
  });
50317
50317
  }), callback);
50318
50318
  }
@@ -50333,13 +50333,13 @@ var require_autoPipelining = __commonJS({
50333
50333
  pipeline[exports2.kExec] = true;
50334
50334
  setImmediate(executeAutoPipeline, client, slotKey);
50335
50335
  }
50336
- const autoPipelinePromise = new Promise(function(resolve12, reject) {
50336
+ const autoPipelinePromise = new Promise(function(resolve13, reject) {
50337
50337
  pipeline[exports2.kCallbacks].push(function(err2, value) {
50338
50338
  if (err2) {
50339
50339
  reject(err2);
50340
50340
  return;
50341
50341
  }
50342
- resolve12(value);
50342
+ resolve13(value);
50343
50343
  });
50344
50344
  if (functionName === "call") {
50345
50345
  args2.unshift(commandName);
@@ -50581,8 +50581,8 @@ var require_Pipeline = __commonJS({
50581
50581
  this[name2] = redis[name2];
50582
50582
  this[name2 + "Buffer"] = redis[name2 + "Buffer"];
50583
50583
  });
50584
- this.promise = new Promise((resolve12, reject) => {
50585
- this.resolve = resolve12;
50584
+ this.promise = new Promise((resolve13, reject) => {
50585
+ this.resolve = resolve13;
50586
50586
  this.reject = reject;
50587
50587
  });
50588
50588
  const _this = this;
@@ -50976,13 +50976,13 @@ var require_transaction = __commonJS({
50976
50976
  if (this.isCluster && !this.redis.slots.length) {
50977
50977
  if (this.redis.status === "wait")
50978
50978
  this.redis.connect().catch(utils_1.noop);
50979
- return (0, standard_as_callback_1.default)(new Promise((resolve12, reject) => {
50979
+ return (0, standard_as_callback_1.default)(new Promise((resolve13, reject) => {
50980
50980
  this.redis.delayUntilReady((err2) => {
50981
50981
  if (err2) {
50982
50982
  reject(err2);
50983
50983
  return;
50984
50984
  }
50985
- this.exec(pipeline).then(resolve12, reject);
50985
+ this.exec(pipeline).then(resolve13, reject);
50986
50986
  });
50987
50987
  }), callback);
50988
50988
  }
@@ -52452,7 +52452,7 @@ var require_cluster = __commonJS({
52452
52452
  * Connect to a cluster
52453
52453
  */
52454
52454
  connect() {
52455
- return new Promise((resolve12, reject) => {
52455
+ return new Promise((resolve13, reject) => {
52456
52456
  if (this.status === "connecting" || this.status === "connect" || this.status === "ready") {
52457
52457
  reject(new Error("Redis is already connecting/connected"));
52458
52458
  return;
@@ -52481,7 +52481,7 @@ var require_cluster = __commonJS({
52481
52481
  this.retryAttempts = 0;
52482
52482
  this.executeOfflineCommands();
52483
52483
  this.resetNodesRefreshInterval();
52484
- resolve12();
52484
+ resolve13();
52485
52485
  };
52486
52486
  let closeListener = void 0;
52487
52487
  const refreshListener = () => {
@@ -53097,7 +53097,7 @@ var require_cluster = __commonJS({
53097
53097
  });
53098
53098
  }
53099
53099
  resolveSrv(hostname2) {
53100
- return new Promise((resolve12, reject) => {
53100
+ return new Promise((resolve13, reject) => {
53101
53101
  this.options.resolveSrv(hostname2, (err2, records) => {
53102
53102
  if (err2) {
53103
53103
  return reject(err2);
@@ -53111,7 +53111,7 @@ var require_cluster = __commonJS({
53111
53111
  if (!group.records.length) {
53112
53112
  sortedKeys.shift();
53113
53113
  }
53114
- self2.dnsLookup(record2.name).then((host) => resolve12({
53114
+ self2.dnsLookup(record2.name).then((host) => resolve13({
53115
53115
  host,
53116
53116
  port: record2.port
53117
53117
  }), tryFirstOne);
@@ -53121,14 +53121,14 @@ var require_cluster = __commonJS({
53121
53121
  });
53122
53122
  }
53123
53123
  dnsLookup(hostname2) {
53124
- return new Promise((resolve12, reject) => {
53124
+ return new Promise((resolve13, reject) => {
53125
53125
  this.options.dnsLookup(hostname2, (err2, address) => {
53126
53126
  if (err2) {
53127
53127
  debug("failed to resolve hostname %s to IP: %s", hostname2, err2.message);
53128
53128
  reject(err2);
53129
53129
  } else {
53130
53130
  debug("resolved hostname %s to IP %s", hostname2, address);
53131
- resolve12(address);
53131
+ resolve13(address);
53132
53132
  }
53133
53133
  });
53134
53134
  });
@@ -53287,7 +53287,7 @@ var require_StandaloneConnector = __commonJS({
53287
53287
  if (options.tls) {
53288
53288
  Object.assign(connectionOptions, options.tls);
53289
53289
  }
53290
- return new Promise((resolve12, reject) => {
53290
+ return new Promise((resolve13, reject) => {
53291
53291
  process.nextTick(() => {
53292
53292
  if (!this.connecting) {
53293
53293
  reject(new Error(utils_1.CONNECTION_CLOSED_ERROR_MSG));
@@ -53306,7 +53306,7 @@ var require_StandaloneConnector = __commonJS({
53306
53306
  this.stream.once("error", (err2) => {
53307
53307
  this.firstError = err2;
53308
53308
  });
53309
- resolve12(this.stream);
53309
+ resolve13(this.stream);
53310
53310
  });
53311
53311
  });
53312
53312
  }
@@ -53468,7 +53468,7 @@ var require_SentinelConnector = __commonJS({
53468
53468
  const error3 = new Error(errorMsg);
53469
53469
  if (typeof retryDelay === "number") {
53470
53470
  eventEmitter("error", error3);
53471
- await new Promise((resolve12) => setTimeout(resolve12, retryDelay));
53471
+ await new Promise((resolve13) => setTimeout(resolve13, retryDelay));
53472
53472
  return connectToNext();
53473
53473
  } else {
53474
53474
  throw error3;
@@ -54817,7 +54817,7 @@ var require_Redis = __commonJS({
54817
54817
  return (0, standard_as_callback_1.default)(promise, callback);
54818
54818
  }
54819
54819
  _connect() {
54820
- return new Promise((resolve12, reject) => {
54820
+ return new Promise((resolve13, reject) => {
54821
54821
  if (this.status === "connecting" || this.status === "connect" || this.status === "ready") {
54822
54822
  reject(new Error("Redis is already connecting/connected"));
54823
54823
  return;
@@ -54896,7 +54896,7 @@ var require_Redis = __commonJS({
54896
54896
  }
54897
54897
  const connectionReadyHandler = function() {
54898
54898
  _this.removeListener("close", connectionCloseHandler);
54899
- resolve12();
54899
+ resolve13();
54900
54900
  };
54901
54901
  var connectionCloseHandler = function() {
54902
54902
  _this.removeListener("ready", connectionReadyHandler);
@@ -54989,10 +54989,10 @@ var require_Redis = __commonJS({
54989
54989
  monitor: true,
54990
54990
  lazyConnect: false
54991
54991
  });
54992
- return (0, standard_as_callback_1.default)(new Promise(function(resolve12, reject) {
54992
+ return (0, standard_as_callback_1.default)(new Promise(function(resolve13, reject) {
54993
54993
  monitorInstance.once("error", reject);
54994
54994
  monitorInstance.once("monitoring", function() {
54995
- resolve12(monitorInstance);
54995
+ resolve13(monitorInstance);
54996
54996
  });
54997
54997
  }), callback);
54998
54998
  }
@@ -61898,7 +61898,7 @@ var require_compile = __commonJS({
61898
61898
  const schOrFunc = root.refs[ref];
61899
61899
  if (schOrFunc)
61900
61900
  return schOrFunc;
61901
- let _sch = resolve12.call(this, root, ref);
61901
+ let _sch = resolve13.call(this, root, ref);
61902
61902
  if (_sch === void 0) {
61903
61903
  const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref];
61904
61904
  const { schemaId } = this.opts;
@@ -61925,7 +61925,7 @@ var require_compile = __commonJS({
61925
61925
  function sameSchemaEnv(s1, s22) {
61926
61926
  return s1.schema === s22.schema && s1.root === s22.root && s1.baseId === s22.baseId;
61927
61927
  }
61928
- function resolve12(root, ref) {
61928
+ function resolve13(root, ref) {
61929
61929
  let sch;
61930
61930
  while (typeof (sch = this.refs[ref]) == "string")
61931
61931
  ref = sch;
@@ -62559,7 +62559,7 @@ var require_fast_uri = __commonJS({
62559
62559
  }
62560
62560
  return uri;
62561
62561
  }
62562
- function resolve12(baseURI, relativeURI, options) {
62562
+ function resolve13(baseURI, relativeURI, options) {
62563
62563
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
62564
62564
  const resolved = resolveComponent(parse4(baseURI, schemelessOptions), parse4(relativeURI, schemelessOptions), schemelessOptions, true);
62565
62565
  schemelessOptions.skipEscape = true;
@@ -62817,7 +62817,7 @@ var require_fast_uri = __commonJS({
62817
62817
  var fastUri = {
62818
62818
  SCHEMES,
62819
62819
  normalize,
62820
- resolve: resolve12,
62820
+ resolve: resolve13,
62821
62821
  resolveComponent,
62822
62822
  equal,
62823
62823
  serialize,
@@ -65880,8 +65880,8 @@ init_cjs_shims();
65880
65880
 
65881
65881
  // ../../packages/core/src/version.ts
65882
65882
  init_cjs_shims();
65883
- var HORUS_VERSION = true ? "0.11.0" : "dev";
65884
- var PINNED_SOURCE_VERSION = "1.6.1";
65883
+ var HORUS_VERSION = true ? "0.12.1" : "dev";
65884
+ var PINNED_SOURCE_VERSION = "2.0.0";
65885
65885
 
65886
65886
  // ../../packages/core/src/evidence.ts
65887
65887
  init_cjs_shims();
@@ -70876,7 +70876,7 @@ var SourceHttpClient = class {
70876
70876
  this.maxRetries = opts.maxRetries ?? 2;
70877
70877
  }
70878
70878
  sleep(ms) {
70879
- return new Promise((resolve12) => setTimeout(resolve12, ms));
70879
+ return new Promise((resolve13) => setTimeout(resolve13, ms));
70880
70880
  }
70881
70881
  async request(method, path, body2) {
70882
70882
  const url = `${this.baseUrl}${path}`;
@@ -70989,8 +70989,72 @@ var SourceHttpClient = class {
70989
70989
  return this.request("POST", "/api/diff", { base: base2, compare });
70990
70990
  }
70991
70991
  async nodeCount() {
70992
- const result = await this.cypher("MATCH (n) RETURN count(n)");
70993
- return Number(result.rows[0]?.[0]) || 0;
70992
+ const o5 = await this.overview();
70993
+ return Number(o5.totalNodes) || 0;
70994
+ }
70995
+ // -------------------------------------------------------------------------
70996
+ // Typed read-path endpoints (HOR-392). These replace the CLI's raw Cypher:
70997
+ // the host owns the queries and returns shaped JSON, so the client never
70998
+ // emits or escapes Cypher on the read path.
70999
+ // -------------------------------------------------------------------------
71000
+ /** Nodes whose full content contains ANY of `tokens` — full (untruncated) content. */
71001
+ async contentSearch(tokens, limit = 500) {
71002
+ const res = await this.request("POST", "/api/content-search", {
71003
+ tokens,
71004
+ limit
71005
+ });
71006
+ return res.results ?? [];
71007
+ }
71008
+ /** Exact-name symbol lookup (file label excluded), with line ranges. */
71009
+ async exactSymbols(name2, limit = 10) {
71010
+ const res = await this.request(
71011
+ "GET",
71012
+ `/api/symbols/exact?name=${encodeURIComponent(name2)}&limit=${limit}`
71013
+ );
71014
+ return res.results ?? [];
71015
+ }
71016
+ /** Symbol nodes for the given comma-joinable lowercase labels (source-graph extraction). */
71017
+ async symbolsByLabel(labels, limit = 1e3) {
71018
+ const res = await this.request(
71019
+ "GET",
71020
+ `/api/symbols?labels=${encodeURIComponent(labels.join(","))}&limit=${limit}`
71021
+ );
71022
+ return res.symbols ?? [];
71023
+ }
71024
+ /** Batch-resolve node ids to their line ranges (CLI line hydration). */
71025
+ async nodesLines(ids2) {
71026
+ const res = await this.request(
71027
+ "POST",
71028
+ "/api/nodes/lines",
71029
+ { ids: ids2 }
71030
+ );
71031
+ return res.lines ?? {};
71032
+ }
71033
+ /** Process flows a symbol participates in, with each flow's named ordered steps. */
71034
+ flows(nodeId) {
71035
+ return this.request("GET", `/api/flows/${encodeURI(nodeId)}`);
71036
+ }
71037
+ /** Method symbols of `className` defined in `file`, ordered by start line. */
71038
+ async classMethods(file, className) {
71039
+ const res = await this.request(
71040
+ "GET",
71041
+ `/api/class-methods?file=${encodeURIComponent(file)}&class=${encodeURIComponent(className)}`
71042
+ );
71043
+ return res.methods ?? [];
71044
+ }
71045
+ /** Extended node detail — node + content + callers/callees/typeRefs + imports + coupling + communities. */
71046
+ node(nodeId) {
71047
+ return this.request("GET", `/api/node/${encodeURI(nodeId)}`);
71048
+ }
71049
+ /** Community clusters with their member nodes (source-graph extraction). */
71050
+ async communities() {
71051
+ const res = await this.request("GET", "/api/communities");
71052
+ return res.communities ?? [];
71053
+ }
71054
+ /** Discovered execution processes with their ordered steps (source-graph extraction). */
71055
+ async processes() {
71056
+ const res = await this.request("GET", "/api/processes");
71057
+ return res.processes ?? [];
70994
71058
  }
70995
71059
  // -------------------------------------------------------------------------
70996
71060
  // Memory vector bridge (M2). These reuse `request<T>` (retry/timeout/4xx) so
@@ -71134,10 +71198,10 @@ async function fetchHostRepoPath(hostUrl) {
71134
71198
  }
71135
71199
  async function findFreePort(start2 = 8420, end = 8520) {
71136
71200
  for (let port = start2; port <= end; port += 1) {
71137
- const free = await new Promise((resolve12) => {
71201
+ const free = await new Promise((resolve13) => {
71138
71202
  const srv = (0, import_node_net.createServer)();
71139
- srv.once("error", () => resolve12(false));
71140
- srv.once("listening", () => srv.close(() => resolve12(true)));
71203
+ srv.once("error", () => resolve13(false));
71204
+ srv.once("listening", () => srv.close(() => resolve13(true)));
71141
71205
  srv.listen(port, "127.0.0.1");
71142
71206
  });
71143
71207
  if (free) return port;
@@ -71271,13 +71335,6 @@ var SourceCodeProvider = class {
71271
71335
  id = "source";
71272
71336
  kind = "code";
71273
71337
  // --- helpers -------------------------------------------------------------
71274
- /**
71275
- * Escape a node id for inlining inside a double-quoted Cypher string literal:
71276
- * first double every backslash, then escape every double-quote.
71277
- */
71278
- escapeId(id) {
71279
- return id.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
71280
- }
71281
71338
  nodeToSymbol(n4) {
71282
71339
  return {
71283
71340
  id: n4.id,
@@ -71290,29 +71347,34 @@ var SourceCodeProvider = class {
71290
71347
  className: n4.className
71291
71348
  };
71292
71349
  }
71293
- async rows(query) {
71350
+ /** Map a serialized graph node to a `Symbol`, coercing the host's `0` line sentinel to undefined. */
71351
+ serializedToSymbol(n4) {
71352
+ const sym = {
71353
+ id: n4.id ?? "",
71354
+ name: n4.name ?? "",
71355
+ filePath: n4.filePath ?? ""
71356
+ };
71357
+ if (typeof n4.startLine === "number" && n4.startLine > 0) sym.startLine = n4.startLine;
71358
+ if (typeof n4.endLine === "number" && n4.endLine > 0) sym.endLine = n4.endLine;
71359
+ if (n4.className) sym.className = n4.className;
71360
+ if (n4.signature) sym.signature = n4.signature;
71361
+ if (n4.language) sym.language = n4.language;
71362
+ return sym;
71363
+ }
71364
+ /**
71365
+ * Graceful degradation (HOR-353): a 4xx for THIS repo's graph shape must not abort the
71366
+ * whole investigation. The caller passes a default the slice degrades to.
71367
+ */
71368
+ async degrade(p5, fallback) {
71294
71369
  try {
71295
- return (await this.client.cypher(query)).rows;
71370
+ return await p5;
71296
71371
  } catch (err2) {
71297
71372
  if (err2 instanceof SourceHttpError && err2.status >= 400 && err2.status < 500) {
71298
- return [];
71373
+ return fallback;
71299
71374
  }
71300
71375
  throw err2;
71301
71376
  }
71302
71377
  }
71303
- cypherRowToSymbol(row, idIdx, nameIdx, fileIdx, lineIdx, classNameIdx) {
71304
- const startLine = lineIdx != null && row[lineIdx] != null ? Number(row[lineIdx]) : void 0;
71305
- const sym = {
71306
- id: String(row[idIdx] ?? ""),
71307
- name: String(row[nameIdx] ?? ""),
71308
- filePath: String(row[fileIdx] ?? ""),
71309
- startLine
71310
- };
71311
- if (classNameIdx != null && row[classNameIdx] != null) {
71312
- sym.className = String(row[classNameIdx]);
71313
- }
71314
- return sym;
71315
- }
71316
71378
  // --- contract ------------------------------------------------------------
71317
71379
  async health() {
71318
71380
  const h3 = await this.client.health();
@@ -71322,19 +71384,22 @@ var SourceCodeProvider = class {
71322
71384
  };
71323
71385
  }
71324
71386
  async searchSymbols(query, limit = 10) {
71325
- const E2 = this.escapeId(query);
71326
- const exactQuery = `MATCH (n) WHERE toLower(n.name) = toLower("${E2}") AND label(n) <> "File" RETURN n.id, n.name, n.file_path LIMIT ${limit}`;
71327
- const [exactRows, semanticRes] = await Promise.all([
71328
- this.rows(exactQuery).catch(() => []),
71387
+ const [exactHits, semanticRes] = await Promise.all([
71388
+ this.degrade(this.client.exactSymbols(query, limit), []),
71329
71389
  this.client.search(query, limit)
71330
71390
  ]);
71331
- const exactSymbols = exactRows.map((row) => ({
71332
- id: String(row[0] ?? ""),
71333
- name: String(row[1] ?? ""),
71334
- filePath: String(row[2] ?? ""),
71335
- score: 1
71336
- // an exact-name Cypher hit is authoritative
71337
- }));
71391
+ const exactSymbols = exactHits.map((h3) => {
71392
+ const sym = {
71393
+ id: h3.nodeId,
71394
+ name: h3.name,
71395
+ filePath: h3.filePath,
71396
+ score: 1
71397
+ // an exact-name hit is authoritative
71398
+ };
71399
+ if (h3.startLine > 0) sym.startLine = h3.startLine;
71400
+ if (h3.endLine > 0) sym.endLine = h3.endLine;
71401
+ return sym;
71402
+ });
71338
71403
  const exactIds = new Set(exactSymbols.map((s5) => s5.id));
71339
71404
  const ql = query.toLowerCase();
71340
71405
  const semantic = semanticRes.filter((r) => !exactIds.has(r.nodeId)).map((r) => {
@@ -71356,78 +71421,54 @@ var SourceCodeProvider = class {
71356
71421
  async hydrateLines(symbols) {
71357
71422
  const ids2 = symbols.map((s5) => s5.id).filter(Boolean);
71358
71423
  if (ids2.length === 0) return symbols;
71359
- const idList = ids2.map((id) => `"${this.escapeId(id)}"`).join(", ");
71360
- const rows = await this.rows(`MATCH (n) WHERE n.id IN [${idList}] RETURN n.id, n.start_line, n.end_line`).catch(() => []);
71361
- const lineById = /* @__PURE__ */ new Map();
71362
- for (const row of rows) {
71363
- const id = String(row[0] ?? "");
71364
- const start2 = row[1] != null ? Number(row[1]) : void 0;
71365
- const end = row[2] != null ? Number(row[2]) : void 0;
71366
- lineById.set(id, { start: start2, end });
71367
- }
71424
+ const lines = await this.degrade(this.client.nodesLines(ids2), {});
71368
71425
  return symbols.map((s5) => {
71369
- const l2 = lineById.get(s5.id);
71426
+ const l2 = lines[s5.id];
71370
71427
  if (l2 === void 0) return s5;
71371
71428
  const out2 = { ...s5 };
71372
- if (l2.start !== void 0 && Number.isFinite(l2.start)) out2.startLine = l2.start;
71373
- if (l2.end !== void 0 && Number.isFinite(l2.end)) out2.endLine = l2.end;
71429
+ if (typeof l2.startLine === "number" && l2.startLine > 0) out2.startLine = l2.startLine;
71430
+ if (typeof l2.endLine === "number" && l2.endLine > 0) out2.endLine = l2.endLine;
71374
71431
  return out2;
71375
71432
  });
71376
71433
  }
71377
71434
  async context(symbolId) {
71378
- const E2 = this.escapeId(symbolId);
71379
- const nodeQuery = `MATCH (n) WHERE n.id = "${E2}" RETURN n.id, n.name, n.file_path, n.start_line, n.end_line, n.signature, n.class_name, n.language, n.is_dead, n.content LIMIT 1`;
71380
- const calleesQuery = `MATCH (n)-[r:CodeRelation]->(m) WHERE n.id = "${E2}" AND r.rel_type = "calls" RETURN m.id, m.name, m.file_path, m.start_line, m.class_name`;
71381
- const callersQuery = `MATCH (m)-[r:CodeRelation]->(n) WHERE n.id = "${E2}" AND r.rel_type = "calls" RETURN m.id, m.name, m.file_path, m.start_line, m.class_name`;
71382
- const usesTypeQuery = `MATCH (n)-[r:CodeRelation]->(t) WHERE n.id = "${E2}" AND r.rel_type = "uses_type" RETURN t.id, t.name, t.file_path, t.start_line`;
71383
- const communityQuery = `MATCH (n)-[r:CodeRelation]->(c:Community) WHERE n.id = "${E2}" AND r.rel_type = "member_of" RETURN c.id, c.name LIMIT 1`;
71384
- const fileQuery = `MATCH (f:File)-[r:CodeRelation]->(n) WHERE n.id = "${E2}" AND r.rel_type = "defines" RETURN f.id, f.file_path LIMIT 1`;
71385
- const [nodeRows, calleeRows, callerRows, usesTypeRows, communityRows, fileRows] = await Promise.all([
71386
- this.rows(nodeQuery),
71387
- this.rows(calleesQuery),
71388
- this.rows(callersQuery),
71389
- this.rows(usesTypeQuery),
71390
- this.rows(communityQuery),
71391
- this.rows(fileQuery)
71392
- ]);
71393
- const node = nodeRows[0];
71435
+ const detail = await this.degrade(this.client.node(symbolId), null);
71436
+ if (detail === null) {
71437
+ return {
71438
+ symbol: { id: symbolId, name: "", filePath: "" },
71439
+ callers: [],
71440
+ callees: [],
71441
+ imports: [],
71442
+ usesType: [],
71443
+ community: null,
71444
+ coupledWith: [],
71445
+ isDead: false
71446
+ };
71447
+ }
71448
+ const n4 = detail.node;
71394
71449
  const symbol = {
71395
- id: String(node?.[0] ?? symbolId),
71396
- name: String(node?.[1] ?? ""),
71397
- filePath: String(node?.[2] ?? ""),
71398
- startLine: node?.[3] != null ? Number(node[3]) : void 0,
71399
- endLine: node?.[4] != null ? Number(node[4]) : void 0,
71400
- signature: node?.[5] != null ? String(node[5]) : void 0,
71401
- className: node?.[6] != null ? String(node[6]) : void 0,
71402
- language: node?.[7] != null ? String(node[7]) : void 0
71403
- };
71404
- const isDead = Boolean(node?.[8]);
71405
- const content = node?.[9];
71450
+ id: n4.id ?? symbolId,
71451
+ name: n4.name ?? "",
71452
+ filePath: n4.filePath ?? ""
71453
+ };
71454
+ if (typeof n4.startLine === "number" && n4.startLine > 0) symbol.startLine = n4.startLine;
71455
+ if (typeof n4.endLine === "number" && n4.endLine > 0) symbol.endLine = n4.endLine;
71456
+ if (n4.signature) symbol.signature = n4.signature;
71457
+ if (n4.className) symbol.className = n4.className;
71458
+ if (n4.language) symbol.language = n4.language;
71459
+ const content = n4.content;
71406
71460
  const snippet = typeof content === "string" ? content.slice(0, 600) : void 0;
71407
71461
  const sourceBody = typeof content === "string" ? content.slice(0, 2e4) : void 0;
71408
- const callees = calleeRows.map((row) => this.cypherRowToSymbol(row, 0, 1, 2, 3, 4));
71409
- const callers = callerRows.map((row) => this.cypherRowToSymbol(row, 0, 1, 2, 3, 4));
71410
- const usesType = usesTypeRows.map((row) => this.cypherRowToSymbol(row, 0, 1, 2, 3));
71411
- const communityRow = communityRows[0];
71412
- const community = communityRow ? { id: String(communityRow[0] ?? ""), name: String(communityRow[1] ?? "") } : null;
71413
- let imports = [];
71414
- let coupledWith = [];
71415
- const fileRow = fileRows[0];
71416
- const fileId = fileRow?.[0];
71417
- if (fileId != null) {
71418
- const FE = this.escapeId(String(fileId));
71419
- const importsQuery = `MATCH (f)-[r:CodeRelation]->(g:File) WHERE f.id = "${FE}" AND r.rel_type = "imports" RETURN g.file_path`;
71420
- const coupledQuery = `MATCH (f)-[r:CodeRelation]->(g:File) WHERE f.id = "${FE}" AND r.rel_type = "coupled_with" RETURN g.file_path, r.co_changes`;
71421
- const [importRows, coupledRows] = await Promise.all([
71422
- this.rows(importsQuery),
71423
- this.rows(coupledQuery)
71424
- ]);
71425
- imports = importRows.map((row) => String(row[0] ?? ""));
71426
- coupledWith = coupledRows.map((row) => ({
71427
- file: String(row[0] ?? ""),
71428
- coChanges: Number(row[1] ?? 0)
71429
- }));
71430
- }
71462
+ const callees = (detail.callees ?? []).map((c4) => this.serializedToSymbol(c4.node));
71463
+ const callers = (detail.callers ?? []).map((c4) => this.serializedToSymbol(c4.node));
71464
+ const usesType = (detail.typeRefs ?? []).map((t2) => this.serializedToSymbol(t2));
71465
+ const communityRow = (detail.communities ?? [])[0];
71466
+ const community = communityRow ? { id: String(communityRow.id ?? ""), name: String(communityRow.name ?? "") } : null;
71467
+ const imports = (detail.imports ?? []).map((i3) => String(i3));
71468
+ const coupledWith = (detail.coupledWith ?? []).map((c4) => ({
71469
+ file: String(c4.file ?? ""),
71470
+ coChanges: Number(c4.coChanges ?? 0)
71471
+ }));
71431
71472
  return {
71432
71473
  symbol,
71433
71474
  snippet,
@@ -71438,7 +71479,7 @@ var SourceCodeProvider = class {
71438
71479
  usesType,
71439
71480
  community,
71440
71481
  coupledWith,
71441
- isDead
71482
+ isDead: Boolean(n4.isDead)
71442
71483
  };
71443
71484
  }
71444
71485
  async impact(symbolId, depth = 3) {
@@ -71453,21 +71494,22 @@ var SourceCodeProvider = class {
71453
71494
  };
71454
71495
  }
71455
71496
  async flowsFor(symbolId) {
71456
- const E2 = this.escapeId(symbolId);
71457
- const procQuery = `MATCH (s)-[r:CodeRelation]->(p:Process) WHERE s.id = "${E2}" AND r.rel_type = "step_in_process" RETURN p.id, p.name`;
71458
- const procRows = await this.rows(procQuery);
71459
- const flows = await Promise.all(
71460
- procRows.map(async (proc) => {
71461
- const pid = proc[0];
71462
- const pname = proc[1];
71463
- const PE = this.escapeId(String(pid ?? ""));
71464
- const stepQuery = `MATCH (s)-[r:CodeRelation]->(p:Process) WHERE p.id = "${PE}" AND r.rel_type = "step_in_process" RETURN s.id, s.name, s.file_path, s.start_line, r.step_number ORDER BY r.step_number`;
71465
- const stepRows = await this.rows(stepQuery);
71466
- const steps = stepRows.map((row) => this.cypherRowToSymbol(row, 0, 1, 2, 3));
71467
- return { id: String(pid ?? ""), name: String(pname ?? ""), steps };
71468
- })
71469
- );
71470
- return flows;
71497
+ const res = await this.degrade(this.client.flows(symbolId), { processes: [], steps: [] });
71498
+ const steps = (res.steps ?? []).map((s5) => {
71499
+ const sym = { id: s5.nodeId, name: s5.name, filePath: s5.filePath };
71500
+ if (typeof s5.startLine === "number" && s5.startLine > 0) sym.startLine = s5.startLine;
71501
+ return sym;
71502
+ });
71503
+ return (res.processes ?? []).map((p5) => ({
71504
+ id: String(p5.id ?? ""),
71505
+ name: String(p5.name ?? ""),
71506
+ steps
71507
+ }));
71508
+ }
71509
+ /** Method symbols of a class (typed /api/class-methods). Used for class-seed walkthroughs. */
71510
+ async classMethods(file, className) {
71511
+ const methods = await this.degrade(this.client.classMethods(file, className), []);
71512
+ return methods.map((m5) => this.serializedToSymbol(m5)).filter((s5) => s5.id !== "" && s5.name !== "");
71471
71513
  }
71472
71514
  async detectChanges(diff) {
71473
71515
  const d3 = await this.client.diff(diff.base, diff.compare);
@@ -82038,9 +82080,9 @@ var originError = /* @__PURE__ */ Symbol("OriginError");
82038
82080
  var CLOSE = {};
82039
82081
  var Query2 = class extends Promise {
82040
82082
  constructor(strings, args2, handler, canceller, options = {}) {
82041
- let resolve12, reject;
82083
+ let resolve13, reject;
82042
82084
  super((a2, b5) => {
82043
- resolve12 = a2;
82085
+ resolve13 = a2;
82044
82086
  reject = b5;
82045
82087
  });
82046
82088
  this.tagged = Array.isArray(strings.raw);
@@ -82051,7 +82093,7 @@ var Query2 = class extends Promise {
82051
82093
  this.options = options;
82052
82094
  this.state = null;
82053
82095
  this.statement = null;
82054
- this.resolve = (x4) => (this.active = false, resolve12(x4));
82096
+ this.resolve = (x4) => (this.active = false, resolve13(x4));
82055
82097
  this.reject = (x4) => (this.active = false, reject(x4));
82056
82098
  this.active = false;
82057
82099
  this.cancelled = null;
@@ -82099,12 +82141,12 @@ var Query2 = class extends Promise {
82099
82141
  if (this.executed && !this.active)
82100
82142
  return { done: true };
82101
82143
  prev && prev();
82102
- const promise = new Promise((resolve12, reject) => {
82144
+ const promise = new Promise((resolve13, reject) => {
82103
82145
  this.cursorFn = (value) => {
82104
- resolve12({ value, done: false });
82146
+ resolve13({ value, done: false });
82105
82147
  return new Promise((r) => prev = r);
82106
82148
  };
82107
- this.resolve = () => (this.active = false, resolve12({ done: true }));
82149
+ this.resolve = () => (this.active = false, resolve13({ done: true }));
82108
82150
  this.reject = (x4) => (this.active = false, reject(x4));
82109
82151
  });
82110
82152
  this.execute();
@@ -82736,12 +82778,12 @@ function Connection2(options, queues = {}, { onopen = noop, onend = noop, onclos
82736
82778
  x4.on("drain", drain);
82737
82779
  return x4;
82738
82780
  }
82739
- async function cancel({ pid, secret }, resolve12, reject) {
82781
+ async function cancel({ pid, secret }, resolve13, reject) {
82740
82782
  try {
82741
82783
  cancelMessage = bytes_default().i32(16).i32(80877102).i32(pid).i32(secret).end(16);
82742
82784
  await connect();
82743
82785
  socket.once("error", reject);
82744
- socket.once("close", resolve12);
82786
+ socket.once("close", resolve13);
82745
82787
  } catch (error4) {
82746
82788
  reject(error4);
82747
82789
  }
@@ -83690,7 +83732,7 @@ function parseEvent(x4) {
83690
83732
  init_cjs_shims();
83691
83733
  var import_stream2 = __toESM(require("stream"), 1);
83692
83734
  function largeObject(sql2, oid, mode = 131072 | 262144) {
83693
- return new Promise(async (resolve12, reject) => {
83735
+ return new Promise(async (resolve13, reject) => {
83694
83736
  await sql2.begin(async (sql3) => {
83695
83737
  let finish;
83696
83738
  !oid && ([{ oid }] = await sql3`select lo_creat(-1) as oid`);
@@ -83716,7 +83758,7 @@ function largeObject(sql2, oid, mode = 131072 | 262144) {
83716
83758
  ) seek
83717
83759
  `
83718
83760
  };
83719
- resolve12(lo);
83761
+ resolve13(lo);
83720
83762
  return new Promise(async (r) => finish = r);
83721
83763
  async function readable({
83722
83764
  highWaterMark = 2048 * 8,
@@ -83890,8 +83932,8 @@ function Postgres(a2, b5) {
83890
83932
  }
83891
83933
  async function reserve() {
83892
83934
  const queue = queue_default();
83893
- const c4 = open.length ? open.shift() : await new Promise((resolve12, reject) => {
83894
- const query = { reserve: resolve12, reject };
83935
+ const c4 = open.length ? open.shift() : await new Promise((resolve13, reject) => {
83936
+ const query = { reserve: resolve13, reject };
83895
83937
  queries.push(query);
83896
83938
  closed.length && connect(closed.shift(), query);
83897
83939
  });
@@ -83928,9 +83970,9 @@ function Postgres(a2, b5) {
83928
83970
  let uncaughtError, result;
83929
83971
  name2 && await sql3`savepoint ${sql3(name2)}`;
83930
83972
  try {
83931
- result = await new Promise((resolve12, reject) => {
83973
+ result = await new Promise((resolve13, reject) => {
83932
83974
  const x4 = fn3(sql3);
83933
- Promise.resolve(Array.isArray(x4) ? Promise.all(x4) : x4).then(resolve12, reject);
83975
+ Promise.resolve(Array.isArray(x4) ? Promise.all(x4) : x4).then(resolve13, reject);
83934
83976
  });
83935
83977
  if (uncaughtError)
83936
83978
  throw uncaughtError;
@@ -83987,8 +84029,8 @@ function Postgres(a2, b5) {
83987
84029
  return c4.execute(query) ? move(c4, busy) : move(c4, full);
83988
84030
  }
83989
84031
  function cancel(query) {
83990
- return new Promise((resolve12, reject) => {
83991
- query.state ? query.active ? connection_default(options).cancel(query.state, resolve12, reject) : query.cancelled = { resolve: resolve12, reject } : (queries.remove(query), query.cancelled = true, query.reject(Errors.generic("57014", "canceling statement due to user request")), resolve12());
84032
+ return new Promise((resolve13, reject) => {
84033
+ query.state ? query.active ? connection_default(options).cancel(query.state, resolve13, reject) : query.cancelled = { resolve: resolve13, reject } : (queries.remove(query), query.cancelled = true, query.reject(Errors.generic("57014", "canceling statement due to user request")), resolve13());
83992
84034
  });
83993
84035
  }
83994
84036
  async function end({ timeout = null } = {}) {
@@ -84007,11 +84049,11 @@ function Postgres(a2, b5) {
84007
84049
  async function close() {
84008
84050
  await Promise.all(connections.map((c4) => c4.end()));
84009
84051
  }
84010
- async function destroy(resolve12) {
84052
+ async function destroy(resolve13) {
84011
84053
  await Promise.all(connections.map((c4) => c4.terminate()));
84012
84054
  while (queries.length)
84013
84055
  queries.shift().reject(Errors.connection("CONNECTION_DESTROYED", options));
84014
- resolve12();
84056
+ resolve13();
84015
84057
  }
84016
84058
  function connect(c4, query) {
84017
84059
  move(c4, connecting);
@@ -94577,20 +94619,10 @@ function isClassSymbol(sym) {
94577
94619
  return sym !== void 0 && sym.id.split(":", 1)[0]?.toLowerCase() === "class";
94578
94620
  }
94579
94621
  async function fetchClassMethods(code, cls) {
94580
- const safe = (s5) => s5.replace(/["\\]/g, "");
94581
- const name2 = safe(cls.name);
94582
- if (!name2) return [];
94583
- const file = safe(cls.filePath);
94622
+ const name2 = cls.name?.trim();
94623
+ if (!name2 || typeof code.classMethods !== "function") return [];
94584
94624
  try {
94585
- const res = await code.cypher(
94586
- `MATCH (m:Method) WHERE m.class_name = "${name2}"` + (file ? ` AND m.file_path = "${file}"` : "") + " RETURN m.id, m.name, m.file_path, m.start_line ORDER BY m.start_line LIMIT 40"
94587
- );
94588
- return res.rows.map((r) => ({
94589
- id: String(r[0] ?? ""),
94590
- name: String(r[1] ?? ""),
94591
- filePath: String(r[2] ?? ""),
94592
- ...typeof r[3] === "number" ? { startLine: r[3] } : {}
94593
- })).filter((s5) => s5.id !== "" && s5.name !== "");
94625
+ return await code.classMethods(cls.filePath ?? "", name2);
94594
94626
  } catch {
94595
94627
  return [];
94596
94628
  }
@@ -101491,31 +101523,50 @@ function dedupeBySymbolFile(rows) {
101491
101523
  // ../../packages/stitcher/src/stitch.ts
101492
101524
  init_cjs_shims();
101493
101525
  async function stitch(client, db, opts = {}) {
101494
- const producerRows = (await client.cypher(
101526
+ const producerRows = await client.contentSearch([
101495
101527
  // "new Queue" (no paren) so generic-typed `new Queue<T>(...)` also matches.
101496
- 'MATCH (n) WHERE n.content CONTAINS "@InjectQueue(" OR n.content CONTAINS "new Queue" OR n.content CONTAINS "QUEUE_NAME" OR n.content CONTAINS "QueueName" OR n.content CONTAINS "enum " OR n.content CONTAINS "Object.values(" OR n.content CONTAINS "]: (" RETURN n.name, n.file_path, n.content'
101497
- )).rows;
101528
+ "@InjectQueue(",
101529
+ "new Queue",
101530
+ "QUEUE_NAME",
101531
+ "QueueName",
101532
+ "enum ",
101533
+ "Object.values(",
101534
+ // HOR-341: dispatch tables `[Enum.MEMBER]: () => this.ctrl.handler()` map runtime
101535
+ // queues to owning code, and often live in a file with NO new Queue/Worker of their
101536
+ // own (e.g. a scheduler controller) — so pull computed-key arrow entries too.
101537
+ "]: ("
101538
+ ]);
101498
101539
  const producerClasses = producerRows.map((r) => ({
101499
- name: String(r[0] ?? ""),
101500
- filePath: String(r[1] ?? ""),
101501
- content: String(r[2] ?? "")
101540
+ name: r.name,
101541
+ filePath: r.filePath,
101542
+ content: r.content
101502
101543
  }));
101503
- const workerRows = (await client.cypher(
101504
- // "new Worker" (no paren) so generic-typed `new Worker<T>(...)` also matches.
101505
- 'MATCH (n) WHERE n.content CONTAINS "@Processor(" OR n.content CONTAINS "new Worker" RETURN n.name, n.file_path, n.content'
101506
- )).rows;
101544
+ const workerRows = await client.contentSearch(["@Processor(", "new Worker"]);
101507
101545
  const workerFiles = workerRows.map((r) => ({
101508
- filePath: String(r[1] ?? ""),
101509
- content: String(r[2] ?? "")
101546
+ filePath: r.filePath,
101547
+ content: r.content
101510
101548
  }));
101511
101549
  const graph = extractQueueGraph({ producerClasses, workerFiles });
101512
- const celeryRows = (await client.cypher(
101513
- 'MATCH (n) WHERE n.content CONTAINS ".delay(" OR n.content CONTAINS ".apply_async(" OR n.content CONTAINS ".schedule(" OR n.content CONTAINS ".defer(" OR n.content CONTAINS ".defer_async(" OR n.content CONTAINS ".send(" OR n.content CONTAINS ".enqueue_job(" OR n.content CONTAINS ".enqueue(" OR n.content CONTAINS "@shared_task" OR n.content CONTAINS "@task" OR n.content CONTAINS ".task" OR n.content CONTAINS "@actor" OR n.content CONTAINS "periodic_task" OR n.content CONTAINS "db_task" RETURN n.name, n.file_path, n.content'
101514
- )).rows;
101550
+ const celeryRows = await client.contentSearch([
101551
+ ".delay(",
101552
+ ".apply_async(",
101553
+ ".schedule(",
101554
+ ".defer(",
101555
+ ".defer_async(",
101556
+ ".send(",
101557
+ ".enqueue_job(",
101558
+ ".enqueue(",
101559
+ "@shared_task",
101560
+ "@task",
101561
+ ".task",
101562
+ "@actor",
101563
+ "periodic_task",
101564
+ "db_task"
101565
+ ]);
101515
101566
  const celeryNodes = celeryRows.map((r) => ({
101516
- name: String(r[0] ?? ""),
101517
- filePath: String(r[1] ?? ""),
101518
- content: String(r[2] ?? "")
101567
+ name: r.name,
101568
+ filePath: r.filePath,
101569
+ content: r.content
101519
101570
  }));
101520
101571
  const celery = extractCeleryQueueGraph(celeryNodes);
101521
101572
  const dramatiq = extractDramatiqQueueGraph(celeryNodes);
@@ -101667,6 +101718,10 @@ async function stitchQueueMap(hostUrl, dbUrl, label) {
101667
101718
  console.log(
101668
101719
  import_picocolors6.default.dim(`[${label}] `) + `Stitched ${summary.edges} queue edge(s) across ${summary.queues} queue(s) \u2014 ${summary.producers} producer(s), ${summary.workers} worker(s).`
101669
101720
  );
101721
+ } catch (err2) {
101722
+ console.log(
101723
+ import_picocolors6.default.dim(`[${label}] `) + `Queue map skipped (degraded): ${err2.message}. Stitched 0 queue edge(s).`
101724
+ );
101670
101725
  } finally {
101671
101726
  await sql2.end();
101672
101727
  }
@@ -101692,60 +101747,49 @@ function findConfiguredRepo(config2, root) {
101692
101747
  return null;
101693
101748
  }
101694
101749
  var SOURCE_GRAPH_PULL_LIMIT = 5e3;
101750
+ var SOURCE_SYMBOL_LABELS = [
101751
+ "class",
101752
+ "interface",
101753
+ "type_alias",
101754
+ "function",
101755
+ "method",
101756
+ "enum"
101757
+ ];
101695
101758
  async function extractSourceGraph(hostUrl, repo) {
101696
101759
  const client = new SourceHttpClient({ baseUrl: hostUrl });
101697
101760
  const N2 = SOURCE_GRAPH_PULL_LIMIT;
101698
- const rows = async (query) => {
101699
- try {
101700
- return (await client.cypher(query)).rows;
101701
- } catch {
101702
- return [];
101703
- }
101704
- };
101705
- const symbolRows = await rows(
101706
- `MATCH (n) WHERE label(n) IN ["Class","Interface","TypeAlias","Function","Method","Enum"] RETURN label(n), n.name, n.file_path, n.start_line, n.end_line, n.class_name, n.is_entry_point, n.is_exported, n.signature LIMIT ${N2 * 2}`
101707
- );
101761
+ const symbolRows = await client.symbolsByLabel(SOURCE_SYMBOL_LABELS, N2 * 2).catch(() => []);
101708
101762
  const symbols = symbolRows.map((r) => ({
101709
- label: String(r[0] ?? ""),
101710
- name: String(r[1] ?? ""),
101711
- filePath: r[2] != null ? String(r[2]) : void 0,
101712
- startLine: r[3] != null ? Number(r[3]) : void 0,
101713
- endLine: r[4] != null ? Number(r[4]) : void 0,
101714
- className: r[5] != null ? String(r[5]) : void 0,
101715
- isEntryPoint: Boolean(r[6]),
101716
- isExported: Boolean(r[7]),
101717
- signature: r[8] != null ? String(r[8]) : void 0
101763
+ label: r.label,
101764
+ name: r.name,
101765
+ filePath: r.filePath || void 0,
101766
+ startLine: r.startLine > 0 ? r.startLine : void 0,
101767
+ endLine: r.endLine > 0 ? r.endLine : void 0,
101768
+ className: r.className || void 0,
101769
+ isEntryPoint: Boolean(r.isEntryPoint),
101770
+ isExported: Boolean(r.isExported),
101771
+ signature: r.signature || void 0
101718
101772
  }));
101719
- const communityRows = await rows(
101720
- `MATCH (n:Community) RETURN n.id, n.name LIMIT ${N2}`
101721
- );
101722
- const communities = communityRows.map((r) => ({
101723
- id: r[0] != null ? String(r[0]) : void 0,
101724
- name: String(r[1] ?? "")
101773
+ const nameById = /* @__PURE__ */ new Map();
101774
+ for (const r of symbolRows) {
101775
+ if (r.id) nameById.set(r.id, { name: r.name, filePath: r.filePath || void 0 });
101776
+ }
101777
+ const communityRows = await client.communities().catch(() => []);
101778
+ const communities = communityRows.map((c4) => ({
101779
+ id: c4.id ? String(c4.id) : void 0,
101780
+ name: String(c4.name ?? "")
101781
+ }));
101782
+ const processRows = await client.processes().catch(() => []);
101783
+ const processes = processRows.map((p5) => ({
101784
+ name: String(p5.name ?? ""),
101785
+ steps: (p5.steps ?? []).map((s5) => {
101786
+ const resolved = nameById.get(s5.nodeId);
101787
+ const component = resolved?.name ?? s5.nodeId;
101788
+ if (!component) return null;
101789
+ const detail = resolved?.filePath;
101790
+ return { component, ...detail ? { detail } : {} };
101791
+ }).filter((s5) => s5 !== null)
101725
101792
  }));
101726
- const processRows = await rows(`MATCH (n:Process) RETURN n.id, n.name LIMIT ${N2}`);
101727
- const stepRows = await rows(
101728
- `MATCH (s)-[r:CodeRelation]->(p:Process) WHERE r.rel_type = "step_in_process" RETURN p.id, s.name, s.file_path, r.step_number ORDER BY p.id, r.step_number LIMIT ${N2 * 4}`
101729
- );
101730
- const stepsByProcess = /* @__PURE__ */ new Map();
101731
- for (const r of stepRows) {
101732
- const pid = String(r[0] ?? "");
101733
- if (!pid) continue;
101734
- const component = String(r[1] ?? "");
101735
- if (!component) continue;
101736
- const file = r[2] != null ? String(r[2]) : void 0;
101737
- const list = stepsByProcess.get(pid) ?? [];
101738
- list.push({ component, ...file ? { detail: file } : {} });
101739
- stepsByProcess.set(pid, list);
101740
- }
101741
- const processes = processRows.map((r) => {
101742
- const id = r[0] != null ? String(r[0]) : void 0;
101743
- return {
101744
- id,
101745
- name: String(r[1] ?? ""),
101746
- steps: id ? stepsByProcess.get(id) ?? [] : []
101747
- };
101748
- });
101749
101793
  if (symbols.length === 0 && communities.length === 0 && processes.length === 0) {
101750
101794
  return null;
101751
101795
  }
@@ -101919,7 +101963,13 @@ async function runIndex(opts) {
101919
101963
  );
101920
101964
  return 1;
101921
101965
  }
101922
- await stitchQueueMap(hostUrl, dbUrl, label);
101966
+ try {
101967
+ await stitchQueueMap(hostUrl, dbUrl, label);
101968
+ } catch (err2) {
101969
+ console.log(
101970
+ import_picocolors6.default.dim(`[${label}] `) + `Queue map skipped (degraded): ${err2.message}. Stitched 0 queue edge(s).`
101971
+ );
101972
+ }
101923
101973
  await buildKnowledgeIndex(root, config2, label, configuredProject, opts, hostUrl);
101924
101974
  const hasLocalConfig = discoverLocalConfig(root) !== null;
101925
101975
  if (!isConfigured && !hasLocalConfig) {
@@ -110434,7 +110484,7 @@ var Protocol = class {
110434
110484
  return;
110435
110485
  }
110436
110486
  const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
110437
- await new Promise((resolve12) => setTimeout(resolve12, pollInterval));
110487
+ await new Promise((resolve13) => setTimeout(resolve13, pollInterval));
110438
110488
  options?.signal?.throwIfAborted();
110439
110489
  }
110440
110490
  } catch (error3) {
@@ -110451,7 +110501,7 @@ var Protocol = class {
110451
110501
  */
110452
110502
  request(request, resultSchema, options) {
110453
110503
  const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
110454
- return new Promise((resolve12, reject) => {
110504
+ return new Promise((resolve13, reject) => {
110455
110505
  const earlyReject = (error3) => {
110456
110506
  reject(error3);
110457
110507
  };
@@ -110529,7 +110579,7 @@ var Protocol = class {
110529
110579
  if (!parseResult.success) {
110530
110580
  reject(parseResult.error);
110531
110581
  } else {
110532
- resolve12(parseResult.data);
110582
+ resolve13(parseResult.data);
110533
110583
  }
110534
110584
  } catch (error3) {
110535
110585
  reject(error3);
@@ -110790,12 +110840,12 @@ var Protocol = class {
110790
110840
  }
110791
110841
  } catch {
110792
110842
  }
110793
- return new Promise((resolve12, reject) => {
110843
+ return new Promise((resolve13, reject) => {
110794
110844
  if (signal.aborted) {
110795
110845
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
110796
110846
  return;
110797
110847
  }
110798
- const timeoutId = setTimeout(resolve12, interval2);
110848
+ const timeoutId = setTimeout(resolve13, interval2);
110799
110849
  signal.addEventListener("abort", () => {
110800
110850
  clearTimeout(timeoutId);
110801
110851
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
@@ -111904,7 +111954,7 @@ var McpServer = class {
111904
111954
  let task = createTaskResult.task;
111905
111955
  const pollInterval = task.pollInterval ?? 5e3;
111906
111956
  while (task.status !== "completed" && task.status !== "failed" && task.status !== "cancelled") {
111907
- await new Promise((resolve12) => setTimeout(resolve12, pollInterval));
111957
+ await new Promise((resolve13) => setTimeout(resolve13, pollInterval));
111908
111958
  const updatedTask = await extra.taskStore.getTask(taskId);
111909
111959
  if (!updatedTask) {
111910
111960
  throw new McpError(ErrorCode.InternalError, `Task ${taskId} not found during polling`);
@@ -112555,12 +112605,12 @@ var StdioServerTransport = class {
112555
112605
  this.onclose?.();
112556
112606
  }
112557
112607
  send(message) {
112558
- return new Promise((resolve12) => {
112608
+ return new Promise((resolve13) => {
112559
112609
  const json2 = serializeMessage(message);
112560
112610
  if (this._stdout.write(json2)) {
112561
- resolve12();
112611
+ resolve13();
112562
112612
  } else {
112563
- this._stdout.once("drain", resolve12);
112613
+ this._stdout.once("drain", resolve13);
112564
112614
  }
112565
112615
  });
112566
112616
  }
@@ -115995,9 +116045,9 @@ async function runWatch(opts) {
115995
116045
  while (!stopping) {
115996
116046
  await pollOnce();
115997
116047
  if (stopping) break;
115998
- await new Promise((resolve12) => {
115999
- wake = resolve12;
116000
- const timer2 = setTimeout(resolve12, intervalSec * 1e3);
116048
+ await new Promise((resolve13) => {
116049
+ wake = resolve13;
116050
+ const timer2 = setTimeout(resolve13, intervalSec * 1e3);
116001
116051
  if (typeof timer2.unref === "function") timer2.unref();
116002
116052
  });
116003
116053
  wake = null;
@@ -119367,7 +119417,7 @@ async function checkboxSearch(opts) {
119367
119417
  if (choices.length === 0) {
119368
119418
  return [];
119369
119419
  }
119370
- return new Promise((resolve12, reject) => {
119420
+ return new Promise((resolve13, reject) => {
119371
119421
  let filter = "";
119372
119422
  const selected = /* @__PURE__ */ new Set();
119373
119423
  let cursor = 0;
@@ -119433,7 +119483,7 @@ async function checkboxSearch(opts) {
119433
119483
  output.write(`
119434
119484
  ? ${import_picocolors39.default.bold(message)} ${summary}
119435
119485
  `);
119436
- resolve12(values2);
119486
+ resolve13(values2);
119437
119487
  }
119438
119488
  function cancel() {
119439
119489
  cleanup();
@@ -119530,7 +119580,7 @@ async function selectSearch(opts) {
119530
119580
  if (choices.length === 0) {
119531
119581
  throw new ExitPromptError("No choices to select from");
119532
119582
  }
119533
- return new Promise((resolve12, reject) => {
119583
+ return new Promise((resolve13, reject) => {
119534
119584
  let filter = "";
119535
119585
  let cursor = 0;
119536
119586
  let filtered = choices;
@@ -119588,7 +119638,7 @@ async function selectSearch(opts) {
119588
119638
  output.write(`
119589
119639
  ? ${import_picocolors39.default.bold(message)} ${value}
119590
119640
  `);
119591
- resolve12(value);
119641
+ resolve13(value);
119592
119642
  }
119593
119643
  function cancel() {
119594
119644
  cleanup();
@@ -120031,7 +120081,7 @@ function missingRequired(type, opts) {
120031
120081
  }
120032
120082
  }
120033
120083
  function ask(label, placeholder = "", required2 = true) {
120034
- return new Promise((resolve12) => {
120084
+ return new Promise((resolve13) => {
120035
120085
  const hint = placeholder ? import_picocolors41.default.dim(` (${placeholder})`) : "";
120036
120086
  const suffix = required2 ? "" : import_picocolors41.default.dim(" [optional]");
120037
120087
  process.stdout.write(` ${label}${suffix}${hint}: `);
@@ -120042,12 +120092,12 @@ function ask(label, placeholder = "", required2 = true) {
120042
120092
  });
120043
120093
  rl.once("line", (line2) => {
120044
120094
  rl.close();
120045
- resolve12(line2.trim() || (required2 ? placeholder : ""));
120095
+ resolve13(line2.trim() || (required2 ? placeholder : ""));
120046
120096
  });
120047
120097
  });
120048
120098
  }
120049
120099
  function askPassword(label) {
120050
- return new Promise((resolve12) => {
120100
+ return new Promise((resolve13) => {
120051
120101
  const stdin = process.stdin;
120052
120102
  if (typeof stdin.setRawMode === "function") {
120053
120103
  process.stdout.write(` ${label}${import_picocolors41.default.dim(" [optional]")}: `);
@@ -120061,7 +120111,7 @@ function askPassword(label) {
120061
120111
  stdin.pause();
120062
120112
  stdin.removeListener("data", onData);
120063
120113
  process.stdout.write("\n");
120064
- resolve12(value);
120114
+ resolve13(value);
120065
120115
  } else if (char2 === "") {
120066
120116
  process.exit(1);
120067
120117
  } else if (char2 === "\x7F" || char2 === "\b") {
@@ -120076,7 +120126,7 @@ function askPassword(label) {
120076
120126
  };
120077
120127
  stdin.on("data", onData);
120078
120128
  } else {
120079
- resolve12(ask(label, "", false));
120129
+ resolve13(ask(label, "", false));
120080
120130
  }
120081
120131
  });
120082
120132
  }
@@ -120628,7 +120678,7 @@ async function stopHost(root, hostUrl) {
120628
120678
  await cleanupSpawnedRecord(root);
120629
120679
  return 0;
120630
120680
  }
120631
- if (!hostArgvRegex(port).test(info2.args)) {
120681
+ if (!isOwnHostProcess(spawned.pid, port, root, info2.args)) {
120632
120682
  console.error(
120633
120683
  import_picocolors42.default.red(
120634
120684
  `Pid ${spawned.pid} args do not match "horus-source host --port ${port}". Got: "${info2.args.slice(0, 120)}". Aborting for safety.`
@@ -120675,6 +120725,15 @@ function hostArgvRegex(port) {
120675
120725
  `(?:^|\\s)(?:\\S*/)?horus-source\\s+host\\s+--port(?:=|\\s+)${String(port)}(?=\\s|$)`
120676
120726
  );
120677
120727
  }
120728
+ function hostArgvAnyPortRegex() {
120729
+ return /(?:^|\s)(?:\S*\/)?horus-source\s+host\s+--port(?:=|\s+)\d+(?=\s|$)/;
120730
+ }
120731
+ function isOwnHostProcess(pid, port, root, args2) {
120732
+ if (hostArgvRegex(port).test(args2)) return true;
120733
+ if (!hostArgvAnyPortRegex().test(args2)) return false;
120734
+ const rec = readSourceHostPid(root);
120735
+ return rec !== null && rec.pid === pid && Number.isFinite(rec.port) && rec.port === port && !!rec.repoPath && (0, import_node_path22.resolve)(rec.repoPath) === (0, import_node_path22.resolve)(root);
120736
+ }
120678
120737
  async function cleanupSpawnedRecord(root) {
120679
120738
  try {
120680
120739
  await unlinkAsync((0, import_node_path22.join)(root, HORUS_DIR, SPAWNED_HOST_FILE2));
@@ -120688,7 +120747,7 @@ async function stopBackendServerPid(root, port) {
120688
120747
  if (rec.repoPath && rec.repoPath !== root) return "none";
120689
120748
  const info2 = await getProcessInfo(rec.pid);
120690
120749
  if (info2 === null) return "none";
120691
- if (!hostArgvRegex(port).test(info2.args)) {
120750
+ if (!isOwnHostProcess(rec.pid, port, root, info2.args)) {
120692
120751
  console.log(
120693
120752
  import_picocolors42.default.dim(
120694
120753
  `Host pid ${rec.pid} is now an unrelated process (stale source/host.json / PID reuse) \u2014 host already gone.`
@@ -122166,7 +122225,7 @@ async function runSkillPath(target, opts) {
122166
122225
  init_cjs_shims();
122167
122226
  var import_node_child_process12 = require("child_process");
122168
122227
  var import_picocolors49 = __toESM(require_picocolors(), 1);
122169
- var sleep2 = (ms) => new Promise((resolve12) => setTimeout(resolve12, ms));
122228
+ var sleep2 = (ms) => new Promise((resolve13) => setTimeout(resolve13, ms));
122170
122229
  function openBrowser(url) {
122171
122230
  const cmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open";
122172
122231
  const args2 = process.platform === "win32" ? ["/c", "start", "", url] : [url];