@mrrlin-dev/mcp 0.3.0 → 0.3.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.
package/dist/bin.cjs CHANGED
@@ -4273,7 +4273,7 @@ var require_websocket = __commonJS({
4273
4273
  var http2 = require("http");
4274
4274
  var net = require("net");
4275
4275
  var tls = require("tls");
4276
- var { randomBytes: randomBytes3, createHash } = require("crypto");
4276
+ var { randomBytes: randomBytes3, createHash: createHash2 } = require("crypto");
4277
4277
  var { Duplex, Readable } = require("stream");
4278
4278
  var { URL: URL2 } = require("url");
4279
4279
  var PerMessageDeflate2 = require_permessage_deflate();
@@ -4941,7 +4941,7 @@ var require_websocket = __commonJS({
4941
4941
  abortHandshake(websocket, socket, "Invalid Upgrade header");
4942
4942
  return;
4943
4943
  }
4944
- const digest = createHash("sha1").update(key + GUID).digest("base64");
4944
+ const digest = createHash2("sha1").update(key + GUID).digest("base64");
4945
4945
  if (res.headers["sec-websocket-accept"] !== digest) {
4946
4946
  abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
4947
4947
  return;
@@ -5310,7 +5310,7 @@ var require_websocket_server = __commonJS({
5310
5310
  var EventEmitter3 = require("events");
5311
5311
  var http2 = require("http");
5312
5312
  var { Duplex } = require("stream");
5313
- var { createHash } = require("crypto");
5313
+ var { createHash: createHash2 } = require("crypto");
5314
5314
  var extension2 = require_extension();
5315
5315
  var PerMessageDeflate2 = require_permessage_deflate();
5316
5316
  var subprotocol2 = require_subprotocol();
@@ -5617,7 +5617,7 @@ var require_websocket_server = __commonJS({
5617
5617
  );
5618
5618
  }
5619
5619
  if (this._state > RUNNING) return abortHandshake(socket, 503);
5620
- const digest = createHash("sha1").update(key + GUID).digest("base64");
5620
+ const digest = createHash2("sha1").update(key + GUID).digest("base64");
5621
5621
  const headers = [
5622
5622
  "HTTP/1.1 101 Switching Protocols",
5623
5623
  "Upgrade: websocket",
@@ -5704,13 +5704,1986 @@ var require_websocket_server = __commonJS({
5704
5704
  }
5705
5705
  });
5706
5706
 
5707
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/internal/constants.js
5708
+ var require_constants2 = __commonJS({
5709
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/internal/constants.js"(exports2, module2) {
5710
+ "use strict";
5711
+ var SEMVER_SPEC_VERSION = "2.0.0";
5712
+ var MAX_LENGTH = 256;
5713
+ var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
5714
+ 9007199254740991;
5715
+ var MAX_SAFE_COMPONENT_LENGTH = 16;
5716
+ var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
5717
+ var RELEASE_TYPES = [
5718
+ "major",
5719
+ "premajor",
5720
+ "minor",
5721
+ "preminor",
5722
+ "patch",
5723
+ "prepatch",
5724
+ "prerelease"
5725
+ ];
5726
+ module2.exports = {
5727
+ MAX_LENGTH,
5728
+ MAX_SAFE_COMPONENT_LENGTH,
5729
+ MAX_SAFE_BUILD_LENGTH,
5730
+ MAX_SAFE_INTEGER,
5731
+ RELEASE_TYPES,
5732
+ SEMVER_SPEC_VERSION,
5733
+ FLAG_INCLUDE_PRERELEASE: 1,
5734
+ FLAG_LOOSE: 2
5735
+ };
5736
+ }
5737
+ });
5738
+
5739
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/internal/debug.js
5740
+ var require_debug = __commonJS({
5741
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/internal/debug.js"(exports2, module2) {
5742
+ "use strict";
5743
+ var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
5744
+ };
5745
+ module2.exports = debug;
5746
+ }
5747
+ });
5748
+
5749
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/internal/re.js
5750
+ var require_re = __commonJS({
5751
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/internal/re.js"(exports2, module2) {
5752
+ "use strict";
5753
+ var {
5754
+ MAX_SAFE_COMPONENT_LENGTH,
5755
+ MAX_SAFE_BUILD_LENGTH,
5756
+ MAX_LENGTH
5757
+ } = require_constants2();
5758
+ var debug = require_debug();
5759
+ exports2 = module2.exports = {};
5760
+ var re = exports2.re = [];
5761
+ var safeRe = exports2.safeRe = [];
5762
+ var src = exports2.src = [];
5763
+ var safeSrc = exports2.safeSrc = [];
5764
+ var t = exports2.t = {};
5765
+ var R = 0;
5766
+ var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
5767
+ var safeRegexReplacements = [
5768
+ ["\\s", 1],
5769
+ ["\\d", MAX_LENGTH],
5770
+ [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
5771
+ ];
5772
+ var makeSafeRegex = (value) => {
5773
+ for (const [token, max] of safeRegexReplacements) {
5774
+ value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
5775
+ }
5776
+ return value;
5777
+ };
5778
+ var createToken = (name, value, isGlobal) => {
5779
+ const safe = makeSafeRegex(value);
5780
+ const index = R++;
5781
+ debug(name, index, value);
5782
+ t[name] = index;
5783
+ src[index] = value;
5784
+ safeSrc[index] = safe;
5785
+ re[index] = new RegExp(value, isGlobal ? "g" : void 0);
5786
+ safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
5787
+ };
5788
+ createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
5789
+ createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
5790
+ createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
5791
+ createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
5792
+ createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
5793
+ createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
5794
+ createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
5795
+ createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
5796
+ createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
5797
+ createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
5798
+ createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
5799
+ createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
5800
+ createToken("FULL", `^${src[t.FULLPLAIN]}$`);
5801
+ createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
5802
+ createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
5803
+ createToken("GTLT", "((?:<|>)?=?)");
5804
+ createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
5805
+ createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
5806
+ createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
5807
+ createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
5808
+ createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
5809
+ createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
5810
+ createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
5811
+ createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
5812
+ createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
5813
+ createToken("COERCERTL", src[t.COERCE], true);
5814
+ createToken("COERCERTLFULL", src[t.COERCEFULL], true);
5815
+ createToken("LONETILDE", "(?:~>?)");
5816
+ createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
5817
+ exports2.tildeTrimReplace = "$1~";
5818
+ createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
5819
+ createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
5820
+ createToken("LONECARET", "(?:\\^)");
5821
+ createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
5822
+ exports2.caretTrimReplace = "$1^";
5823
+ createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
5824
+ createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
5825
+ createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
5826
+ createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
5827
+ createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
5828
+ exports2.comparatorTrimReplace = "$1$2$3";
5829
+ createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
5830
+ createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
5831
+ createToken("STAR", "(<|>)?=?\\s*\\*");
5832
+ createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
5833
+ createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
5834
+ }
5835
+ });
5836
+
5837
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/internal/parse-options.js
5838
+ var require_parse_options = __commonJS({
5839
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/internal/parse-options.js"(exports2, module2) {
5840
+ "use strict";
5841
+ var looseOption = Object.freeze({ loose: true });
5842
+ var emptyOpts = Object.freeze({});
5843
+ var parseOptions = (options) => {
5844
+ if (!options) {
5845
+ return emptyOpts;
5846
+ }
5847
+ if (typeof options !== "object") {
5848
+ return looseOption;
5849
+ }
5850
+ return options;
5851
+ };
5852
+ module2.exports = parseOptions;
5853
+ }
5854
+ });
5855
+
5856
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/internal/identifiers.js
5857
+ var require_identifiers = __commonJS({
5858
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/internal/identifiers.js"(exports2, module2) {
5859
+ "use strict";
5860
+ var numeric = /^[0-9]+$/;
5861
+ var compareIdentifiers = (a, b) => {
5862
+ if (typeof a === "number" && typeof b === "number") {
5863
+ return a === b ? 0 : a < b ? -1 : 1;
5864
+ }
5865
+ const anum = numeric.test(a);
5866
+ const bnum = numeric.test(b);
5867
+ if (anum && bnum) {
5868
+ a = +a;
5869
+ b = +b;
5870
+ }
5871
+ return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
5872
+ };
5873
+ var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
5874
+ module2.exports = {
5875
+ compareIdentifiers,
5876
+ rcompareIdentifiers
5877
+ };
5878
+ }
5879
+ });
5880
+
5881
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/classes/semver.js
5882
+ var require_semver = __commonJS({
5883
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/classes/semver.js"(exports2, module2) {
5884
+ "use strict";
5885
+ var debug = require_debug();
5886
+ var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants2();
5887
+ var { safeRe: re, t } = require_re();
5888
+ var parseOptions = require_parse_options();
5889
+ var { compareIdentifiers } = require_identifiers();
5890
+ var SemVer = class _SemVer {
5891
+ constructor(version2, options) {
5892
+ options = parseOptions(options);
5893
+ if (version2 instanceof _SemVer) {
5894
+ if (version2.loose === !!options.loose && version2.includePrerelease === !!options.includePrerelease) {
5895
+ return version2;
5896
+ } else {
5897
+ version2 = version2.version;
5898
+ }
5899
+ } else if (typeof version2 !== "string") {
5900
+ throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version2}".`);
5901
+ }
5902
+ if (version2.length > MAX_LENGTH) {
5903
+ throw new TypeError(
5904
+ `version is longer than ${MAX_LENGTH} characters`
5905
+ );
5906
+ }
5907
+ debug("SemVer", version2, options);
5908
+ this.options = options;
5909
+ this.loose = !!options.loose;
5910
+ this.includePrerelease = !!options.includePrerelease;
5911
+ const m = version2.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
5912
+ if (!m) {
5913
+ throw new TypeError(`Invalid Version: ${version2}`);
5914
+ }
5915
+ this.raw = version2;
5916
+ this.major = +m[1];
5917
+ this.minor = +m[2];
5918
+ this.patch = +m[3];
5919
+ if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
5920
+ throw new TypeError("Invalid major version");
5921
+ }
5922
+ if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
5923
+ throw new TypeError("Invalid minor version");
5924
+ }
5925
+ if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
5926
+ throw new TypeError("Invalid patch version");
5927
+ }
5928
+ if (!m[4]) {
5929
+ this.prerelease = [];
5930
+ } else {
5931
+ this.prerelease = m[4].split(".").map((id) => {
5932
+ if (/^[0-9]+$/.test(id)) {
5933
+ const num = +id;
5934
+ if (num >= 0 && num < MAX_SAFE_INTEGER) {
5935
+ return num;
5936
+ }
5937
+ }
5938
+ return id;
5939
+ });
5940
+ }
5941
+ this.build = m[5] ? m[5].split(".") : [];
5942
+ this.format();
5943
+ }
5944
+ format() {
5945
+ this.version = `${this.major}.${this.minor}.${this.patch}`;
5946
+ if (this.prerelease.length) {
5947
+ this.version += `-${this.prerelease.join(".")}`;
5948
+ }
5949
+ return this.version;
5950
+ }
5951
+ toString() {
5952
+ return this.version;
5953
+ }
5954
+ compare(other) {
5955
+ debug("SemVer.compare", this.version, this.options, other);
5956
+ if (!(other instanceof _SemVer)) {
5957
+ if (typeof other === "string" && other === this.version) {
5958
+ return 0;
5959
+ }
5960
+ other = new _SemVer(other, this.options);
5961
+ }
5962
+ if (other.version === this.version) {
5963
+ return 0;
5964
+ }
5965
+ return this.compareMain(other) || this.comparePre(other);
5966
+ }
5967
+ compareMain(other) {
5968
+ if (!(other instanceof _SemVer)) {
5969
+ other = new _SemVer(other, this.options);
5970
+ }
5971
+ if (this.major < other.major) {
5972
+ return -1;
5973
+ }
5974
+ if (this.major > other.major) {
5975
+ return 1;
5976
+ }
5977
+ if (this.minor < other.minor) {
5978
+ return -1;
5979
+ }
5980
+ if (this.minor > other.minor) {
5981
+ return 1;
5982
+ }
5983
+ if (this.patch < other.patch) {
5984
+ return -1;
5985
+ }
5986
+ if (this.patch > other.patch) {
5987
+ return 1;
5988
+ }
5989
+ return 0;
5990
+ }
5991
+ comparePre(other) {
5992
+ if (!(other instanceof _SemVer)) {
5993
+ other = new _SemVer(other, this.options);
5994
+ }
5995
+ if (this.prerelease.length && !other.prerelease.length) {
5996
+ return -1;
5997
+ } else if (!this.prerelease.length && other.prerelease.length) {
5998
+ return 1;
5999
+ } else if (!this.prerelease.length && !other.prerelease.length) {
6000
+ return 0;
6001
+ }
6002
+ let i = 0;
6003
+ do {
6004
+ const a = this.prerelease[i];
6005
+ const b = other.prerelease[i];
6006
+ debug("prerelease compare", i, a, b);
6007
+ if (a === void 0 && b === void 0) {
6008
+ return 0;
6009
+ } else if (b === void 0) {
6010
+ return 1;
6011
+ } else if (a === void 0) {
6012
+ return -1;
6013
+ } else if (a === b) {
6014
+ continue;
6015
+ } else {
6016
+ return compareIdentifiers(a, b);
6017
+ }
6018
+ } while (++i);
6019
+ }
6020
+ compareBuild(other) {
6021
+ if (!(other instanceof _SemVer)) {
6022
+ other = new _SemVer(other, this.options);
6023
+ }
6024
+ let i = 0;
6025
+ do {
6026
+ const a = this.build[i];
6027
+ const b = other.build[i];
6028
+ debug("build compare", i, a, b);
6029
+ if (a === void 0 && b === void 0) {
6030
+ return 0;
6031
+ } else if (b === void 0) {
6032
+ return 1;
6033
+ } else if (a === void 0) {
6034
+ return -1;
6035
+ } else if (a === b) {
6036
+ continue;
6037
+ } else {
6038
+ return compareIdentifiers(a, b);
6039
+ }
6040
+ } while (++i);
6041
+ }
6042
+ // preminor will bump the version up to the next minor release, and immediately
6043
+ // down to pre-release. premajor and prepatch work the same way.
6044
+ inc(release, identifier, identifierBase) {
6045
+ if (release.startsWith("pre")) {
6046
+ if (!identifier && identifierBase === false) {
6047
+ throw new Error("invalid increment argument: identifier is empty");
6048
+ }
6049
+ if (identifier) {
6050
+ const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
6051
+ if (!match || match[1] !== identifier) {
6052
+ throw new Error(`invalid identifier: ${identifier}`);
6053
+ }
6054
+ }
6055
+ }
6056
+ switch (release) {
6057
+ case "premajor":
6058
+ this.prerelease.length = 0;
6059
+ this.patch = 0;
6060
+ this.minor = 0;
6061
+ this.major++;
6062
+ this.inc("pre", identifier, identifierBase);
6063
+ break;
6064
+ case "preminor":
6065
+ this.prerelease.length = 0;
6066
+ this.patch = 0;
6067
+ this.minor++;
6068
+ this.inc("pre", identifier, identifierBase);
6069
+ break;
6070
+ case "prepatch":
6071
+ this.prerelease.length = 0;
6072
+ this.inc("patch", identifier, identifierBase);
6073
+ this.inc("pre", identifier, identifierBase);
6074
+ break;
6075
+ // If the input is a non-prerelease version, this acts the same as
6076
+ // prepatch.
6077
+ case "prerelease":
6078
+ if (this.prerelease.length === 0) {
6079
+ this.inc("patch", identifier, identifierBase);
6080
+ }
6081
+ this.inc("pre", identifier, identifierBase);
6082
+ break;
6083
+ case "release":
6084
+ if (this.prerelease.length === 0) {
6085
+ throw new Error(`version ${this.raw} is not a prerelease`);
6086
+ }
6087
+ this.prerelease.length = 0;
6088
+ break;
6089
+ case "major":
6090
+ if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
6091
+ this.major++;
6092
+ }
6093
+ this.minor = 0;
6094
+ this.patch = 0;
6095
+ this.prerelease = [];
6096
+ break;
6097
+ case "minor":
6098
+ if (this.patch !== 0 || this.prerelease.length === 0) {
6099
+ this.minor++;
6100
+ }
6101
+ this.patch = 0;
6102
+ this.prerelease = [];
6103
+ break;
6104
+ case "patch":
6105
+ if (this.prerelease.length === 0) {
6106
+ this.patch++;
6107
+ }
6108
+ this.prerelease = [];
6109
+ break;
6110
+ // This probably shouldn't be used publicly.
6111
+ // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
6112
+ case "pre": {
6113
+ const base = Number(identifierBase) ? 1 : 0;
6114
+ if (this.prerelease.length === 0) {
6115
+ this.prerelease = [base];
6116
+ } else {
6117
+ let i = this.prerelease.length;
6118
+ while (--i >= 0) {
6119
+ if (typeof this.prerelease[i] === "number") {
6120
+ this.prerelease[i]++;
6121
+ i = -2;
6122
+ }
6123
+ }
6124
+ if (i === -1) {
6125
+ if (identifier === this.prerelease.join(".") && identifierBase === false) {
6126
+ throw new Error("invalid increment argument: identifier already exists");
6127
+ }
6128
+ this.prerelease.push(base);
6129
+ }
6130
+ }
6131
+ if (identifier) {
6132
+ let prerelease = [identifier, base];
6133
+ if (identifierBase === false) {
6134
+ prerelease = [identifier];
6135
+ }
6136
+ if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
6137
+ if (isNaN(this.prerelease[1])) {
6138
+ this.prerelease = prerelease;
6139
+ }
6140
+ } else {
6141
+ this.prerelease = prerelease;
6142
+ }
6143
+ }
6144
+ break;
6145
+ }
6146
+ default:
6147
+ throw new Error(`invalid increment argument: ${release}`);
6148
+ }
6149
+ this.raw = this.format();
6150
+ if (this.build.length) {
6151
+ this.raw += `+${this.build.join(".")}`;
6152
+ }
6153
+ return this;
6154
+ }
6155
+ };
6156
+ module2.exports = SemVer;
6157
+ }
6158
+ });
6159
+
6160
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/parse.js
6161
+ var require_parse2 = __commonJS({
6162
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/parse.js"(exports2, module2) {
6163
+ "use strict";
6164
+ var SemVer = require_semver();
6165
+ var parse5 = (version2, options, throwErrors = false) => {
6166
+ if (version2 instanceof SemVer) {
6167
+ return version2;
6168
+ }
6169
+ try {
6170
+ return new SemVer(version2, options);
6171
+ } catch (er) {
6172
+ if (!throwErrors) {
6173
+ return null;
6174
+ }
6175
+ throw er;
6176
+ }
6177
+ };
6178
+ module2.exports = parse5;
6179
+ }
6180
+ });
6181
+
6182
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/valid.js
6183
+ var require_valid = __commonJS({
6184
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/valid.js"(exports2, module2) {
6185
+ "use strict";
6186
+ var parse5 = require_parse2();
6187
+ var valid = (version2, options) => {
6188
+ const v = parse5(version2, options);
6189
+ return v ? v.version : null;
6190
+ };
6191
+ module2.exports = valid;
6192
+ }
6193
+ });
6194
+
6195
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/clean.js
6196
+ var require_clean = __commonJS({
6197
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/clean.js"(exports2, module2) {
6198
+ "use strict";
6199
+ var parse5 = require_parse2();
6200
+ var clean = (version2, options) => {
6201
+ const s = parse5(version2.trim().replace(/^[=v]+/, ""), options);
6202
+ return s ? s.version : null;
6203
+ };
6204
+ module2.exports = clean;
6205
+ }
6206
+ });
6207
+
6208
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/inc.js
6209
+ var require_inc = __commonJS({
6210
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/inc.js"(exports2, module2) {
6211
+ "use strict";
6212
+ var SemVer = require_semver();
6213
+ var inc = (version2, release, options, identifier, identifierBase) => {
6214
+ if (typeof options === "string") {
6215
+ identifierBase = identifier;
6216
+ identifier = options;
6217
+ options = void 0;
6218
+ }
6219
+ try {
6220
+ return new SemVer(
6221
+ version2 instanceof SemVer ? version2.version : version2,
6222
+ options
6223
+ ).inc(release, identifier, identifierBase).version;
6224
+ } catch (er) {
6225
+ return null;
6226
+ }
6227
+ };
6228
+ module2.exports = inc;
6229
+ }
6230
+ });
6231
+
6232
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/diff.js
6233
+ var require_diff = __commonJS({
6234
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/diff.js"(exports2, module2) {
6235
+ "use strict";
6236
+ var parse5 = require_parse2();
6237
+ var diff = (version1, version2) => {
6238
+ const v1 = parse5(version1, null, true);
6239
+ const v2 = parse5(version2, null, true);
6240
+ const comparison = v1.compare(v2);
6241
+ if (comparison === 0) {
6242
+ return null;
6243
+ }
6244
+ const v1Higher = comparison > 0;
6245
+ const highVersion = v1Higher ? v1 : v2;
6246
+ const lowVersion = v1Higher ? v2 : v1;
6247
+ const highHasPre = !!highVersion.prerelease.length;
6248
+ const lowHasPre = !!lowVersion.prerelease.length;
6249
+ if (lowHasPre && !highHasPre) {
6250
+ if (!lowVersion.patch && !lowVersion.minor) {
6251
+ return "major";
6252
+ }
6253
+ if (lowVersion.compareMain(highVersion) === 0) {
6254
+ if (lowVersion.minor && !lowVersion.patch) {
6255
+ return "minor";
6256
+ }
6257
+ return "patch";
6258
+ }
6259
+ }
6260
+ const prefix = highHasPre ? "pre" : "";
6261
+ if (v1.major !== v2.major) {
6262
+ return prefix + "major";
6263
+ }
6264
+ if (v1.minor !== v2.minor) {
6265
+ return prefix + "minor";
6266
+ }
6267
+ if (v1.patch !== v2.patch) {
6268
+ return prefix + "patch";
6269
+ }
6270
+ return "prerelease";
6271
+ };
6272
+ module2.exports = diff;
6273
+ }
6274
+ });
6275
+
6276
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/major.js
6277
+ var require_major = __commonJS({
6278
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/major.js"(exports2, module2) {
6279
+ "use strict";
6280
+ var SemVer = require_semver();
6281
+ var major = (a, loose) => new SemVer(a, loose).major;
6282
+ module2.exports = major;
6283
+ }
6284
+ });
6285
+
6286
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/minor.js
6287
+ var require_minor = __commonJS({
6288
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/minor.js"(exports2, module2) {
6289
+ "use strict";
6290
+ var SemVer = require_semver();
6291
+ var minor = (a, loose) => new SemVer(a, loose).minor;
6292
+ module2.exports = minor;
6293
+ }
6294
+ });
6295
+
6296
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/patch.js
6297
+ var require_patch = __commonJS({
6298
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/patch.js"(exports2, module2) {
6299
+ "use strict";
6300
+ var SemVer = require_semver();
6301
+ var patch = (a, loose) => new SemVer(a, loose).patch;
6302
+ module2.exports = patch;
6303
+ }
6304
+ });
6305
+
6306
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/prerelease.js
6307
+ var require_prerelease = __commonJS({
6308
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/prerelease.js"(exports2, module2) {
6309
+ "use strict";
6310
+ var parse5 = require_parse2();
6311
+ var prerelease = (version2, options) => {
6312
+ const parsed = parse5(version2, options);
6313
+ return parsed && parsed.prerelease.length ? parsed.prerelease : null;
6314
+ };
6315
+ module2.exports = prerelease;
6316
+ }
6317
+ });
6318
+
6319
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/compare.js
6320
+ var require_compare = __commonJS({
6321
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/compare.js"(exports2, module2) {
6322
+ "use strict";
6323
+ var SemVer = require_semver();
6324
+ var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
6325
+ module2.exports = compare;
6326
+ }
6327
+ });
6328
+
6329
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/rcompare.js
6330
+ var require_rcompare = __commonJS({
6331
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/rcompare.js"(exports2, module2) {
6332
+ "use strict";
6333
+ var compare = require_compare();
6334
+ var rcompare = (a, b, loose) => compare(b, a, loose);
6335
+ module2.exports = rcompare;
6336
+ }
6337
+ });
6338
+
6339
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/compare-loose.js
6340
+ var require_compare_loose = __commonJS({
6341
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/compare-loose.js"(exports2, module2) {
6342
+ "use strict";
6343
+ var compare = require_compare();
6344
+ var compareLoose = (a, b) => compare(a, b, true);
6345
+ module2.exports = compareLoose;
6346
+ }
6347
+ });
6348
+
6349
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/compare-build.js
6350
+ var require_compare_build = __commonJS({
6351
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/compare-build.js"(exports2, module2) {
6352
+ "use strict";
6353
+ var SemVer = require_semver();
6354
+ var compareBuild = (a, b, loose) => {
6355
+ const versionA = new SemVer(a, loose);
6356
+ const versionB = new SemVer(b, loose);
6357
+ return versionA.compare(versionB) || versionA.compareBuild(versionB);
6358
+ };
6359
+ module2.exports = compareBuild;
6360
+ }
6361
+ });
6362
+
6363
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/sort.js
6364
+ var require_sort = __commonJS({
6365
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/sort.js"(exports2, module2) {
6366
+ "use strict";
6367
+ var compareBuild = require_compare_build();
6368
+ var sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
6369
+ module2.exports = sort;
6370
+ }
6371
+ });
6372
+
6373
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/rsort.js
6374
+ var require_rsort = __commonJS({
6375
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/rsort.js"(exports2, module2) {
6376
+ "use strict";
6377
+ var compareBuild = require_compare_build();
6378
+ var rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
6379
+ module2.exports = rsort;
6380
+ }
6381
+ });
6382
+
6383
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/gt.js
6384
+ var require_gt = __commonJS({
6385
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/gt.js"(exports2, module2) {
6386
+ "use strict";
6387
+ var compare = require_compare();
6388
+ var gt = (a, b, loose) => compare(a, b, loose) > 0;
6389
+ module2.exports = gt;
6390
+ }
6391
+ });
6392
+
6393
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/lt.js
6394
+ var require_lt = __commonJS({
6395
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/lt.js"(exports2, module2) {
6396
+ "use strict";
6397
+ var compare = require_compare();
6398
+ var lt = (a, b, loose) => compare(a, b, loose) < 0;
6399
+ module2.exports = lt;
6400
+ }
6401
+ });
6402
+
6403
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/eq.js
6404
+ var require_eq = __commonJS({
6405
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/eq.js"(exports2, module2) {
6406
+ "use strict";
6407
+ var compare = require_compare();
6408
+ var eq = (a, b, loose) => compare(a, b, loose) === 0;
6409
+ module2.exports = eq;
6410
+ }
6411
+ });
6412
+
6413
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/neq.js
6414
+ var require_neq = __commonJS({
6415
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/neq.js"(exports2, module2) {
6416
+ "use strict";
6417
+ var compare = require_compare();
6418
+ var neq = (a, b, loose) => compare(a, b, loose) !== 0;
6419
+ module2.exports = neq;
6420
+ }
6421
+ });
6422
+
6423
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/gte.js
6424
+ var require_gte = __commonJS({
6425
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/gte.js"(exports2, module2) {
6426
+ "use strict";
6427
+ var compare = require_compare();
6428
+ var gte = (a, b, loose) => compare(a, b, loose) >= 0;
6429
+ module2.exports = gte;
6430
+ }
6431
+ });
6432
+
6433
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/lte.js
6434
+ var require_lte = __commonJS({
6435
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/lte.js"(exports2, module2) {
6436
+ "use strict";
6437
+ var compare = require_compare();
6438
+ var lte = (a, b, loose) => compare(a, b, loose) <= 0;
6439
+ module2.exports = lte;
6440
+ }
6441
+ });
6442
+
6443
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/cmp.js
6444
+ var require_cmp = __commonJS({
6445
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/cmp.js"(exports2, module2) {
6446
+ "use strict";
6447
+ var eq = require_eq();
6448
+ var neq = require_neq();
6449
+ var gt = require_gt();
6450
+ var gte = require_gte();
6451
+ var lt = require_lt();
6452
+ var lte = require_lte();
6453
+ var cmp = (a, op, b, loose) => {
6454
+ switch (op) {
6455
+ case "===":
6456
+ if (typeof a === "object") {
6457
+ a = a.version;
6458
+ }
6459
+ if (typeof b === "object") {
6460
+ b = b.version;
6461
+ }
6462
+ return a === b;
6463
+ case "!==":
6464
+ if (typeof a === "object") {
6465
+ a = a.version;
6466
+ }
6467
+ if (typeof b === "object") {
6468
+ b = b.version;
6469
+ }
6470
+ return a !== b;
6471
+ case "":
6472
+ case "=":
6473
+ case "==":
6474
+ return eq(a, b, loose);
6475
+ case "!=":
6476
+ return neq(a, b, loose);
6477
+ case ">":
6478
+ return gt(a, b, loose);
6479
+ case ">=":
6480
+ return gte(a, b, loose);
6481
+ case "<":
6482
+ return lt(a, b, loose);
6483
+ case "<=":
6484
+ return lte(a, b, loose);
6485
+ default:
6486
+ throw new TypeError(`Invalid operator: ${op}`);
6487
+ }
6488
+ };
6489
+ module2.exports = cmp;
6490
+ }
6491
+ });
6492
+
6493
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/coerce.js
6494
+ var require_coerce = __commonJS({
6495
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/coerce.js"(exports2, module2) {
6496
+ "use strict";
6497
+ var SemVer = require_semver();
6498
+ var parse5 = require_parse2();
6499
+ var { safeRe: re, t } = require_re();
6500
+ var coerce = (version2, options) => {
6501
+ if (version2 instanceof SemVer) {
6502
+ return version2;
6503
+ }
6504
+ if (typeof version2 === "number") {
6505
+ version2 = String(version2);
6506
+ }
6507
+ if (typeof version2 !== "string") {
6508
+ return null;
6509
+ }
6510
+ options = options || {};
6511
+ let match = null;
6512
+ if (!options.rtl) {
6513
+ match = version2.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
6514
+ } else {
6515
+ const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
6516
+ let next;
6517
+ while ((next = coerceRtlRegex.exec(version2)) && (!match || match.index + match[0].length !== version2.length)) {
6518
+ if (!match || next.index + next[0].length !== match.index + match[0].length) {
6519
+ match = next;
6520
+ }
6521
+ coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
6522
+ }
6523
+ coerceRtlRegex.lastIndex = -1;
6524
+ }
6525
+ if (match === null) {
6526
+ return null;
6527
+ }
6528
+ const major = match[2];
6529
+ const minor = match[3] || "0";
6530
+ const patch = match[4] || "0";
6531
+ const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
6532
+ const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
6533
+ return parse5(`${major}.${minor}.${patch}${prerelease}${build}`, options);
6534
+ };
6535
+ module2.exports = coerce;
6536
+ }
6537
+ });
6538
+
6539
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/truncate.js
6540
+ var require_truncate = __commonJS({
6541
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/truncate.js"(exports2, module2) {
6542
+ "use strict";
6543
+ var parse5 = require_parse2();
6544
+ var constants = require_constants2();
6545
+ var SemVer = require_semver();
6546
+ var truncate2 = (version2, truncation, options) => {
6547
+ if (!constants.RELEASE_TYPES.includes(truncation)) {
6548
+ return null;
6549
+ }
6550
+ const clonedVersion = cloneInputVersion(version2, options);
6551
+ return clonedVersion && doTruncation(clonedVersion, truncation);
6552
+ };
6553
+ var cloneInputVersion = (version2, options) => {
6554
+ const versionStringToParse = version2 instanceof SemVer ? version2.version : version2;
6555
+ return parse5(versionStringToParse, options);
6556
+ };
6557
+ var doTruncation = (version2, truncation) => {
6558
+ if (isPrerelease(truncation)) {
6559
+ return version2.version;
6560
+ }
6561
+ version2.prerelease = [];
6562
+ switch (truncation) {
6563
+ case "major":
6564
+ version2.minor = 0;
6565
+ version2.patch = 0;
6566
+ break;
6567
+ case "minor":
6568
+ version2.patch = 0;
6569
+ break;
6570
+ }
6571
+ return version2.format();
6572
+ };
6573
+ var isPrerelease = (type) => {
6574
+ return type.startsWith("pre");
6575
+ };
6576
+ module2.exports = truncate2;
6577
+ }
6578
+ });
6579
+
6580
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/internal/lrucache.js
6581
+ var require_lrucache = __commonJS({
6582
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/internal/lrucache.js"(exports2, module2) {
6583
+ "use strict";
6584
+ var LRUCache = class {
6585
+ constructor() {
6586
+ this.max = 1e3;
6587
+ this.map = /* @__PURE__ */ new Map();
6588
+ }
6589
+ get(key) {
6590
+ const value = this.map.get(key);
6591
+ if (value === void 0) {
6592
+ return void 0;
6593
+ } else {
6594
+ this.map.delete(key);
6595
+ this.map.set(key, value);
6596
+ return value;
6597
+ }
6598
+ }
6599
+ delete(key) {
6600
+ return this.map.delete(key);
6601
+ }
6602
+ set(key, value) {
6603
+ const deleted = this.delete(key);
6604
+ if (!deleted && value !== void 0) {
6605
+ if (this.map.size >= this.max) {
6606
+ const firstKey = this.map.keys().next().value;
6607
+ this.delete(firstKey);
6608
+ }
6609
+ this.map.set(key, value);
6610
+ }
6611
+ return this;
6612
+ }
6613
+ };
6614
+ module2.exports = LRUCache;
6615
+ }
6616
+ });
6617
+
6618
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/classes/range.js
6619
+ var require_range = __commonJS({
6620
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/classes/range.js"(exports2, module2) {
6621
+ "use strict";
6622
+ var SPACE_CHARACTERS = /\s+/g;
6623
+ var Range = class _Range {
6624
+ constructor(range, options) {
6625
+ options = parseOptions(options);
6626
+ if (range instanceof _Range) {
6627
+ if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
6628
+ return range;
6629
+ } else {
6630
+ return new _Range(range.raw, options);
6631
+ }
6632
+ }
6633
+ if (range instanceof Comparator) {
6634
+ this.raw = range.value;
6635
+ this.set = [[range]];
6636
+ this.formatted = void 0;
6637
+ return this;
6638
+ }
6639
+ this.options = options;
6640
+ this.loose = !!options.loose;
6641
+ this.includePrerelease = !!options.includePrerelease;
6642
+ this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
6643
+ this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
6644
+ if (!this.set.length) {
6645
+ throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
6646
+ }
6647
+ if (this.set.length > 1) {
6648
+ const first = this.set[0];
6649
+ this.set = this.set.filter((c) => !isNullSet(c[0]));
6650
+ if (this.set.length === 0) {
6651
+ this.set = [first];
6652
+ } else if (this.set.length > 1) {
6653
+ for (const c of this.set) {
6654
+ if (c.length === 1 && isAny(c[0])) {
6655
+ this.set = [c];
6656
+ break;
6657
+ }
6658
+ }
6659
+ }
6660
+ }
6661
+ this.formatted = void 0;
6662
+ }
6663
+ get range() {
6664
+ if (this.formatted === void 0) {
6665
+ this.formatted = "";
6666
+ for (let i = 0; i < this.set.length; i++) {
6667
+ if (i > 0) {
6668
+ this.formatted += "||";
6669
+ }
6670
+ const comps = this.set[i];
6671
+ for (let k = 0; k < comps.length; k++) {
6672
+ if (k > 0) {
6673
+ this.formatted += " ";
6674
+ }
6675
+ this.formatted += comps[k].toString().trim();
6676
+ }
6677
+ }
6678
+ }
6679
+ return this.formatted;
6680
+ }
6681
+ format() {
6682
+ return this.range;
6683
+ }
6684
+ toString() {
6685
+ return this.range;
6686
+ }
6687
+ parseRange(range) {
6688
+ const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
6689
+ const memoKey = memoOpts + ":" + range;
6690
+ const cached2 = cache.get(memoKey);
6691
+ if (cached2) {
6692
+ return cached2;
6693
+ }
6694
+ const loose = this.options.loose;
6695
+ const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
6696
+ range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
6697
+ debug("hyphen replace", range);
6698
+ range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
6699
+ debug("comparator trim", range);
6700
+ range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
6701
+ debug("tilde trim", range);
6702
+ range = range.replace(re[t.CARETTRIM], caretTrimReplace);
6703
+ debug("caret trim", range);
6704
+ let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
6705
+ if (loose) {
6706
+ rangeList = rangeList.filter((comp) => {
6707
+ debug("loose invalid filter", comp, this.options);
6708
+ return !!comp.match(re[t.COMPARATORLOOSE]);
6709
+ });
6710
+ }
6711
+ debug("range list", rangeList);
6712
+ const rangeMap = /* @__PURE__ */ new Map();
6713
+ const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
6714
+ for (const comp of comparators) {
6715
+ if (isNullSet(comp)) {
6716
+ return [comp];
6717
+ }
6718
+ rangeMap.set(comp.value, comp);
6719
+ }
6720
+ if (rangeMap.size > 1 && rangeMap.has("")) {
6721
+ rangeMap.delete("");
6722
+ }
6723
+ const result = [...rangeMap.values()];
6724
+ cache.set(memoKey, result);
6725
+ return result;
6726
+ }
6727
+ intersects(range, options) {
6728
+ if (!(range instanceof _Range)) {
6729
+ throw new TypeError("a Range is required");
6730
+ }
6731
+ return this.set.some((thisComparators) => {
6732
+ return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
6733
+ return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
6734
+ return rangeComparators.every((rangeComparator) => {
6735
+ return thisComparator.intersects(rangeComparator, options);
6736
+ });
6737
+ });
6738
+ });
6739
+ });
6740
+ }
6741
+ // if ANY of the sets match ALL of its comparators, then pass
6742
+ test(version2) {
6743
+ if (!version2) {
6744
+ return false;
6745
+ }
6746
+ if (typeof version2 === "string") {
6747
+ try {
6748
+ version2 = new SemVer(version2, this.options);
6749
+ } catch (er) {
6750
+ return false;
6751
+ }
6752
+ }
6753
+ for (let i = 0; i < this.set.length; i++) {
6754
+ if (testSet(this.set[i], version2, this.options)) {
6755
+ return true;
6756
+ }
6757
+ }
6758
+ return false;
6759
+ }
6760
+ };
6761
+ module2.exports = Range;
6762
+ var LRU = require_lrucache();
6763
+ var cache = new LRU();
6764
+ var parseOptions = require_parse_options();
6765
+ var Comparator = require_comparator();
6766
+ var debug = require_debug();
6767
+ var SemVer = require_semver();
6768
+ var {
6769
+ safeRe: re,
6770
+ t,
6771
+ comparatorTrimReplace,
6772
+ tildeTrimReplace,
6773
+ caretTrimReplace
6774
+ } = require_re();
6775
+ var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants2();
6776
+ var isNullSet = (c) => c.value === "<0.0.0-0";
6777
+ var isAny = (c) => c.value === "";
6778
+ var isSatisfiable = (comparators, options) => {
6779
+ let result = true;
6780
+ const remainingComparators = comparators.slice();
6781
+ let testComparator = remainingComparators.pop();
6782
+ while (result && remainingComparators.length) {
6783
+ result = remainingComparators.every((otherComparator) => {
6784
+ return testComparator.intersects(otherComparator, options);
6785
+ });
6786
+ testComparator = remainingComparators.pop();
6787
+ }
6788
+ return result;
6789
+ };
6790
+ var parseComparator = (comp, options) => {
6791
+ comp = comp.replace(re[t.BUILD], "");
6792
+ debug("comp", comp, options);
6793
+ comp = replaceCarets(comp, options);
6794
+ debug("caret", comp);
6795
+ comp = replaceTildes(comp, options);
6796
+ debug("tildes", comp);
6797
+ comp = replaceXRanges(comp, options);
6798
+ debug("xrange", comp);
6799
+ comp = replaceStars(comp, options);
6800
+ debug("stars", comp);
6801
+ return comp;
6802
+ };
6803
+ var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
6804
+ var replaceTildes = (comp, options) => {
6805
+ return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
6806
+ };
6807
+ var replaceTilde = (comp, options) => {
6808
+ const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
6809
+ return comp.replace(r, (_, M, m, p, pr) => {
6810
+ debug("tilde", comp, _, M, m, p, pr);
6811
+ let ret;
6812
+ if (isX(M)) {
6813
+ ret = "";
6814
+ } else if (isX(m)) {
6815
+ ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
6816
+ } else if (isX(p)) {
6817
+ ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
6818
+ } else if (pr) {
6819
+ debug("replaceTilde pr", pr);
6820
+ ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
6821
+ } else {
6822
+ ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
6823
+ }
6824
+ debug("tilde return", ret);
6825
+ return ret;
6826
+ });
6827
+ };
6828
+ var replaceCarets = (comp, options) => {
6829
+ return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
6830
+ };
6831
+ var replaceCaret = (comp, options) => {
6832
+ debug("caret", comp, options);
6833
+ const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
6834
+ const z2 = options.includePrerelease ? "-0" : "";
6835
+ return comp.replace(r, (_, M, m, p, pr) => {
6836
+ debug("caret", comp, _, M, m, p, pr);
6837
+ let ret;
6838
+ if (isX(M)) {
6839
+ ret = "";
6840
+ } else if (isX(m)) {
6841
+ ret = `>=${M}.0.0${z2} <${+M + 1}.0.0-0`;
6842
+ } else if (isX(p)) {
6843
+ if (M === "0") {
6844
+ ret = `>=${M}.${m}.0${z2} <${M}.${+m + 1}.0-0`;
6845
+ } else {
6846
+ ret = `>=${M}.${m}.0${z2} <${+M + 1}.0.0-0`;
6847
+ }
6848
+ } else if (pr) {
6849
+ debug("replaceCaret pr", pr);
6850
+ if (M === "0") {
6851
+ if (m === "0") {
6852
+ ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
6853
+ } else {
6854
+ ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
6855
+ }
6856
+ } else {
6857
+ ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
6858
+ }
6859
+ } else {
6860
+ debug("no pr");
6861
+ if (M === "0") {
6862
+ if (m === "0") {
6863
+ ret = `>=${M}.${m}.${p}${z2} <${M}.${m}.${+p + 1}-0`;
6864
+ } else {
6865
+ ret = `>=${M}.${m}.${p}${z2} <${M}.${+m + 1}.0-0`;
6866
+ }
6867
+ } else {
6868
+ ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
6869
+ }
6870
+ }
6871
+ debug("caret return", ret);
6872
+ return ret;
6873
+ });
6874
+ };
6875
+ var replaceXRanges = (comp, options) => {
6876
+ debug("replaceXRanges", comp, options);
6877
+ return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
6878
+ };
6879
+ var replaceXRange = (comp, options) => {
6880
+ comp = comp.trim();
6881
+ const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
6882
+ return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
6883
+ debug("xRange", comp, ret, gtlt, M, m, p, pr);
6884
+ const xM = isX(M);
6885
+ const xm = xM || isX(m);
6886
+ const xp = xm || isX(p);
6887
+ const anyX = xp;
6888
+ if (gtlt === "=" && anyX) {
6889
+ gtlt = "";
6890
+ }
6891
+ pr = options.includePrerelease ? "-0" : "";
6892
+ if (xM) {
6893
+ if (gtlt === ">" || gtlt === "<") {
6894
+ ret = "<0.0.0-0";
6895
+ } else {
6896
+ ret = "*";
6897
+ }
6898
+ } else if (gtlt && anyX) {
6899
+ if (xm) {
6900
+ m = 0;
6901
+ }
6902
+ p = 0;
6903
+ if (gtlt === ">") {
6904
+ gtlt = ">=";
6905
+ if (xm) {
6906
+ M = +M + 1;
6907
+ m = 0;
6908
+ p = 0;
6909
+ } else {
6910
+ m = +m + 1;
6911
+ p = 0;
6912
+ }
6913
+ } else if (gtlt === "<=") {
6914
+ gtlt = "<";
6915
+ if (xm) {
6916
+ M = +M + 1;
6917
+ } else {
6918
+ m = +m + 1;
6919
+ }
6920
+ }
6921
+ if (gtlt === "<") {
6922
+ pr = "-0";
6923
+ }
6924
+ ret = `${gtlt + M}.${m}.${p}${pr}`;
6925
+ } else if (xm) {
6926
+ ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
6927
+ } else if (xp) {
6928
+ ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
6929
+ }
6930
+ debug("xRange return", ret);
6931
+ return ret;
6932
+ });
6933
+ };
6934
+ var replaceStars = (comp, options) => {
6935
+ debug("replaceStars", comp, options);
6936
+ return comp.trim().replace(re[t.STAR], "");
6937
+ };
6938
+ var replaceGTE0 = (comp, options) => {
6939
+ debug("replaceGTE0", comp, options);
6940
+ return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
6941
+ };
6942
+ var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
6943
+ if (isX(fM)) {
6944
+ from = "";
6945
+ } else if (isX(fm)) {
6946
+ from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
6947
+ } else if (isX(fp)) {
6948
+ from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
6949
+ } else if (fpr) {
6950
+ from = `>=${from}`;
6951
+ } else {
6952
+ from = `>=${from}${incPr ? "-0" : ""}`;
6953
+ }
6954
+ if (isX(tM)) {
6955
+ to = "";
6956
+ } else if (isX(tm)) {
6957
+ to = `<${+tM + 1}.0.0-0`;
6958
+ } else if (isX(tp)) {
6959
+ to = `<${tM}.${+tm + 1}.0-0`;
6960
+ } else if (tpr) {
6961
+ to = `<=${tM}.${tm}.${tp}-${tpr}`;
6962
+ } else if (incPr) {
6963
+ to = `<${tM}.${tm}.${+tp + 1}-0`;
6964
+ } else {
6965
+ to = `<=${to}`;
6966
+ }
6967
+ return `${from} ${to}`.trim();
6968
+ };
6969
+ var testSet = (set2, version2, options) => {
6970
+ for (let i = 0; i < set2.length; i++) {
6971
+ if (!set2[i].test(version2)) {
6972
+ return false;
6973
+ }
6974
+ }
6975
+ if (version2.prerelease.length && !options.includePrerelease) {
6976
+ for (let i = 0; i < set2.length; i++) {
6977
+ debug(set2[i].semver);
6978
+ if (set2[i].semver === Comparator.ANY) {
6979
+ continue;
6980
+ }
6981
+ if (set2[i].semver.prerelease.length > 0) {
6982
+ const allowed = set2[i].semver;
6983
+ if (allowed.major === version2.major && allowed.minor === version2.minor && allowed.patch === version2.patch) {
6984
+ return true;
6985
+ }
6986
+ }
6987
+ }
6988
+ return false;
6989
+ }
6990
+ return true;
6991
+ };
6992
+ }
6993
+ });
6994
+
6995
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/classes/comparator.js
6996
+ var require_comparator = __commonJS({
6997
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/classes/comparator.js"(exports2, module2) {
6998
+ "use strict";
6999
+ var ANY = Symbol("SemVer ANY");
7000
+ var Comparator = class _Comparator {
7001
+ static get ANY() {
7002
+ return ANY;
7003
+ }
7004
+ constructor(comp, options) {
7005
+ options = parseOptions(options);
7006
+ if (comp instanceof _Comparator) {
7007
+ if (comp.loose === !!options.loose) {
7008
+ return comp;
7009
+ } else {
7010
+ comp = comp.value;
7011
+ }
7012
+ }
7013
+ comp = comp.trim().split(/\s+/).join(" ");
7014
+ debug("comparator", comp, options);
7015
+ this.options = options;
7016
+ this.loose = !!options.loose;
7017
+ this.parse(comp);
7018
+ if (this.semver === ANY) {
7019
+ this.value = "";
7020
+ } else {
7021
+ this.value = this.operator + this.semver.version;
7022
+ }
7023
+ debug("comp", this);
7024
+ }
7025
+ parse(comp) {
7026
+ const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
7027
+ const m = comp.match(r);
7028
+ if (!m) {
7029
+ throw new TypeError(`Invalid comparator: ${comp}`);
7030
+ }
7031
+ this.operator = m[1] !== void 0 ? m[1] : "";
7032
+ if (this.operator === "=") {
7033
+ this.operator = "";
7034
+ }
7035
+ if (!m[2]) {
7036
+ this.semver = ANY;
7037
+ } else {
7038
+ this.semver = new SemVer(m[2], this.options.loose);
7039
+ }
7040
+ }
7041
+ toString() {
7042
+ return this.value;
7043
+ }
7044
+ test(version2) {
7045
+ debug("Comparator.test", version2, this.options.loose);
7046
+ if (this.semver === ANY || version2 === ANY) {
7047
+ return true;
7048
+ }
7049
+ if (typeof version2 === "string") {
7050
+ try {
7051
+ version2 = new SemVer(version2, this.options);
7052
+ } catch (er) {
7053
+ return false;
7054
+ }
7055
+ }
7056
+ return cmp(version2, this.operator, this.semver, this.options);
7057
+ }
7058
+ intersects(comp, options) {
7059
+ if (!(comp instanceof _Comparator)) {
7060
+ throw new TypeError("a Comparator is required");
7061
+ }
7062
+ if (this.operator === "") {
7063
+ if (this.value === "") {
7064
+ return true;
7065
+ }
7066
+ return new Range(comp.value, options).test(this.value);
7067
+ } else if (comp.operator === "") {
7068
+ if (comp.value === "") {
7069
+ return true;
7070
+ }
7071
+ return new Range(this.value, options).test(comp.semver);
7072
+ }
7073
+ options = parseOptions(options);
7074
+ if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
7075
+ return false;
7076
+ }
7077
+ if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
7078
+ return false;
7079
+ }
7080
+ if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
7081
+ return true;
7082
+ }
7083
+ if (this.operator.startsWith("<") && comp.operator.startsWith("<")) {
7084
+ return true;
7085
+ }
7086
+ if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
7087
+ return true;
7088
+ }
7089
+ if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
7090
+ return true;
7091
+ }
7092
+ if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
7093
+ return true;
7094
+ }
7095
+ return false;
7096
+ }
7097
+ };
7098
+ module2.exports = Comparator;
7099
+ var parseOptions = require_parse_options();
7100
+ var { safeRe: re, t } = require_re();
7101
+ var cmp = require_cmp();
7102
+ var debug = require_debug();
7103
+ var SemVer = require_semver();
7104
+ var Range = require_range();
7105
+ }
7106
+ });
7107
+
7108
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/satisfies.js
7109
+ var require_satisfies = __commonJS({
7110
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/functions/satisfies.js"(exports2, module2) {
7111
+ "use strict";
7112
+ var Range = require_range();
7113
+ var satisfies = (version2, range, options) => {
7114
+ try {
7115
+ range = new Range(range, options);
7116
+ } catch (er) {
7117
+ return false;
7118
+ }
7119
+ return range.test(version2);
7120
+ };
7121
+ module2.exports = satisfies;
7122
+ }
7123
+ });
7124
+
7125
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/ranges/to-comparators.js
7126
+ var require_to_comparators = __commonJS({
7127
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/ranges/to-comparators.js"(exports2, module2) {
7128
+ "use strict";
7129
+ var Range = require_range();
7130
+ var toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
7131
+ module2.exports = toComparators;
7132
+ }
7133
+ });
7134
+
7135
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/ranges/max-satisfying.js
7136
+ var require_max_satisfying = __commonJS({
7137
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/ranges/max-satisfying.js"(exports2, module2) {
7138
+ "use strict";
7139
+ var SemVer = require_semver();
7140
+ var Range = require_range();
7141
+ var maxSatisfying = (versions, range, options) => {
7142
+ let max = null;
7143
+ let maxSV = null;
7144
+ let rangeObj = null;
7145
+ try {
7146
+ rangeObj = new Range(range, options);
7147
+ } catch (er) {
7148
+ return null;
7149
+ }
7150
+ versions.forEach((v) => {
7151
+ if (rangeObj.test(v)) {
7152
+ if (!max || maxSV.compare(v) === -1) {
7153
+ max = v;
7154
+ maxSV = new SemVer(max, options);
7155
+ }
7156
+ }
7157
+ });
7158
+ return max;
7159
+ };
7160
+ module2.exports = maxSatisfying;
7161
+ }
7162
+ });
7163
+
7164
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/ranges/min-satisfying.js
7165
+ var require_min_satisfying = __commonJS({
7166
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/ranges/min-satisfying.js"(exports2, module2) {
7167
+ "use strict";
7168
+ var SemVer = require_semver();
7169
+ var Range = require_range();
7170
+ var minSatisfying = (versions, range, options) => {
7171
+ let min = null;
7172
+ let minSV = null;
7173
+ let rangeObj = null;
7174
+ try {
7175
+ rangeObj = new Range(range, options);
7176
+ } catch (er) {
7177
+ return null;
7178
+ }
7179
+ versions.forEach((v) => {
7180
+ if (rangeObj.test(v)) {
7181
+ if (!min || minSV.compare(v) === 1) {
7182
+ min = v;
7183
+ minSV = new SemVer(min, options);
7184
+ }
7185
+ }
7186
+ });
7187
+ return min;
7188
+ };
7189
+ module2.exports = minSatisfying;
7190
+ }
7191
+ });
7192
+
7193
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/ranges/min-version.js
7194
+ var require_min_version = __commonJS({
7195
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/ranges/min-version.js"(exports2, module2) {
7196
+ "use strict";
7197
+ var SemVer = require_semver();
7198
+ var Range = require_range();
7199
+ var gt = require_gt();
7200
+ var minVersion = (range, loose) => {
7201
+ range = new Range(range, loose);
7202
+ let minver = new SemVer("0.0.0");
7203
+ if (range.test(minver)) {
7204
+ return minver;
7205
+ }
7206
+ minver = new SemVer("0.0.0-0");
7207
+ if (range.test(minver)) {
7208
+ return minver;
7209
+ }
7210
+ minver = null;
7211
+ for (let i = 0; i < range.set.length; ++i) {
7212
+ const comparators = range.set[i];
7213
+ let setMin = null;
7214
+ comparators.forEach((comparator) => {
7215
+ const compver = new SemVer(comparator.semver.version);
7216
+ switch (comparator.operator) {
7217
+ case ">":
7218
+ if (compver.prerelease.length === 0) {
7219
+ compver.patch++;
7220
+ } else {
7221
+ compver.prerelease.push(0);
7222
+ }
7223
+ compver.raw = compver.format();
7224
+ /* fallthrough */
7225
+ case "":
7226
+ case ">=":
7227
+ if (!setMin || gt(compver, setMin)) {
7228
+ setMin = compver;
7229
+ }
7230
+ break;
7231
+ case "<":
7232
+ case "<=":
7233
+ break;
7234
+ /* istanbul ignore next */
7235
+ default:
7236
+ throw new Error(`Unexpected operation: ${comparator.operator}`);
7237
+ }
7238
+ });
7239
+ if (setMin && (!minver || gt(minver, setMin))) {
7240
+ minver = setMin;
7241
+ }
7242
+ }
7243
+ if (minver && range.test(minver)) {
7244
+ return minver;
7245
+ }
7246
+ return null;
7247
+ };
7248
+ module2.exports = minVersion;
7249
+ }
7250
+ });
7251
+
7252
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/ranges/valid.js
7253
+ var require_valid2 = __commonJS({
7254
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/ranges/valid.js"(exports2, module2) {
7255
+ "use strict";
7256
+ var Range = require_range();
7257
+ var validRange = (range, options) => {
7258
+ try {
7259
+ return new Range(range, options).range || "*";
7260
+ } catch (er) {
7261
+ return null;
7262
+ }
7263
+ };
7264
+ module2.exports = validRange;
7265
+ }
7266
+ });
7267
+
7268
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/ranges/outside.js
7269
+ var require_outside = __commonJS({
7270
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/ranges/outside.js"(exports2, module2) {
7271
+ "use strict";
7272
+ var SemVer = require_semver();
7273
+ var Comparator = require_comparator();
7274
+ var { ANY } = Comparator;
7275
+ var Range = require_range();
7276
+ var satisfies = require_satisfies();
7277
+ var gt = require_gt();
7278
+ var lt = require_lt();
7279
+ var lte = require_lte();
7280
+ var gte = require_gte();
7281
+ var outside = (version2, range, hilo, options) => {
7282
+ version2 = new SemVer(version2, options);
7283
+ range = new Range(range, options);
7284
+ let gtfn, ltefn, ltfn, comp, ecomp;
7285
+ switch (hilo) {
7286
+ case ">":
7287
+ gtfn = gt;
7288
+ ltefn = lte;
7289
+ ltfn = lt;
7290
+ comp = ">";
7291
+ ecomp = ">=";
7292
+ break;
7293
+ case "<":
7294
+ gtfn = lt;
7295
+ ltefn = gte;
7296
+ ltfn = gt;
7297
+ comp = "<";
7298
+ ecomp = "<=";
7299
+ break;
7300
+ default:
7301
+ throw new TypeError('Must provide a hilo val of "<" or ">"');
7302
+ }
7303
+ if (satisfies(version2, range, options)) {
7304
+ return false;
7305
+ }
7306
+ for (let i = 0; i < range.set.length; ++i) {
7307
+ const comparators = range.set[i];
7308
+ let high = null;
7309
+ let low = null;
7310
+ comparators.forEach((comparator) => {
7311
+ if (comparator.semver === ANY) {
7312
+ comparator = new Comparator(">=0.0.0");
7313
+ }
7314
+ high = high || comparator;
7315
+ low = low || comparator;
7316
+ if (gtfn(comparator.semver, high.semver, options)) {
7317
+ high = comparator;
7318
+ } else if (ltfn(comparator.semver, low.semver, options)) {
7319
+ low = comparator;
7320
+ }
7321
+ });
7322
+ if (high.operator === comp || high.operator === ecomp) {
7323
+ return false;
7324
+ }
7325
+ if ((!low.operator || low.operator === comp) && ltefn(version2, low.semver)) {
7326
+ return false;
7327
+ } else if (low.operator === ecomp && ltfn(version2, low.semver)) {
7328
+ return false;
7329
+ }
7330
+ }
7331
+ return true;
7332
+ };
7333
+ module2.exports = outside;
7334
+ }
7335
+ });
7336
+
7337
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/ranges/gtr.js
7338
+ var require_gtr = __commonJS({
7339
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/ranges/gtr.js"(exports2, module2) {
7340
+ "use strict";
7341
+ var outside = require_outside();
7342
+ var gtr = (version2, range, options) => outside(version2, range, ">", options);
7343
+ module2.exports = gtr;
7344
+ }
7345
+ });
7346
+
7347
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/ranges/ltr.js
7348
+ var require_ltr = __commonJS({
7349
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/ranges/ltr.js"(exports2, module2) {
7350
+ "use strict";
7351
+ var outside = require_outside();
7352
+ var ltr = (version2, range, options) => outside(version2, range, "<", options);
7353
+ module2.exports = ltr;
7354
+ }
7355
+ });
7356
+
7357
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/ranges/intersects.js
7358
+ var require_intersects = __commonJS({
7359
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/ranges/intersects.js"(exports2, module2) {
7360
+ "use strict";
7361
+ var Range = require_range();
7362
+ var intersects = (r1, r2, options) => {
7363
+ r1 = new Range(r1, options);
7364
+ r2 = new Range(r2, options);
7365
+ return r1.intersects(r2, options);
7366
+ };
7367
+ module2.exports = intersects;
7368
+ }
7369
+ });
7370
+
7371
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/ranges/simplify.js
7372
+ var require_simplify = __commonJS({
7373
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/ranges/simplify.js"(exports2, module2) {
7374
+ "use strict";
7375
+ var satisfies = require_satisfies();
7376
+ var compare = require_compare();
7377
+ module2.exports = (versions, range, options) => {
7378
+ const set2 = [];
7379
+ let first = null;
7380
+ let prev = null;
7381
+ const v = versions.sort((a, b) => compare(a, b, options));
7382
+ for (const version2 of v) {
7383
+ const included = satisfies(version2, range, options);
7384
+ if (included) {
7385
+ prev = version2;
7386
+ if (!first) {
7387
+ first = version2;
7388
+ }
7389
+ } else {
7390
+ if (prev) {
7391
+ set2.push([first, prev]);
7392
+ }
7393
+ prev = null;
7394
+ first = null;
7395
+ }
7396
+ }
7397
+ if (first) {
7398
+ set2.push([first, null]);
7399
+ }
7400
+ const ranges = [];
7401
+ for (const [min, max] of set2) {
7402
+ if (min === max) {
7403
+ ranges.push(min);
7404
+ } else if (!max && min === v[0]) {
7405
+ ranges.push("*");
7406
+ } else if (!max) {
7407
+ ranges.push(`>=${min}`);
7408
+ } else if (min === v[0]) {
7409
+ ranges.push(`<=${max}`);
7410
+ } else {
7411
+ ranges.push(`${min} - ${max}`);
7412
+ }
7413
+ }
7414
+ const simplified = ranges.join(" || ");
7415
+ const original = typeof range.raw === "string" ? range.raw : String(range);
7416
+ return simplified.length < original.length ? simplified : range;
7417
+ };
7418
+ }
7419
+ });
7420
+
7421
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/ranges/subset.js
7422
+ var require_subset = __commonJS({
7423
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/ranges/subset.js"(exports2, module2) {
7424
+ "use strict";
7425
+ var Range = require_range();
7426
+ var Comparator = require_comparator();
7427
+ var { ANY } = Comparator;
7428
+ var satisfies = require_satisfies();
7429
+ var compare = require_compare();
7430
+ var subset = (sub, dom, options = {}) => {
7431
+ if (sub === dom) {
7432
+ return true;
7433
+ }
7434
+ sub = new Range(sub, options);
7435
+ dom = new Range(dom, options);
7436
+ let sawNonNull = false;
7437
+ OUTER: for (const simpleSub of sub.set) {
7438
+ for (const simpleDom of dom.set) {
7439
+ const isSub = simpleSubset(simpleSub, simpleDom, options);
7440
+ sawNonNull = sawNonNull || isSub !== null;
7441
+ if (isSub) {
7442
+ continue OUTER;
7443
+ }
7444
+ }
7445
+ if (sawNonNull) {
7446
+ return false;
7447
+ }
7448
+ }
7449
+ return true;
7450
+ };
7451
+ var minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
7452
+ var minimumVersion = [new Comparator(">=0.0.0")];
7453
+ var simpleSubset = (sub, dom, options) => {
7454
+ if (sub === dom) {
7455
+ return true;
7456
+ }
7457
+ if (sub.length === 1 && sub[0].semver === ANY) {
7458
+ if (dom.length === 1 && dom[0].semver === ANY) {
7459
+ return true;
7460
+ } else if (options.includePrerelease) {
7461
+ sub = minimumVersionWithPreRelease;
7462
+ } else {
7463
+ sub = minimumVersion;
7464
+ }
7465
+ }
7466
+ if (dom.length === 1 && dom[0].semver === ANY) {
7467
+ if (options.includePrerelease) {
7468
+ return true;
7469
+ } else {
7470
+ dom = minimumVersion;
7471
+ }
7472
+ }
7473
+ const eqSet = /* @__PURE__ */ new Set();
7474
+ let gt, lt;
7475
+ for (const c of sub) {
7476
+ if (c.operator === ">" || c.operator === ">=") {
7477
+ gt = higherGT(gt, c, options);
7478
+ } else if (c.operator === "<" || c.operator === "<=") {
7479
+ lt = lowerLT(lt, c, options);
7480
+ } else {
7481
+ eqSet.add(c.semver);
7482
+ }
7483
+ }
7484
+ if (eqSet.size > 1) {
7485
+ return null;
7486
+ }
7487
+ let gtltComp;
7488
+ if (gt && lt) {
7489
+ gtltComp = compare(gt.semver, lt.semver, options);
7490
+ if (gtltComp > 0) {
7491
+ return null;
7492
+ } else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
7493
+ return null;
7494
+ }
7495
+ }
7496
+ for (const eq of eqSet) {
7497
+ if (gt && !satisfies(eq, String(gt), options)) {
7498
+ return null;
7499
+ }
7500
+ if (lt && !satisfies(eq, String(lt), options)) {
7501
+ return null;
7502
+ }
7503
+ for (const c of dom) {
7504
+ if (!satisfies(eq, String(c), options)) {
7505
+ return false;
7506
+ }
7507
+ }
7508
+ return true;
7509
+ }
7510
+ let higher, lower;
7511
+ let hasDomLT, hasDomGT;
7512
+ let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
7513
+ let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
7514
+ if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) {
7515
+ needDomLTPre = false;
7516
+ }
7517
+ for (const c of dom) {
7518
+ hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
7519
+ hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
7520
+ if (gt) {
7521
+ if (needDomGTPre) {
7522
+ if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) {
7523
+ needDomGTPre = false;
7524
+ }
7525
+ }
7526
+ if (c.operator === ">" || c.operator === ">=") {
7527
+ higher = higherGT(gt, c, options);
7528
+ if (higher === c && higher !== gt) {
7529
+ return false;
7530
+ }
7531
+ } else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options)) {
7532
+ return false;
7533
+ }
7534
+ }
7535
+ if (lt) {
7536
+ if (needDomLTPre) {
7537
+ if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) {
7538
+ needDomLTPre = false;
7539
+ }
7540
+ }
7541
+ if (c.operator === "<" || c.operator === "<=") {
7542
+ lower = lowerLT(lt, c, options);
7543
+ if (lower === c && lower !== lt) {
7544
+ return false;
7545
+ }
7546
+ } else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options)) {
7547
+ return false;
7548
+ }
7549
+ }
7550
+ if (!c.operator && (lt || gt) && gtltComp !== 0) {
7551
+ return false;
7552
+ }
7553
+ }
7554
+ if (gt && hasDomLT && !lt && gtltComp !== 0) {
7555
+ return false;
7556
+ }
7557
+ if (lt && hasDomGT && !gt && gtltComp !== 0) {
7558
+ return false;
7559
+ }
7560
+ if (needDomGTPre || needDomLTPre) {
7561
+ return false;
7562
+ }
7563
+ return true;
7564
+ };
7565
+ var higherGT = (a, b, options) => {
7566
+ if (!a) {
7567
+ return b;
7568
+ }
7569
+ const comp = compare(a.semver, b.semver, options);
7570
+ return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
7571
+ };
7572
+ var lowerLT = (a, b, options) => {
7573
+ if (!a) {
7574
+ return b;
7575
+ }
7576
+ const comp = compare(a.semver, b.semver, options);
7577
+ return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
7578
+ };
7579
+ module2.exports = subset;
7580
+ }
7581
+ });
7582
+
7583
+ // ../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/index.js
7584
+ var require_semver2 = __commonJS({
7585
+ "../../node_modules/.pnpm/semver@7.8.0/node_modules/semver/index.js"(exports2, module2) {
7586
+ "use strict";
7587
+ var internalRe = require_re();
7588
+ var constants = require_constants2();
7589
+ var SemVer = require_semver();
7590
+ var identifiers = require_identifiers();
7591
+ var parse5 = require_parse2();
7592
+ var valid = require_valid();
7593
+ var clean = require_clean();
7594
+ var inc = require_inc();
7595
+ var diff = require_diff();
7596
+ var major = require_major();
7597
+ var minor = require_minor();
7598
+ var patch = require_patch();
7599
+ var prerelease = require_prerelease();
7600
+ var compare = require_compare();
7601
+ var rcompare = require_rcompare();
7602
+ var compareLoose = require_compare_loose();
7603
+ var compareBuild = require_compare_build();
7604
+ var sort = require_sort();
7605
+ var rsort = require_rsort();
7606
+ var gt = require_gt();
7607
+ var lt = require_lt();
7608
+ var eq = require_eq();
7609
+ var neq = require_neq();
7610
+ var gte = require_gte();
7611
+ var lte = require_lte();
7612
+ var cmp = require_cmp();
7613
+ var coerce = require_coerce();
7614
+ var truncate2 = require_truncate();
7615
+ var Comparator = require_comparator();
7616
+ var Range = require_range();
7617
+ var satisfies = require_satisfies();
7618
+ var toComparators = require_to_comparators();
7619
+ var maxSatisfying = require_max_satisfying();
7620
+ var minSatisfying = require_min_satisfying();
7621
+ var minVersion = require_min_version();
7622
+ var validRange = require_valid2();
7623
+ var outside = require_outside();
7624
+ var gtr = require_gtr();
7625
+ var ltr = require_ltr();
7626
+ var intersects = require_intersects();
7627
+ var simplifyRange = require_simplify();
7628
+ var subset = require_subset();
7629
+ module2.exports = {
7630
+ parse: parse5,
7631
+ valid,
7632
+ clean,
7633
+ inc,
7634
+ diff,
7635
+ major,
7636
+ minor,
7637
+ patch,
7638
+ prerelease,
7639
+ compare,
7640
+ rcompare,
7641
+ compareLoose,
7642
+ compareBuild,
7643
+ sort,
7644
+ rsort,
7645
+ gt,
7646
+ lt,
7647
+ eq,
7648
+ neq,
7649
+ gte,
7650
+ lte,
7651
+ cmp,
7652
+ coerce,
7653
+ truncate: truncate2,
7654
+ Comparator,
7655
+ Range,
7656
+ satisfies,
7657
+ toComparators,
7658
+ maxSatisfying,
7659
+ minSatisfying,
7660
+ minVersion,
7661
+ validRange,
7662
+ outside,
7663
+ gtr,
7664
+ ltr,
7665
+ intersects,
7666
+ simplifyRange,
7667
+ subset,
7668
+ SemVer,
7669
+ re: internalRe.re,
7670
+ src: internalRe.src,
7671
+ tokens: internalRe.t,
7672
+ SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
7673
+ RELEASE_TYPES: constants.RELEASE_TYPES,
7674
+ compareIdentifiers: identifiers.compareIdentifiers,
7675
+ rcompareIdentifiers: identifiers.rcompareIdentifiers
7676
+ };
7677
+ }
7678
+ });
7679
+
5707
7680
  // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js
5708
7681
  var require_polyfills = __commonJS({
5709
7682
  "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js"(exports2, module2) {
5710
7683
  var constants = require("constants");
5711
7684
  var origCwd = process.cwd;
5712
7685
  var cwd = null;
5713
- var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
7686
+ var platform2 = process.env.GRACEFUL_FS_PLATFORM || process.platform;
5714
7687
  process.cwd = function() {
5715
7688
  if (!cwd)
5716
7689
  cwd = origCwd.call(process);
@@ -5756,20 +7729,20 @@ var require_polyfills = __commonJS({
5756
7729
  fs6.fstatSync = statFixSync(fs6.fstatSync);
5757
7730
  fs6.lstatSync = statFixSync(fs6.lstatSync);
5758
7731
  if (fs6.chmod && !fs6.lchmod) {
5759
- fs6.lchmod = function(path14, mode, cb) {
7732
+ fs6.lchmod = function(path15, mode, cb) {
5760
7733
  if (cb) process.nextTick(cb);
5761
7734
  };
5762
7735
  fs6.lchmodSync = function() {
5763
7736
  };
5764
7737
  }
5765
7738
  if (fs6.chown && !fs6.lchown) {
5766
- fs6.lchown = function(path14, uid, gid, cb) {
7739
+ fs6.lchown = function(path15, uid, gid, cb) {
5767
7740
  if (cb) process.nextTick(cb);
5768
7741
  };
5769
7742
  fs6.lchownSync = function() {
5770
7743
  };
5771
7744
  }
5772
- if (platform === "win32") {
7745
+ if (platform2 === "win32") {
5773
7746
  fs6.rename = typeof fs6.rename !== "function" ? fs6.rename : function(fs$rename) {
5774
7747
  function rename(from, to, cb) {
5775
7748
  var start = Date.now();
@@ -5830,9 +7803,9 @@ var require_polyfills = __commonJS({
5830
7803
  };
5831
7804
  }(fs6.readSync);
5832
7805
  function patchLchmod(fs7) {
5833
- fs7.lchmod = function(path14, mode, callback) {
7806
+ fs7.lchmod = function(path15, mode, callback) {
5834
7807
  fs7.open(
5835
- path14,
7808
+ path15,
5836
7809
  constants.O_WRONLY | constants.O_SYMLINK,
5837
7810
  mode,
5838
7811
  function(err, fd) {
@@ -5848,8 +7821,8 @@ var require_polyfills = __commonJS({
5848
7821
  }
5849
7822
  );
5850
7823
  };
5851
- fs7.lchmodSync = function(path14, mode) {
5852
- var fd = fs7.openSync(path14, constants.O_WRONLY | constants.O_SYMLINK, mode);
7824
+ fs7.lchmodSync = function(path15, mode) {
7825
+ var fd = fs7.openSync(path15, constants.O_WRONLY | constants.O_SYMLINK, mode);
5853
7826
  var threw = true;
5854
7827
  var ret;
5855
7828
  try {
@@ -5870,8 +7843,8 @@ var require_polyfills = __commonJS({
5870
7843
  }
5871
7844
  function patchLutimes(fs7) {
5872
7845
  if (constants.hasOwnProperty("O_SYMLINK") && fs7.futimes) {
5873
- fs7.lutimes = function(path14, at, mt, cb) {
5874
- fs7.open(path14, constants.O_SYMLINK, function(er, fd) {
7846
+ fs7.lutimes = function(path15, at, mt, cb) {
7847
+ fs7.open(path15, constants.O_SYMLINK, function(er, fd) {
5875
7848
  if (er) {
5876
7849
  if (cb) cb(er);
5877
7850
  return;
@@ -5883,8 +7856,8 @@ var require_polyfills = __commonJS({
5883
7856
  });
5884
7857
  });
5885
7858
  };
5886
- fs7.lutimesSync = function(path14, at, mt) {
5887
- var fd = fs7.openSync(path14, constants.O_SYMLINK);
7859
+ fs7.lutimesSync = function(path15, at, mt) {
7860
+ var fd = fs7.openSync(path15, constants.O_SYMLINK);
5888
7861
  var ret;
5889
7862
  var threw = true;
5890
7863
  try {
@@ -6002,11 +7975,11 @@ var require_legacy_streams = __commonJS({
6002
7975
  ReadStream,
6003
7976
  WriteStream
6004
7977
  };
6005
- function ReadStream(path14, options) {
6006
- if (!(this instanceof ReadStream)) return new ReadStream(path14, options);
7978
+ function ReadStream(path15, options) {
7979
+ if (!(this instanceof ReadStream)) return new ReadStream(path15, options);
6007
7980
  Stream.call(this);
6008
7981
  var self = this;
6009
- this.path = path14;
7982
+ this.path = path15;
6010
7983
  this.fd = null;
6011
7984
  this.readable = true;
6012
7985
  this.paused = false;
@@ -6051,10 +8024,10 @@ var require_legacy_streams = __commonJS({
6051
8024
  self._read();
6052
8025
  });
6053
8026
  }
6054
- function WriteStream(path14, options) {
6055
- if (!(this instanceof WriteStream)) return new WriteStream(path14, options);
8027
+ function WriteStream(path15, options) {
8028
+ if (!(this instanceof WriteStream)) return new WriteStream(path15, options);
6056
8029
  Stream.call(this);
6057
- this.path = path14;
8030
+ this.path = path15;
6058
8031
  this.fd = null;
6059
8032
  this.writable = true;
6060
8033
  this.flags = "w";
@@ -6197,14 +8170,14 @@ var require_graceful_fs = __commonJS({
6197
8170
  fs7.createWriteStream = createWriteStream;
6198
8171
  var fs$readFile = fs7.readFile;
6199
8172
  fs7.readFile = readFile2;
6200
- function readFile2(path14, options, cb) {
8173
+ function readFile2(path15, options, cb) {
6201
8174
  if (typeof options === "function")
6202
8175
  cb = options, options = null;
6203
- return go$readFile(path14, options, cb);
6204
- function go$readFile(path15, options2, cb2, startTime) {
6205
- return fs$readFile(path15, options2, function(err) {
8176
+ return go$readFile(path15, options, cb);
8177
+ function go$readFile(path16, options2, cb2, startTime) {
8178
+ return fs$readFile(path16, options2, function(err) {
6206
8179
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
6207
- enqueue([go$readFile, [path15, options2, cb2], err, startTime || Date.now(), Date.now()]);
8180
+ enqueue([go$readFile, [path16, options2, cb2], err, startTime || Date.now(), Date.now()]);
6208
8181
  else {
6209
8182
  if (typeof cb2 === "function")
6210
8183
  cb2.apply(this, arguments);
@@ -6214,14 +8187,14 @@ var require_graceful_fs = __commonJS({
6214
8187
  }
6215
8188
  var fs$writeFile = fs7.writeFile;
6216
8189
  fs7.writeFile = writeFile;
6217
- function writeFile(path14, data, options, cb) {
8190
+ function writeFile(path15, data, options, cb) {
6218
8191
  if (typeof options === "function")
6219
8192
  cb = options, options = null;
6220
- return go$writeFile(path14, data, options, cb);
6221
- function go$writeFile(path15, data2, options2, cb2, startTime) {
6222
- return fs$writeFile(path15, data2, options2, function(err) {
8193
+ return go$writeFile(path15, data, options, cb);
8194
+ function go$writeFile(path16, data2, options2, cb2, startTime) {
8195
+ return fs$writeFile(path16, data2, options2, function(err) {
6223
8196
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
6224
- enqueue([go$writeFile, [path15, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
8197
+ enqueue([go$writeFile, [path16, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
6225
8198
  else {
6226
8199
  if (typeof cb2 === "function")
6227
8200
  cb2.apply(this, arguments);
@@ -6232,14 +8205,14 @@ var require_graceful_fs = __commonJS({
6232
8205
  var fs$appendFile = fs7.appendFile;
6233
8206
  if (fs$appendFile)
6234
8207
  fs7.appendFile = appendFile;
6235
- function appendFile(path14, data, options, cb) {
8208
+ function appendFile(path15, data, options, cb) {
6236
8209
  if (typeof options === "function")
6237
8210
  cb = options, options = null;
6238
- return go$appendFile(path14, data, options, cb);
6239
- function go$appendFile(path15, data2, options2, cb2, startTime) {
6240
- return fs$appendFile(path15, data2, options2, function(err) {
8211
+ return go$appendFile(path15, data, options, cb);
8212
+ function go$appendFile(path16, data2, options2, cb2, startTime) {
8213
+ return fs$appendFile(path16, data2, options2, function(err) {
6241
8214
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
6242
- enqueue([go$appendFile, [path15, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
8215
+ enqueue([go$appendFile, [path16, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
6243
8216
  else {
6244
8217
  if (typeof cb2 === "function")
6245
8218
  cb2.apply(this, arguments);
@@ -6270,31 +8243,31 @@ var require_graceful_fs = __commonJS({
6270
8243
  var fs$readdir = fs7.readdir;
6271
8244
  fs7.readdir = readdir;
6272
8245
  var noReaddirOptionVersions = /^v[0-5]\./;
6273
- function readdir(path14, options, cb) {
8246
+ function readdir(path15, options, cb) {
6274
8247
  if (typeof options === "function")
6275
8248
  cb = options, options = null;
6276
- var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path15, options2, cb2, startTime) {
6277
- return fs$readdir(path15, fs$readdirCallback(
6278
- path15,
8249
+ var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path16, options2, cb2, startTime) {
8250
+ return fs$readdir(path16, fs$readdirCallback(
8251
+ path16,
6279
8252
  options2,
6280
8253
  cb2,
6281
8254
  startTime
6282
8255
  ));
6283
- } : function go$readdir2(path15, options2, cb2, startTime) {
6284
- return fs$readdir(path15, options2, fs$readdirCallback(
6285
- path15,
8256
+ } : function go$readdir2(path16, options2, cb2, startTime) {
8257
+ return fs$readdir(path16, options2, fs$readdirCallback(
8258
+ path16,
6286
8259
  options2,
6287
8260
  cb2,
6288
8261
  startTime
6289
8262
  ));
6290
8263
  };
6291
- return go$readdir(path14, options, cb);
6292
- function fs$readdirCallback(path15, options2, cb2, startTime) {
8264
+ return go$readdir(path15, options, cb);
8265
+ function fs$readdirCallback(path16, options2, cb2, startTime) {
6293
8266
  return function(err, files) {
6294
8267
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
6295
8268
  enqueue([
6296
8269
  go$readdir,
6297
- [path15, options2, cb2],
8270
+ [path16, options2, cb2],
6298
8271
  err,
6299
8272
  startTime || Date.now(),
6300
8273
  Date.now()
@@ -6365,7 +8338,7 @@ var require_graceful_fs = __commonJS({
6365
8338
  enumerable: true,
6366
8339
  configurable: true
6367
8340
  });
6368
- function ReadStream(path14, options) {
8341
+ function ReadStream(path15, options) {
6369
8342
  if (this instanceof ReadStream)
6370
8343
  return fs$ReadStream.apply(this, arguments), this;
6371
8344
  else
@@ -6385,7 +8358,7 @@ var require_graceful_fs = __commonJS({
6385
8358
  }
6386
8359
  });
6387
8360
  }
6388
- function WriteStream(path14, options) {
8361
+ function WriteStream(path15, options) {
6389
8362
  if (this instanceof WriteStream)
6390
8363
  return fs$WriteStream.apply(this, arguments), this;
6391
8364
  else
@@ -6403,22 +8376,22 @@ var require_graceful_fs = __commonJS({
6403
8376
  }
6404
8377
  });
6405
8378
  }
6406
- function createReadStream(path14, options) {
6407
- return new fs7.ReadStream(path14, options);
8379
+ function createReadStream(path15, options) {
8380
+ return new fs7.ReadStream(path15, options);
6408
8381
  }
6409
- function createWriteStream(path14, options) {
6410
- return new fs7.WriteStream(path14, options);
8382
+ function createWriteStream(path15, options) {
8383
+ return new fs7.WriteStream(path15, options);
6411
8384
  }
6412
8385
  var fs$open = fs7.open;
6413
8386
  fs7.open = open;
6414
- function open(path14, flags, mode, cb) {
8387
+ function open(path15, flags, mode, cb) {
6415
8388
  if (typeof mode === "function")
6416
8389
  cb = mode, mode = null;
6417
- return go$open(path14, flags, mode, cb);
6418
- function go$open(path15, flags2, mode2, cb2, startTime) {
6419
- return fs$open(path15, flags2, mode2, function(err, fd) {
8390
+ return go$open(path15, flags, mode, cb);
8391
+ function go$open(path16, flags2, mode2, cb2, startTime) {
8392
+ return fs$open(path16, flags2, mode2, function(err, fd) {
6420
8393
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
6421
- enqueue([go$open, [path15, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
8394
+ enqueue([go$open, [path16, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
6422
8395
  else {
6423
8396
  if (typeof cb2 === "function")
6424
8397
  cb2.apply(this, arguments);
@@ -6947,7 +8920,7 @@ var require_mtime_precision = __commonJS({
6947
8920
  var require_lockfile = __commonJS({
6948
8921
  "../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/lockfile.js"(exports2, module2) {
6949
8922
  "use strict";
6950
- var path14 = require("path");
8923
+ var path15 = require("path");
6951
8924
  var fs6 = require_graceful_fs();
6952
8925
  var retry = require_retry2();
6953
8926
  var onExit = require_signal_exit();
@@ -6958,7 +8931,7 @@ var require_lockfile = __commonJS({
6958
8931
  }
6959
8932
  function resolveCanonicalPath(file2, options, callback) {
6960
8933
  if (!options.realpath) {
6961
- return callback(null, path14.resolve(file2));
8934
+ return callback(null, path15.resolve(file2));
6962
8935
  }
6963
8936
  options.fs.realpath(file2, callback);
6964
8937
  }
@@ -8822,10 +10795,10 @@ var require_segments = __commonJS({
8822
10795
  const segs = getSegmentsFromString(data, Utils.isKanjiModeEnabled());
8823
10796
  const nodes = buildNodes(segs);
8824
10797
  const graph = buildGraph(nodes, version2);
8825
- const path14 = dijkstra.find_path(graph.map, "start", "end");
10798
+ const path15 = dijkstra.find_path(graph.map, "start", "end");
8826
10799
  const optimizedSegs = [];
8827
- for (let i = 1; i < path14.length - 1; i++) {
8828
- optimizedSegs.push(graph.table[path14[i]].node);
10800
+ for (let i = 1; i < path15.length - 1; i++) {
10801
+ optimizedSegs.push(graph.table[path15[i]].node);
8829
10802
  }
8830
10803
  return exports2.fromArray(mergeSegments(optimizedSegs));
8831
10804
  };
@@ -9507,7 +11480,7 @@ var require_filter_parse_async = __commonJS({
9507
11480
  });
9508
11481
 
9509
11482
  // ../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/constants.js
9510
- var require_constants2 = __commonJS({
11483
+ var require_constants3 = __commonJS({
9511
11484
  "../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/constants.js"(exports2, module2) {
9512
11485
  "use strict";
9513
11486
  module2.exports = {
@@ -9585,7 +11558,7 @@ var require_crc = __commonJS({
9585
11558
  var require_parser2 = __commonJS({
9586
11559
  "../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/parser.js"(exports2, module2) {
9587
11560
  "use strict";
9588
- var constants = require_constants2();
11561
+ var constants = require_constants3();
9589
11562
  var CrcCalculator = require_crc();
9590
11563
  var Parser = module2.exports = function(options, dependencies) {
9591
11564
  this._options = options;
@@ -10261,7 +12234,7 @@ var require_parser_async = __commonJS({
10261
12234
  var require_bitpacker = __commonJS({
10262
12235
  "../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/bitpacker.js"(exports2, module2) {
10263
12236
  "use strict";
10264
- var constants = require_constants2();
12237
+ var constants = require_constants3();
10265
12238
  module2.exports = function(dataIn, width, height, options) {
10266
12239
  let outHasAlpha = [constants.COLORTYPE_COLOR_ALPHA, constants.COLORTYPE_ALPHA].indexOf(
10267
12240
  options.colorType
@@ -10553,7 +12526,7 @@ var require_filter_pack = __commonJS({
10553
12526
  var require_packer = __commonJS({
10554
12527
  "../../node_modules/.pnpm/pngjs@5.0.0/node_modules/pngjs/lib/packer.js"(exports2, module2) {
10555
12528
  "use strict";
10556
- var constants = require_constants2();
12529
+ var constants = require_constants3();
10557
12530
  var CrcStream = require_crc();
10558
12531
  var bitPacker = require_bitpacker();
10559
12532
  var filter = require_filter_pack();
@@ -10655,7 +12628,7 @@ var require_packer_async = __commonJS({
10655
12628
  "use strict";
10656
12629
  var util = require("util");
10657
12630
  var Stream = require("stream");
10658
- var constants = require_constants2();
12631
+ var constants = require_constants3();
10659
12632
  var Packer = require_packer();
10660
12633
  var PackerAsync = module2.exports = function(opt) {
10661
12634
  Stream.call(this);
@@ -10990,7 +12963,7 @@ var require_packer_sync = __commonJS({
10990
12963
  if (!zlib.deflateSync) {
10991
12964
  hasSyncZlib = false;
10992
12965
  }
10993
- var constants = require_constants2();
12966
+ var constants = require_constants3();
10994
12967
  var Packer = require_packer();
10995
12968
  module2.exports = function(metaData, opt) {
10996
12969
  if (!hasSyncZlib) {
@@ -11302,7 +13275,7 @@ var require_png2 = __commonJS({
11302
13275
  });
11303
13276
  png.pack();
11304
13277
  };
11305
- exports2.renderToFile = function renderToFile(path14, qrData, options, cb) {
13278
+ exports2.renderToFile = function renderToFile(path15, qrData, options, cb) {
11306
13279
  if (typeof cb === "undefined") {
11307
13280
  cb = options;
11308
13281
  options = void 0;
@@ -11313,7 +13286,7 @@ var require_png2 = __commonJS({
11313
13286
  called = true;
11314
13287
  cb.apply(null, args);
11315
13288
  };
11316
- const stream = fs6.createWriteStream(path14);
13289
+ const stream = fs6.createWriteStream(path15);
11317
13290
  stream.on("error", done);
11318
13291
  stream.on("close", done);
11319
13292
  exports2.renderToFileStream(stream, qrData, options);
@@ -11375,14 +13348,14 @@ var require_utf8 = __commonJS({
11375
13348
  }
11376
13349
  return output3;
11377
13350
  };
11378
- exports2.renderToFile = function renderToFile(path14, qrData, options, cb) {
13351
+ exports2.renderToFile = function renderToFile(path15, qrData, options, cb) {
11379
13352
  if (typeof cb === "undefined") {
11380
13353
  cb = options;
11381
13354
  options = void 0;
11382
13355
  }
11383
13356
  const fs6 = require("fs");
11384
13357
  const utf8 = exports2.render(qrData, options);
11385
- fs6.writeFile(path14, utf8, cb);
13358
+ fs6.writeFile(path15, utf8, cb);
11386
13359
  };
11387
13360
  }
11388
13361
  });
@@ -11503,7 +13476,7 @@ var require_svg_tag = __commonJS({
11503
13476
  return str;
11504
13477
  }
11505
13478
  function qrToPath(data, size, margin) {
11506
- let path14 = "";
13479
+ let path15 = "";
11507
13480
  let moveBy = 0;
11508
13481
  let newRow = false;
11509
13482
  let lineLength = 0;
@@ -11514,19 +13487,19 @@ var require_svg_tag = __commonJS({
11514
13487
  if (data[i]) {
11515
13488
  lineLength++;
11516
13489
  if (!(i > 0 && col > 0 && data[i - 1])) {
11517
- path14 += newRow ? svgCmd("M", col + margin, 0.5 + row + margin) : svgCmd("m", moveBy, 0);
13490
+ path15 += newRow ? svgCmd("M", col + margin, 0.5 + row + margin) : svgCmd("m", moveBy, 0);
11518
13491
  moveBy = 0;
11519
13492
  newRow = false;
11520
13493
  }
11521
13494
  if (!(col + 1 < size && data[i + 1])) {
11522
- path14 += svgCmd("h", lineLength);
13495
+ path15 += svgCmd("h", lineLength);
11523
13496
  lineLength = 0;
11524
13497
  }
11525
13498
  } else {
11526
13499
  moveBy++;
11527
13500
  }
11528
13501
  }
11529
- return path14;
13502
+ return path15;
11530
13503
  }
11531
13504
  exports2.render = function render(qrData, options, cb) {
11532
13505
  const opts = Utils.getOptions(options);
@@ -11534,10 +13507,10 @@ var require_svg_tag = __commonJS({
11534
13507
  const data = qrData.modules.data;
11535
13508
  const qrcodesize = size + opts.margin * 2;
11536
13509
  const bg = !opts.color.light.a ? "" : "<path " + getColorAttrib(opts.color.light, "fill") + ' d="M0 0h' + qrcodesize + "v" + qrcodesize + 'H0z"/>';
11537
- const path14 = "<path " + getColorAttrib(opts.color.dark, "stroke") + ' d="' + qrToPath(data, size, opts.margin) + '"/>';
13510
+ const path15 = "<path " + getColorAttrib(opts.color.dark, "stroke") + ' d="' + qrToPath(data, size, opts.margin) + '"/>';
11538
13511
  const viewBox = 'viewBox="0 0 ' + qrcodesize + " " + qrcodesize + '"';
11539
13512
  const width = !opts.width ? "" : 'width="' + opts.width + '" height="' + opts.width + '" ';
11540
- const svgTag = '<svg xmlns="http://www.w3.org/2000/svg" ' + width + viewBox + ' shape-rendering="crispEdges">' + bg + path14 + "</svg>\n";
13513
+ const svgTag = '<svg xmlns="http://www.w3.org/2000/svg" ' + width + viewBox + ' shape-rendering="crispEdges">' + bg + path15 + "</svg>\n";
11541
13514
  if (typeof cb === "function") {
11542
13515
  cb(null, svgTag);
11543
13516
  }
@@ -11551,7 +13524,7 @@ var require_svg = __commonJS({
11551
13524
  "../../node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/svg.js"(exports2) {
11552
13525
  var svgTagRenderer = require_svg_tag();
11553
13526
  exports2.render = svgTagRenderer.render;
11554
- exports2.renderToFile = function renderToFile(path14, qrData, options, cb) {
13527
+ exports2.renderToFile = function renderToFile(path15, qrData, options, cb) {
11555
13528
  if (typeof cb === "undefined") {
11556
13529
  cb = options;
11557
13530
  options = void 0;
@@ -11559,7 +13532,7 @@ var require_svg = __commonJS({
11559
13532
  const fs6 = require("fs");
11560
13533
  const svgTag = exports2.render(qrData, options);
11561
13534
  const xmlStr = '<?xml version="1.0" encoding="utf-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">' + svgTag;
11562
- fs6.writeFile(path14, xmlStr, cb);
13535
+ fs6.writeFile(path15, xmlStr, cb);
11563
13536
  };
11564
13537
  }
11565
13538
  });
@@ -11717,8 +13690,8 @@ var require_server = __commonJS({
11717
13690
  cb
11718
13691
  };
11719
13692
  }
11720
- function getTypeFromFilename(path14) {
11721
- return path14.slice((path14.lastIndexOf(".") - 1 >>> 0) + 2).toLowerCase();
13693
+ function getTypeFromFilename(path15) {
13694
+ return path15.slice((path15.lastIndexOf(".") - 1 >>> 0) + 2).toLowerCase();
11722
13695
  }
11723
13696
  function getRendererFromType(type) {
11724
13697
  switch (type) {
@@ -11782,17 +13755,17 @@ var require_server = __commonJS({
11782
13755
  const renderer = getRendererFromType(params.opts.type);
11783
13756
  return render(renderer.renderToBuffer, text, params);
11784
13757
  };
11785
- exports2.toFile = function toFile(path14, text, opts, cb) {
11786
- if (typeof path14 !== "string" || !(typeof text === "string" || typeof text === "object")) {
13758
+ exports2.toFile = function toFile(path15, text, opts, cb) {
13759
+ if (typeof path15 !== "string" || !(typeof text === "string" || typeof text === "object")) {
11787
13760
  throw new Error("Invalid argument");
11788
13761
  }
11789
13762
  if (arguments.length < 3 && !canPromise()) {
11790
13763
  throw new Error("Too few arguments provided");
11791
13764
  }
11792
13765
  const params = checkParams(text, opts, cb);
11793
- const type = params.opts.type || getTypeFromFilename(path14);
13766
+ const type = params.opts.type || getTypeFromFilename(path15);
11794
13767
  const renderer = getRendererFromType(type);
11795
- const renderToFile = renderer.renderToFile.bind(null, path14);
13768
+ const renderToFile = renderer.renderToFile.bind(null, path15);
11796
13769
  return render(renderToFile, text, params);
11797
13770
  };
11798
13771
  exports2.toFileStream = function toFileStream(stream, text, opts) {
@@ -15010,8 +16983,8 @@ var require_utils3 = __commonJS({
15010
16983
  }
15011
16984
  return ind;
15012
16985
  }
15013
- function removeDotSegments(path14) {
15014
- let input = path14;
16986
+ function removeDotSegments(path15) {
16987
+ let input = path15;
15015
16988
  const output3 = [];
15016
16989
  let nextSlash = -1;
15017
16990
  let len = 0;
@@ -15263,8 +17236,8 @@ var require_schemes = __commonJS({
15263
17236
  wsComponent.secure = void 0;
15264
17237
  }
15265
17238
  if (wsComponent.resourceName) {
15266
- const [path14, query] = wsComponent.resourceName.split("?");
15267
- wsComponent.path = path14 && path14 !== "/" ? path14 : void 0;
17239
+ const [path15, query] = wsComponent.resourceName.split("?");
17240
+ wsComponent.path = path15 && path15 !== "/" ? path15 : void 0;
15268
17241
  wsComponent.query = query;
15269
17242
  wsComponent.resourceName = void 0;
15270
17243
  }
@@ -18671,11 +20644,11 @@ var require_dist = __commonJS({
18671
20644
  });
18672
20645
 
18673
20646
  // src/bin.ts
18674
- var import_node_path19 = __toESM(require("node:path"), 1);
18675
- var import_node_child_process7 = require("node:child_process");
18676
- var import_node_fs14 = require("node:fs");
18677
- var import_node_os11 = require("node:os");
18678
20647
  var import_node_path20 = __toESM(require("node:path"), 1);
20648
+ var import_node_child_process8 = require("node:child_process");
20649
+ var import_node_fs16 = require("node:fs");
20650
+ var import_node_os12 = require("node:os");
20651
+ var import_node_path21 = __toESM(require("node:path"), 1);
18679
20652
 
18680
20653
  // src/install-codex.ts
18681
20654
  var import_promises = __toESM(require("node:fs/promises"), 1);
@@ -18847,12 +20820,12 @@ ${block}`;
18847
20820
  }
18848
20821
 
18849
20822
  // src/director-bridge.ts
18850
- var import_node_fs10 = __toESM(require("node:fs"), 1);
20823
+ var import_node_fs12 = __toESM(require("node:fs"), 1);
18851
20824
  var import_node_http = __toESM(require("node:http"), 1);
18852
- var import_node_os7 = __toESM(require("node:os"), 1);
18853
- var import_node_path11 = __toESM(require("node:path"), 1);
18854
- var import_node_child_process3 = require("node:child_process");
18855
- var import_node_crypto4 = __toESM(require("node:crypto"), 1);
20825
+ var import_node_os8 = __toESM(require("node:os"), 1);
20826
+ var import_node_path12 = __toESM(require("node:path"), 1);
20827
+ var import_node_child_process4 = require("node:child_process");
20828
+ var import_node_crypto5 = __toESM(require("node:crypto"), 1);
18856
20829
 
18857
20830
  // ../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/wrapper.mjs
18858
20831
  var import_stream = __toESM(require_stream(), 1);
@@ -19312,7 +21285,7 @@ function compactSpecMarkdown(markdown, totalBudget, projectSlug, specWikiPageId)
19312
21285
  if (/^#{1,6}\s/.test(line)) {
19313
21286
  sections.push({ heading: line, body: [] });
19314
21287
  } else {
19315
- sections[sections.length - 1].body.push(line);
21288
+ sections[sections.length - 1]?.body.push(line);
19316
21289
  }
19317
21290
  }
19318
21291
  const sectionCount = Math.max(1, sections.length);
@@ -20161,10 +22134,10 @@ function mergeDefs(...defs) {
20161
22134
  function cloneDef(schema) {
20162
22135
  return mergeDefs(schema._zod.def);
20163
22136
  }
20164
- function getElementAtPath(obj, path14) {
20165
- if (!path14)
22137
+ function getElementAtPath(obj, path15) {
22138
+ if (!path15)
20166
22139
  return obj;
20167
- return path14.reduce((acc, key) => acc?.[key], obj);
22140
+ return path15.reduce((acc, key) => acc?.[key], obj);
20168
22141
  }
20169
22142
  function promiseAllObject(promisesObj) {
20170
22143
  const keys = Object.keys(promisesObj);
@@ -20573,11 +22546,11 @@ function explicitlyAborted(x, startIndex = 0) {
20573
22546
  }
20574
22547
  return false;
20575
22548
  }
20576
- function prefixIssues(path14, issues) {
22549
+ function prefixIssues(path15, issues) {
20577
22550
  return issues.map((iss) => {
20578
22551
  var _a3;
20579
22552
  (_a3 = iss).path ?? (_a3.path = []);
20580
- iss.path.unshift(path14);
22553
+ iss.path.unshift(path15);
20581
22554
  return iss;
20582
22555
  });
20583
22556
  }
@@ -20724,16 +22697,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
20724
22697
  }
20725
22698
  function formatError(error51, mapper = (issue2) => issue2.message) {
20726
22699
  const fieldErrors = { _errors: [] };
20727
- const processError = (error52, path14 = []) => {
22700
+ const processError = (error52, path15 = []) => {
20728
22701
  for (const issue2 of error52.issues) {
20729
22702
  if (issue2.code === "invalid_union" && issue2.errors.length) {
20730
- issue2.errors.map((issues) => processError({ issues }, [...path14, ...issue2.path]));
22703
+ issue2.errors.map((issues) => processError({ issues }, [...path15, ...issue2.path]));
20731
22704
  } else if (issue2.code === "invalid_key") {
20732
- processError({ issues: issue2.issues }, [...path14, ...issue2.path]);
22705
+ processError({ issues: issue2.issues }, [...path15, ...issue2.path]);
20733
22706
  } else if (issue2.code === "invalid_element") {
20734
- processError({ issues: issue2.issues }, [...path14, ...issue2.path]);
22707
+ processError({ issues: issue2.issues }, [...path15, ...issue2.path]);
20735
22708
  } else {
20736
- const fullpath = [...path14, ...issue2.path];
22709
+ const fullpath = [...path15, ...issue2.path];
20737
22710
  if (fullpath.length === 0) {
20738
22711
  fieldErrors._errors.push(mapper(issue2));
20739
22712
  } else {
@@ -20760,17 +22733,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
20760
22733
  }
20761
22734
  function treeifyError(error51, mapper = (issue2) => issue2.message) {
20762
22735
  const result = { errors: [] };
20763
- const processError = (error52, path14 = []) => {
22736
+ const processError = (error52, path15 = []) => {
20764
22737
  var _a3, _b;
20765
22738
  for (const issue2 of error52.issues) {
20766
22739
  if (issue2.code === "invalid_union" && issue2.errors.length) {
20767
- issue2.errors.map((issues) => processError({ issues }, [...path14, ...issue2.path]));
22740
+ issue2.errors.map((issues) => processError({ issues }, [...path15, ...issue2.path]));
20768
22741
  } else if (issue2.code === "invalid_key") {
20769
- processError({ issues: issue2.issues }, [...path14, ...issue2.path]);
22742
+ processError({ issues: issue2.issues }, [...path15, ...issue2.path]);
20770
22743
  } else if (issue2.code === "invalid_element") {
20771
- processError({ issues: issue2.issues }, [...path14, ...issue2.path]);
22744
+ processError({ issues: issue2.issues }, [...path15, ...issue2.path]);
20772
22745
  } else {
20773
- const fullpath = [...path14, ...issue2.path];
22746
+ const fullpath = [...path15, ...issue2.path];
20774
22747
  if (fullpath.length === 0) {
20775
22748
  result.errors.push(mapper(issue2));
20776
22749
  continue;
@@ -20802,8 +22775,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
20802
22775
  }
20803
22776
  function toDotPath(_path) {
20804
22777
  const segs = [];
20805
- const path14 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
20806
- for (const seg of path14) {
22778
+ const path15 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
22779
+ for (const seg of path15) {
20807
22780
  if (typeof seg === "number")
20808
22781
  segs.push(`[${seg}]`);
20809
22782
  else if (typeof seg === "symbol")
@@ -33495,13 +35468,13 @@ function resolveRef(ref, ctx) {
33495
35468
  if (!ref.startsWith("#")) {
33496
35469
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
33497
35470
  }
33498
- const path14 = ref.slice(1).split("/").filter(Boolean);
33499
- if (path14.length === 0) {
35471
+ const path15 = ref.slice(1).split("/").filter(Boolean);
35472
+ if (path15.length === 0) {
33500
35473
  return ctx.rootSchema;
33501
35474
  }
33502
35475
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
33503
- if (path14[0] === defsKey) {
33504
- const key = path14[1];
35476
+ if (path15[0] === defsKey) {
35477
+ const key = path15[1];
33505
35478
  if (!key || !ctx.defs[key]) {
33506
35479
  throw new Error(`Reference not found: ${ref}`);
33507
35480
  }
@@ -34901,7 +36874,15 @@ var executionRunIdParamSchema = external_exports.object({
34901
36874
  });
34902
36875
  var executionRunListFiltersSchema = external_exports.object({
34903
36876
  taskId: mrrlinTaskIdSchema.optional(),
34904
- status: mrrlinExecutionRunStatusSchema.optional()
36877
+ status: mrrlinExecutionRunStatusSchema.optional(),
36878
+ // Wire format is CSV (`statusIn=running,self_review`) so it survives the
36879
+ // single-value URLSearchParams shape used by appendQuery. Empty CSV / empty
36880
+ // array short-circuits to no rows at the DB layer.
36881
+ statusIn: external_exports.preprocess((value) => {
36882
+ if (typeof value === "string")
36883
+ return value.split(",").map((v) => v.trim()).filter((v) => v.length > 0);
36884
+ return value;
36885
+ }, external_exports.array(mrrlinExecutionRunStatusSchema)).optional()
34905
36886
  });
34906
36887
  var mrrlinProjectSchedulerPolicySchema = external_exports.object({
34907
36888
  cadenceSeconds: external_exports.number().int().positive().nullable(),
@@ -35127,18 +37108,18 @@ function createMrrlinClient(config2) {
35127
37108
  const customFetch = config2.fetch ?? globalThis.fetch;
35128
37109
  const baseUrl = config2.baseUrl.replace(/\/$/, "");
35129
37110
  const token = config2.token;
35130
- async function request(path14, init) {
37111
+ async function request(path15, init) {
35131
37112
  const method = init?.method ?? "GET";
35132
37113
  const headers = new Headers(init?.headers ?? {});
35133
37114
  if (token && !headers.has("authorization")) {
35134
37115
  headers.set("authorization", `Bearer ${token}`);
35135
37116
  }
35136
- const response = await customFetch(`${baseUrl}${path14}`, { ...init, headers });
37117
+ const response = await customFetch(`${baseUrl}${path15}`, { ...init, headers });
35137
37118
  if (!response.ok) {
35138
37119
  const body = await response.text();
35139
37120
  let code = `HTTP_${response.status}`;
35140
37121
  let violations = null;
35141
- let message = `Mrrlin API ${method} ${path14} failed: ${response.status}`;
37122
+ let message = `Mrrlin API ${method} ${path15} failed: ${response.status}`;
35142
37123
  try {
35143
37124
  const parsed = JSON.parse(body);
35144
37125
  const violationsParsed = apiViolationsErrorSchema.safeParse(parsed);
@@ -35158,7 +37139,7 @@ function createMrrlinClient(config2) {
35158
37139
  throw new MrrlinApiError({
35159
37140
  code,
35160
37141
  method,
35161
- path: path14,
37142
+ path: path15,
35162
37143
  responseBody: body,
35163
37144
  status: response.status,
35164
37145
  violations,
@@ -35405,7 +37386,7 @@ function createMrrlinClient(config2) {
35405
37386
  return taskEventListResponseSchema.parse(body).data;
35406
37387
  },
35407
37388
  async listTasks(projectSlug, filters = {}) {
35408
- const path14 = appendQuery(`${projectPath(projectSlug)}/tasks`, {
37389
+ const path15 = appendQuery(`${projectPath(projectSlug)}/tasks`, {
35409
37390
  assignee: filters.assignee,
35410
37391
  autonomyLevel: filters.autonomyLevel,
35411
37392
  blockedBy: filters.blockedBy,
@@ -35417,7 +37398,7 @@ function createMrrlinClient(config2) {
35417
37398
  subcategory: filters.subcategory,
35418
37399
  type: filters.type
35419
37400
  });
35420
- const body = await request(path14);
37401
+ const body = await request(path15);
35421
37402
  return taskListResponseSchema.parse(body).data;
35422
37403
  },
35423
37404
  async listTaxonomy(projectSlug) {
@@ -35425,22 +37406,22 @@ function createMrrlinClient(config2) {
35425
37406
  return taxonomyListResponseSchema.parse(body).data;
35426
37407
  },
35427
37408
  async listWikiPages(projectSlug, filters = {}) {
35428
- const path14 = appendQuery(`${projectPath(projectSlug)}/wiki`, {
37409
+ const path15 = appendQuery(`${projectPath(projectSlug)}/wiki`, {
35429
37410
  folder: filters.folder,
35430
37411
  q: filters.q,
35431
37412
  taskId: filters.taskId
35432
37413
  });
35433
- const body = await request(path14);
37414
+ const body = await request(path15);
35434
37415
  return wikiPageListResponseSchema.parse(body).data;
35435
37416
  },
35436
37417
  async searchWikiPages(projectSlug, query) {
35437
- const path14 = appendQuery(`${projectPath(projectSlug)}/wiki/search`, {
37418
+ const path15 = appendQuery(`${projectPath(projectSlug)}/wiki/search`, {
35438
37419
  folder: query.folder,
35439
37420
  limit: query.limit === void 0 ? void 0 : String(query.limit),
35440
37421
  pathPrefix: query.pathPrefix,
35441
37422
  q: query.q
35442
37423
  });
35443
- const body = await request(path14);
37424
+ const body = await request(path15);
35444
37425
  return wikiPageSearchResponseSchema.parse(body).data;
35445
37426
  },
35446
37427
  async updatePlan(projectSlug, planId, patch) {
@@ -35499,7 +37480,10 @@ function createMrrlinClient(config2) {
35499
37480
  async listExecutionRuns(projectSlug, filters = {}) {
35500
37481
  const url2 = appendQuery(`${projectPath(projectSlug)}/execution-runs`, {
35501
37482
  taskId: filters.taskId,
35502
- status: filters.status
37483
+ status: filters.status,
37484
+ // Wire format mirrors the server-side preprocess in
37485
+ // executionRunListFiltersSchema (CSV → array).
37486
+ statusIn: filters.statusIn && filters.statusIn.length > 0 ? filters.statusIn.join(",") : void 0
35503
37487
  });
35504
37488
  const body = await request(url2);
35505
37489
  return executionRunListResponseSchema.parse(body).data;
@@ -35898,18 +37882,256 @@ function createServiceHealth() {
35898
37882
  // src/turn-lock.ts
35899
37883
  function createTurnLock() {
35900
37884
  let tail2 = Promise.resolve();
37885
+ let active = 0;
35901
37886
  return {
35902
37887
  runExclusive(fn) {
37888
+ active += 1;
35903
37889
  const run2 = tail2.then(() => fn());
35904
37890
  tail2 = run2.then(
35905
37891
  () => void 0,
35906
37892
  () => void 0
35907
37893
  );
37894
+ run2.then(
37895
+ () => {
37896
+ active -= 1;
37897
+ },
37898
+ () => {
37899
+ active -= 1;
37900
+ }
37901
+ );
35908
37902
  return run2;
35909
- }
37903
+ },
37904
+ activeCount: () => active
35910
37905
  };
35911
37906
  }
35912
37907
 
37908
+ // src/self-update.ts
37909
+ var import_node_crypto = require("node:crypto");
37910
+ var import_node_fs = require("node:fs");
37911
+ var import_semver = __toESM(require_semver2(), 1);
37912
+ var DEFAULT_INTERVAL_MS = 15 * 60 * 1e3;
37913
+ var DEFAULT_IDLE_MS = 2e3;
37914
+ var DEFAULT_REGISTRY_POLL_MS = 6 * 60 * 60 * 1e3;
37915
+ var DEFAULT_STARTUP_JITTER_MS = 30 * 1e3;
37916
+ var DEFAULT_COOLDOWN_MS = 48 * 60 * 60 * 1e3;
37917
+ var REGISTRY_URL_DEFAULT = "https://registry.npmjs.org/@mrrlin-dev/mcp/latest";
37918
+ var STRICT_SEMVER = /^\d+\.\d+\.\d+(-[A-Za-z0-9.-]+)?(\+[A-Za-z0-9.-]+)?$/;
37919
+ function isDisabled() {
37920
+ return process.env.MRRLIN_DIRECTOR_BRIDGE_SELF_UPDATE === "0";
37921
+ }
37922
+ function readIntervalEnv(name, fallback) {
37923
+ const raw = process.env[name];
37924
+ if (!raw) return fallback;
37925
+ const n = Number.parseInt(raw, 10);
37926
+ return Number.isFinite(n) && n > 0 ? n : fallback;
37927
+ }
37928
+ function sha256(buf) {
37929
+ return (0, import_node_crypto.createHash)("sha256").update(buf).digest("hex");
37930
+ }
37931
+ function startSelfUpdate(deps) {
37932
+ const log = deps.log ?? (() => {
37933
+ });
37934
+ const readFile2 = deps.readFileSyncImpl ?? ((p) => (0, import_node_fs.readFileSync)(p));
37935
+ const setIntervalFn = deps.setIntervalImpl ?? setInterval;
37936
+ const clearIntervalFn = deps.clearIntervalImpl ?? clearInterval;
37937
+ const intervalMs = deps.intervalMs ?? readIntervalEnv("MRRLIN_DIRECTOR_BRIDGE_SELF_UPDATE_INTERVAL_MS", DEFAULT_INTERVAL_MS);
37938
+ const idleThresholdMs = deps.idleThresholdMs ?? DEFAULT_IDLE_MS;
37939
+ const setTimeoutFn = deps.setTimeoutImpl ?? setTimeout;
37940
+ const clearTimeoutFn = deps.clearTimeoutImpl ?? clearTimeout;
37941
+ const fetchFn = deps.fetchImpl ?? globalThis.fetch;
37942
+ const pkgVersion = deps.pkgVersion ?? "0.0.0";
37943
+ const registryUrl = deps.registryUrl ?? REGISTRY_URL_DEFAULT;
37944
+ const registryPollIntervalMs = deps.registryPollIntervalMs ?? readIntervalEnv("MRRLIN_DIRECTOR_BRIDGE_REGISTRY_POLL_INTERVAL_MS", DEFAULT_REGISTRY_POLL_MS);
37945
+ const startupJitterMs = deps.startupJitterMs ?? DEFAULT_STARTUP_JITTER_MS;
37946
+ const cooldownMs = deps.cooldownMs ?? readIntervalEnv("MRRLIN_DIRECTOR_BRIDGE_UPDATE_COOLDOWN_MS", DEFAULT_COOLDOWN_MS);
37947
+ const nowFn = deps.now ?? (() => Date.now());
37948
+ const disabled = isDisabled();
37949
+ let drainOnQuiet = false;
37950
+ let shutdownCalled = false;
37951
+ let latestVersion = null;
37952
+ let lastUpdateMentionAt = null;
37953
+ function maybeUpdateOffer() {
37954
+ if (disabled) return null;
37955
+ if (latestVersion === null) return null;
37956
+ if (!import_semver.default.gt(latestVersion, pkgVersion)) return null;
37957
+ if (lastUpdateMentionAt !== null && nowFn() - lastUpdateMentionAt < cooldownMs) return null;
37958
+ lastUpdateMentionAt = nowFn();
37959
+ log("info", "bridge.self_update.hint_injected", {
37960
+ version: pkgVersion,
37961
+ latestVersion
37962
+ });
37963
+ return `[bridge:update] An update for @mrrlin-dev/mcp is available: ${pkgVersion} \u2192 ${latestVersion}.
37964
+
37965
+ This turn, at a natural pause, ASK the operator a yes/no question \u2014 e.g. "\u0411\u0430\u0447\u0443 \u0449\u043E bridge \u043D\u0430 ${pkgVersion}, \u043D\u0430 npm \u0443\u0436\u0435 ${latestVersion} \u2014 \u043E\u043D\u043E\u0432\u0438\u0442\u0438 \u0437\u0430\u0440\u0430\u0437? (\u0437\u0430\u043F\u0443\u0449\u0443 \`pnpm install -g @mrrlin-dev/mcp@latest\`)". Do NOT install without explicit confirmation.
37966
+
37967
+ If the operator confirms (yes / \u0442\u0430\u043A / \u0430\u0433\u0430 / etc.): immediately run \`pnpm install -g @mrrlin-dev/mcp@latest\` via your shell tool and report the outcome in chat. After a successful install, the bridge auto-restarts via its self-update loop within a couple of minutes \u2014 you do NOT need to call pm2.
37968
+
37969
+ If the operator declines / says "later": acknowledge briefly and do not bring it up again this turn. The bridge has a cooldown and will re-offer in 48h.
37970
+
37971
+ If the install fails (permission denied, registry pinned, sudo required, network blocked): paste the error verbatim and show the operator the manual command \`pnpm install -g @mrrlin-dev/mcp@latest\` plus a one-line hint about likely cause.
37972
+
37973
+ Do NOT derail the current task \u2014 if the operator has an in-flight question, answer that first; the update offer is a brief aside, not the main subject.`;
37974
+ }
37975
+ let startupBinSha = null;
37976
+ try {
37977
+ startupBinSha = sha256(readFile2(deps.binPath));
37978
+ } catch (e) {
37979
+ log("warn", "bridge.self_update.startup_hash_read_failed", {
37980
+ err: String(e?.message ?? e)
37981
+ });
37982
+ }
37983
+ log("info", "bridge.self_update.startup", {
37984
+ binPath: deps.binPath,
37985
+ startupBinSha: startupBinSha?.slice(0, 12) ?? null,
37986
+ selfUpdateEnabled: !disabled,
37987
+ intervalMs
37988
+ });
37989
+ async function pollRegistry() {
37990
+ try {
37991
+ const controller = new AbortController();
37992
+ const t = setTimeout(() => controller.abort(), 5e3);
37993
+ let res;
37994
+ try {
37995
+ res = await fetchFn(registryUrl, {
37996
+ headers: { Accept: "application/json" },
37997
+ signal: controller.signal
37998
+ });
37999
+ } finally {
38000
+ clearTimeout(t);
38001
+ }
38002
+ if (!res.ok) {
38003
+ log("debug", "bridge.self_update.registry_check_failed", {
38004
+ statusCode: res.status,
38005
+ errorKind: "http"
38006
+ });
38007
+ return;
38008
+ }
38009
+ let body;
38010
+ try {
38011
+ body = await res.json();
38012
+ } catch {
38013
+ log("debug", "bridge.self_update.registry_check_failed", { errorKind: "parse" });
38014
+ return;
38015
+ }
38016
+ const candidate = body?.version;
38017
+ if (typeof candidate !== "string" || !STRICT_SEMVER.test(candidate)) {
38018
+ log("debug", "bridge.self_update.registry_check_failed", { errorKind: "format" });
38019
+ return;
38020
+ }
38021
+ const wasStale = latestVersion ? import_semver.default.gt(latestVersion, pkgVersion) : false;
38022
+ latestVersion = candidate;
38023
+ log("debug", "bridge.self_update.registry_check_ok", { latestVersion: candidate });
38024
+ const nowStale = import_semver.default.gt(candidate, pkgVersion);
38025
+ if (nowStale && !wasStale) {
38026
+ log("info", "bridge.self_update.update_available", {
38027
+ version: pkgVersion,
38028
+ latestVersion: candidate
38029
+ });
38030
+ }
38031
+ } catch {
38032
+ log("debug", "bridge.self_update.registry_check_failed", { errorKind: "network" });
38033
+ }
38034
+ }
38035
+ let registryTimer = null;
38036
+ let startupPollTimer = null;
38037
+ if (!disabled) {
38038
+ startupPollTimer = setTimeoutFn(() => {
38039
+ void pollRegistry();
38040
+ }, startupJitterMs);
38041
+ const st = startupPollTimer;
38042
+ if (st && typeof st.unref === "function") st.unref();
38043
+ registryTimer = setIntervalFn(() => {
38044
+ void pollRegistry();
38045
+ }, registryPollIntervalMs);
38046
+ const rt = registryTimer;
38047
+ if (rt && typeof rt.unref === "function") rt.unref();
38048
+ }
38049
+ let timer = null;
38050
+ if (!disabled) {
38051
+ timer = setIntervalFn(() => {
38052
+ try {
38053
+ if (!startupBinSha) {
38054
+ try {
38055
+ startupBinSha = sha256(readFile2(deps.binPath));
38056
+ } catch {
38057
+ return;
38058
+ }
38059
+ }
38060
+ let currentBinSha;
38061
+ try {
38062
+ currentBinSha = sha256(readFile2(deps.binPath));
38063
+ } catch {
38064
+ return;
38065
+ }
38066
+ if (currentBinSha !== startupBinSha) {
38067
+ if (!drainOnQuiet) {
38068
+ drainOnQuiet = true;
38069
+ log("info", "bridge.self_update.hash_drift_detected", {
38070
+ startupBinSha: startupBinSha.slice(0, 12),
38071
+ currentBinSha: currentBinSha.slice(0, 12)
38072
+ });
38073
+ }
38074
+ }
38075
+ const driftConfirmed = startupBinSha !== null && currentBinSha !== startupBinSha;
38076
+ if (drainOnQuiet && driftConfirmed && !shutdownCalled) {
38077
+ const active = deps.getActiveTurnCount();
38078
+ const idle = deps.getIdleMs();
38079
+ if (active === 0 && idle >= idleThresholdMs) {
38080
+ shutdownCalled = true;
38081
+ log("info", "bridge.self_update.self_exit_for_reload", {});
38082
+ try {
38083
+ deps.shutdown();
38084
+ } catch (e) {
38085
+ log("error", "bridge.self_update.shutdown_threw", {
38086
+ err: String(e?.message ?? e)
38087
+ });
38088
+ }
38089
+ }
38090
+ }
38091
+ } catch (e) {
38092
+ log("error", "bridge.self_update.tick_threw", {
38093
+ err: String(e?.message ?? e)
38094
+ });
38095
+ }
38096
+ }, intervalMs);
38097
+ const t = timer;
38098
+ if (t && typeof t.unref === "function") t.unref();
38099
+ }
38100
+ return {
38101
+ stop: () => {
38102
+ if (timer) {
38103
+ clearIntervalFn(timer);
38104
+ timer = null;
38105
+ }
38106
+ if (registryTimer) {
38107
+ clearIntervalFn(registryTimer);
38108
+ registryTimer = null;
38109
+ }
38110
+ if (startupPollTimer) {
38111
+ clearTimeoutFn(startupPollTimer);
38112
+ startupPollTimer = null;
38113
+ }
38114
+ },
38115
+ requestDrain: () => {
38116
+ if (disabled) {
38117
+ log("warn", "bridge.self_update.signal_ignored_disabled", {});
38118
+ return;
38119
+ }
38120
+ if (!drainOnQuiet) {
38121
+ drainOnQuiet = true;
38122
+ log("info", "bridge.self_update.signal_received", { signal: "SIGUSR2" });
38123
+ }
38124
+ },
38125
+ getDrainOnQuiet: () => drainOnQuiet,
38126
+ getLatestVersion: () => latestVersion,
38127
+ isStale: () => latestVersion !== null && import_semver.default.gt(latestVersion, pkgVersion),
38128
+ maybeUpdateOffer
38129
+ };
38130
+ }
38131
+
38132
+ // src/_generated/version.ts
38133
+ var PKG_VERSION = "0.3.1";
38134
+
35913
38135
  // src/api-base-url.ts
35914
38136
  var DEFAULT_API_BASE_URL = "http://127.0.0.1:8787";
35915
38137
  var STAGING_API_BASE_URL = "https://mrrlin-api-fnnzzz-fnnzzzs-projects.vercel.app";
@@ -35973,7 +38195,7 @@ async function resolveApiBaseUrlDynamic(opts = {}) {
35973
38195
  }
35974
38196
 
35975
38197
  // src/execution-consumer.ts
35976
- var import_node_crypto = __toESM(require("node:crypto"), 1);
38198
+ var import_node_crypto2 = __toESM(require("node:crypto"), 1);
35977
38199
 
35978
38200
  // src/deploy-gate.ts
35979
38201
  var DEFAULT_DEPLOY_POLL_BUDGET_SECONDS = 1200;
@@ -36138,18 +38360,18 @@ async function awaitTurnWithDeadline(opts) {
36138
38360
 
36139
38361
  // src/worktree.ts
36140
38362
  var import_node_child_process2 = require("node:child_process");
36141
- var import_node_fs2 = require("node:fs");
38363
+ var import_node_fs3 = require("node:fs");
36142
38364
  var import_node_os2 = require("node:os");
36143
38365
  var import_node_path3 = require("node:path");
36144
38366
 
36145
38367
  // src/checkout-lock.ts
36146
- var import_node_fs = require("node:fs");
38368
+ var import_node_fs2 = require("node:fs");
36147
38369
  var import_node_path2 = require("node:path");
36148
38370
  var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
36149
38371
  async function withCheckoutLock(locksDir, slug, fn) {
36150
- (0, import_node_fs.mkdirSync)(locksDir, { recursive: true });
38372
+ (0, import_node_fs2.mkdirSync)(locksDir, { recursive: true });
36151
38373
  const target = (0, import_node_path2.join)(locksDir, `${slug}.lock`);
36152
- if (!(0, import_node_fs.existsSync)(target)) (0, import_node_fs.writeFileSync)(target, "");
38374
+ if (!(0, import_node_fs2.existsSync)(target)) (0, import_node_fs2.writeFileSync)(target, "");
36153
38375
  const release = await import_proper_lockfile.default.lock(target, {
36154
38376
  retries: { retries: 600, factor: 1, minTimeout: 100, maxTimeout: 100 },
36155
38377
  stale: 5 * 6e4
@@ -36176,10 +38398,10 @@ function git(checkout, args) {
36176
38398
  async function createRunWorktree(opts) {
36177
38399
  const worktreePath = (0, import_node_path3.join)(opts.worktreeRoot, opts.slug, opts.runId);
36178
38400
  await withCheckoutLock(opts.locksDir, opts.slug, async () => {
36179
- (0, import_node_fs2.mkdirSync)(opts.worktreeRoot, { recursive: true });
38401
+ (0, import_node_fs3.mkdirSync)(opts.worktreeRoot, { recursive: true });
36180
38402
  try {
36181
38403
  git(opts.checkout, ["fetch", "origin", opts.defaultBranch]);
36182
- if (!(0, import_node_fs2.existsSync)(worktreePath)) {
38404
+ if (!(0, import_node_fs3.existsSync)(worktreePath)) {
36183
38405
  git(opts.checkout, [
36184
38406
  "worktree",
36185
38407
  "add",
@@ -36237,15 +38459,15 @@ async function doPushRunBranch(opts, execGit) {
36237
38459
  if (localConfig.trim()) {
36238
38460
  throw new Error(`push aborted: agent-controlled git config present in worktree: ${localConfig.trim().split("\n")[0]}`);
36239
38461
  }
36240
- const dir = (0, import_node_fs2.mkdtempSync)((0, import_node_path3.join)((0, import_node_os2.tmpdir)(), "mrrlin-push-"));
38462
+ const dir = (0, import_node_fs3.mkdtempSync)((0, import_node_path3.join)((0, import_node_os2.tmpdir)(), "mrrlin-push-"));
36241
38463
  const askpass = (0, import_node_path3.join)(dir, "askpass");
36242
38464
  try {
36243
- (0, import_node_fs2.writeFileSync)(
38465
+ (0, import_node_fs3.writeFileSync)(
36244
38466
  askpass,
36245
38467
  '#!/bin/sh\ncase "$1" in *[Uu]sername*) printf %s "x-access-token" ;; *) printf %s "$MRRLIN_PUSH_TOKEN" ;; esac\n',
36246
38468
  { mode: 320 }
36247
38469
  );
36248
- (0, import_node_fs2.chmodSync)(askpass, 320);
38470
+ (0, import_node_fs3.chmodSync)(askpass, 320);
36249
38471
  execGit(
36250
38472
  [
36251
38473
  "-C",
@@ -36264,7 +38486,7 @@ async function doPushRunBranch(opts, execGit) {
36264
38486
  );
36265
38487
  return { pushedSha: localSha };
36266
38488
  } finally {
36267
- (0, import_node_fs2.rmSync)(dir, { recursive: true, force: true });
38489
+ (0, import_node_fs3.rmSync)(dir, { recursive: true, force: true });
36268
38490
  }
36269
38491
  }
36270
38492
  async function sweepOrphanWorktrees(opts) {
@@ -36369,7 +38591,7 @@ function isBridgeGeneratedArtifact(artifact) {
36369
38591
  return typeof payload === "object" && payload !== null && "event" in payload;
36370
38592
  }
36371
38593
  function newArtifactId() {
36372
- return `EA-${import_node_crypto.default.randomUUID()}`;
38594
+ return `EA-${import_node_crypto2.default.randomUUID()}`;
36373
38595
  }
36374
38596
  async function gatherContext(client, projectSlug, task, openRunId) {
36375
38597
  const runs = (await client.listExecutionRuns(projectSlug, { taskId: task.id })).sort(
@@ -36500,7 +38722,7 @@ async function driveRun(deps, projectSlug, runId) {
36500
38722
  if (!claimed) return;
36501
38723
  if (!claimed.leaseId) {
36502
38724
  await deps.client.createInboxItem(projectSlug, {
36503
- id: `II-${import_node_crypto.default.randomUUID()}`,
38725
+ id: `II-${import_node_crypto2.default.randomUUID()}`,
36504
38726
  kind: "handoff",
36505
38727
  taskId: claimed.taskId,
36506
38728
  body: `Execution run ${runId} was claimed but returned no leaseId. This indicates DB/API corruption and requires operator attention.`
@@ -36752,7 +38974,7 @@ async function notifyOperatorHandoff(deps, projectSlug, task, runId, reason) {
36752
38974
  }
36753
38975
  try {
36754
38976
  await deps.client.createInboxItem(projectSlug, {
36755
- id: `II-${import_node_crypto.default.randomUUID()}`,
38977
+ id: `II-${import_node_crypto2.default.randomUUID()}`,
36756
38978
  kind: "handoff",
36757
38979
  taskId: task.id,
36758
38980
  body: `Execution run ${runId} for task ${task.id} (${task.title}) needs operator attention: ${reason}`
@@ -36828,7 +39050,7 @@ async function deployGateHandoff(deps, projectSlug, task, runId, reason, leaseId
36828
39050
  }).catch(() => {
36829
39051
  });
36830
39052
  await deps.client.createInboxItem(projectSlug, {
36831
- id: `II-${import_node_crypto.default.randomUUID()}`,
39053
+ id: `II-${import_node_crypto2.default.randomUUID()}`,
36832
39054
  kind: "handoff",
36833
39055
  taskId: task.id,
36834
39056
  body: `Deploy gate for run ${runId} (task ${task.id} \u2014 ${task.title}) needs operator attention: ${reason}`
@@ -36844,7 +39066,7 @@ function claimIntervalMs() {
36844
39066
  }
36845
39067
 
36846
39068
  // src/async-job-consumer.ts
36847
- var import_node_crypto2 = __toESM(require("node:crypto"), 1);
39069
+ var import_node_crypto3 = __toESM(require("node:crypto"), 1);
36848
39070
 
36849
39071
  // src/async-tools/registry.ts
36850
39072
  var registry2 = /* @__PURE__ */ new Map();
@@ -36922,7 +39144,7 @@ async function driveAsyncJob(deps, projectSlug, jobId) {
36922
39144
  });
36923
39145
  const delivery = descriptor2.onComplete(outcome, input);
36924
39146
  await deps.client.createInboxItem(projectSlug, {
36925
- id: `II-${import_node_crypto2.default.randomUUID()}`,
39147
+ id: `II-${import_node_crypto3.default.randomUUID()}`,
36926
39148
  kind: delivery.kind,
36927
39149
  body: delivery.body
36928
39150
  }).catch(() => {
@@ -37038,7 +39260,7 @@ function codexIdleMs() {
37038
39260
  }
37039
39261
 
37040
39262
  // src/operator-token.ts
37041
- var import_node_fs3 = require("node:fs");
39263
+ var import_node_fs4 = require("node:fs");
37042
39264
  var import_node_os3 = __toESM(require("node:os"), 1);
37043
39265
  var import_node_path4 = __toESM(require("node:path"), 1);
37044
39266
  function operatorDir() {
@@ -37050,7 +39272,7 @@ function operatorTokenPath() {
37050
39272
  }
37051
39273
  function readOperatorToken() {
37052
39274
  try {
37053
- const token = (0, import_node_fs3.readFileSync)(operatorTokenPath(), "utf8").trim();
39275
+ const token = (0, import_node_fs4.readFileSync)(operatorTokenPath(), "utf8").trim();
37054
39276
  return token.length > 0 ? token : null;
37055
39277
  } catch {
37056
39278
  return null;
@@ -37058,8 +39280,8 @@ function readOperatorToken() {
37058
39280
  }
37059
39281
  function persistOperatorToken(token) {
37060
39282
  const dir = operatorDir();
37061
- (0, import_node_fs3.mkdirSync)(dir, { recursive: true, mode: 448 });
37062
- (0, import_node_fs3.writeFileSync)(operatorTokenPath(), `${token.trim()}
39283
+ (0, import_node_fs4.mkdirSync)(dir, { recursive: true, mode: 448 });
39284
+ (0, import_node_fs4.writeFileSync)(operatorTokenPath(), `${token.trim()}
37063
39285
  `, { encoding: "utf8", mode: 384 });
37064
39286
  }
37065
39287
  function agentCredentialPath() {
@@ -37067,15 +39289,15 @@ function agentCredentialPath() {
37067
39289
  }
37068
39290
  function persistAgentSecret(secret) {
37069
39291
  const dir = operatorDir();
37070
- (0, import_node_fs3.mkdirSync)(dir, { recursive: true, mode: 448 });
37071
- (0, import_node_fs3.writeFileSync)(agentCredentialPath(), `${secret.trim()}
39292
+ (0, import_node_fs4.mkdirSync)(dir, { recursive: true, mode: 448 });
39293
+ (0, import_node_fs4.writeFileSync)(agentCredentialPath(), `${secret.trim()}
37072
39294
  `, { encoding: "utf8", mode: 384 });
37073
39295
  }
37074
39296
  function readAgentSecret() {
37075
39297
  const fromEnv = process.env.MRRLIN_AGENT_SECRET?.trim();
37076
39298
  if (fromEnv) return fromEnv;
37077
39299
  try {
37078
- const raw = (0, import_node_fs3.readFileSync)(agentCredentialPath(), "utf8").trim();
39300
+ const raw = (0, import_node_fs4.readFileSync)(agentCredentialPath(), "utf8").trim();
37079
39301
  return raw || void 0;
37080
39302
  } catch {
37081
39303
  return void 0;
@@ -37083,7 +39305,7 @@ function readAgentSecret() {
37083
39305
  }
37084
39306
 
37085
39307
  // src/thread-index.ts
37086
- var import_node_fs4 = require("node:fs");
39308
+ var import_node_fs5 = require("node:fs");
37087
39309
  var import_node_path5 = __toESM(require("node:path"), 1);
37088
39310
  function threadIndexPath(stateDir) {
37089
39311
  return import_node_path5.default.join(stateDir, "threads.json");
@@ -37092,7 +39314,7 @@ function loadThreadIndex(stateDir, ttlMs, now) {
37092
39314
  const result = /* @__PURE__ */ new Map();
37093
39315
  let parsed;
37094
39316
  try {
37095
- parsed = JSON.parse((0, import_node_fs4.readFileSync)(threadIndexPath(stateDir), "utf8"));
39317
+ parsed = JSON.parse((0, import_node_fs5.readFileSync)(threadIndexPath(stateDir), "utf8"));
37096
39318
  } catch {
37097
39319
  return result;
37098
39320
  }
@@ -37114,8 +39336,8 @@ function loadThreadIndex(stateDir, ttlMs, now) {
37114
39336
  return result;
37115
39337
  }
37116
39338
  function saveThreadIndex(stateDir, entries) {
37117
- (0, import_node_fs4.mkdirSync)(stateDir, { recursive: true, mode: 448 });
37118
- (0, import_node_fs4.writeFileSync)(threadIndexPath(stateDir), `${JSON.stringify(Object.fromEntries(entries), null, 2)}
39339
+ (0, import_node_fs5.mkdirSync)(stateDir, { recursive: true, mode: 448 });
39340
+ (0, import_node_fs5.writeFileSync)(threadIndexPath(stateDir), `${JSON.stringify(Object.fromEntries(entries), null, 2)}
37119
39341
  `, {
37120
39342
  encoding: "utf8",
37121
39343
  mode: 384
@@ -37169,8 +39391,8 @@ function chatTurnMaxMs() {
37169
39391
  }
37170
39392
 
37171
39393
  // src/worker-token.ts
37172
- var import_node_crypto3 = require("node:crypto");
37173
- var import_node_fs5 = require("node:fs");
39394
+ var import_node_crypto4 = require("node:crypto");
39395
+ var import_node_fs6 = require("node:fs");
37174
39396
  var import_node_os4 = __toESM(require("node:os"), 1);
37175
39397
  var import_node_path6 = __toESM(require("node:path"), 1);
37176
39398
  var DEFAULT_WORKER_PORT = 8792;
@@ -37189,7 +39411,7 @@ function workerTokenPath() {
37189
39411
  }
37190
39412
  function readWorkerToken() {
37191
39413
  try {
37192
- const token = (0, import_node_fs5.readFileSync)(workerTokenPath(), "utf8").trim();
39414
+ const token = (0, import_node_fs6.readFileSync)(workerTokenPath(), "utf8").trim();
37193
39415
  return token.length > 0 ? token : null;
37194
39416
  } catch {
37195
39417
  return null;
@@ -37199,16 +39421,16 @@ function readOrCreateWorkerToken() {
37199
39421
  const existing = readWorkerToken();
37200
39422
  if (existing) return existing;
37201
39423
  const dir = workerDir();
37202
- (0, import_node_fs5.mkdirSync)(dir, { recursive: true, mode: 448 });
37203
- const token = (0, import_node_crypto3.randomBytes)(32).toString("hex");
37204
- (0, import_node_fs5.writeFileSync)(workerTokenPath(), `${token}
39424
+ (0, import_node_fs6.mkdirSync)(dir, { recursive: true, mode: 448 });
39425
+ const token = (0, import_node_crypto4.randomBytes)(32).toString("hex");
39426
+ (0, import_node_fs6.writeFileSync)(workerTokenPath(), `${token}
37205
39427
  `, { encoding: "utf8", mode: 384 });
37206
39428
  return token;
37207
39429
  }
37208
39430
 
37209
39431
  // src/remote-phone-relay.ts
37210
39432
  var import_node_events2 = require("node:events");
37211
- var import_node_fs6 = require("node:fs");
39433
+ var import_node_fs7 = require("node:fs");
37212
39434
  var import_node_os5 = require("node:os");
37213
39435
  var import_node_path7 = require("node:path");
37214
39436
 
@@ -37673,7 +39895,7 @@ var SHA256 = class extends SHA2 {
37673
39895
  this.buffer.fill(0);
37674
39896
  }
37675
39897
  };
37676
- var sha256 = /* @__PURE__ */ wrapConstructor(() => new SHA256());
39898
+ var sha2562 = /* @__PURE__ */ wrapConstructor(() => new SHA256());
37677
39899
 
37678
39900
  // ../../node_modules/.pnpm/@noble+curves@1.3.0/node_modules/@noble/curves/esm/abstract/utils.js
37679
39901
  var _0n = BigInt(0);
@@ -37817,7 +40039,7 @@ function validateObject(object3, validators, optValidators = {}) {
37817
40039
  // ../../packages/director-e2e/dist/verifier.js
37818
40040
  var RELAY_AUTH_LABEL = utf8ToBytes("relay-auth");
37819
40041
  function relayAuth(secret) {
37820
- return hmac(sha256, secret, RELAY_AUTH_LABEL);
40042
+ return hmac(sha2562, secret, RELAY_AUTH_LABEL);
37821
40043
  }
37822
40044
 
37823
40045
  // ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/_u64.js
@@ -39151,16 +41373,16 @@ var hkdf = (hash3, ikm, salt, info, length) => expand(hash3, extract(hash3, ikm,
39151
41373
 
39152
41374
  // ../../packages/director-e2e/dist/kdf.js
39153
41375
  function deriveMasterKey(ikm, salt, info) {
39154
- return hkdf(sha256, ikm, salt, info, 32);
41376
+ return hkdf(sha2562, ikm, salt, info, 32);
39155
41377
  }
39156
41378
  function deriveDirectionKeys(masterKey) {
39157
41379
  return {
39158
- p2a: hkdf(sha256, masterKey, void 0, utf8ToBytes("dir:phone->agent"), 32),
39159
- a2p: hkdf(sha256, masterKey, void 0, utf8ToBytes("dir:agent->phone"), 32)
41380
+ p2a: hkdf(sha2562, masterKey, void 0, utf8ToBytes("dir:phone->agent"), 32),
41381
+ a2p: hkdf(sha2562, masterKey, void 0, utf8ToBytes("dir:agent->phone"), 32)
39160
41382
  };
39161
41383
  }
39162
41384
  function confirmationMac(masterKey, role, transcript) {
39163
- return hmac(sha256, masterKey, concatBytes(utf8ToBytes(`confirm:${role}`), transcript));
41385
+ return hmac(sha2562, masterKey, concatBytes(utf8ToBytes(`confirm:${role}`), transcript));
39164
41386
  }
39165
41387
 
39166
41388
  // ../../node_modules/.pnpm/@noble+ciphers@0.4.1/node_modules/@noble/ciphers/esm/utils.js
@@ -40777,9 +42999,9 @@ var DirectorRelay = class {
40777
42999
 
40778
43000
  // src/remote-phone-relay.ts
40779
43001
  function loadOrCreateAgentDeviceKey() {
40780
- const path14 = (0, import_node_path7.join)((0, import_node_os5.homedir)(), ".mrrlin", "agent-device-key");
43002
+ const path15 = (0, import_node_path7.join)((0, import_node_os5.homedir)(), ".mrrlin", "agent-device-key");
40781
43003
  try {
40782
- const raw = JSON.parse((0, import_node_fs6.readFileSync)(path14, "utf8"));
43004
+ const raw = JSON.parse((0, import_node_fs7.readFileSync)(path15, "utf8"));
40783
43005
  if (typeof raw.priv === "string" && typeof raw.pub === "string") {
40784
43006
  return { privateKey: fromBase64Url(raw.priv), publicKey: fromBase64Url(raw.pub) };
40785
43007
  }
@@ -40787,9 +43009,9 @@ function loadOrCreateAgentDeviceKey() {
40787
43009
  }
40788
43010
  const kp = generateIdentityKeyPair();
40789
43011
  try {
40790
- (0, import_node_fs6.mkdirSync)((0, import_node_path7.join)((0, import_node_os5.homedir)(), ".mrrlin"), { recursive: true });
40791
- (0, import_node_fs6.writeFileSync)(
40792
- path14,
43012
+ (0, import_node_fs7.mkdirSync)((0, import_node_path7.join)((0, import_node_os5.homedir)(), ".mrrlin"), { recursive: true });
43013
+ (0, import_node_fs7.writeFileSync)(
43014
+ path15,
40793
43015
  JSON.stringify({ priv: toBase64Url(kp.privateKey), pub: toBase64Url(kp.publicKey) }),
40794
43016
  { mode: 384 }
40795
43017
  );
@@ -40800,7 +43022,7 @@ function loadOrCreateAgentDeviceKey() {
40800
43022
  var AGENT_PAIRING_PATH = (0, import_node_path7.join)((0, import_node_os5.homedir)(), ".mrrlin", "agent-pairing.json");
40801
43023
  function loadAgentPairing() {
40802
43024
  try {
40803
- const raw = JSON.parse((0, import_node_fs6.readFileSync)(AGENT_PAIRING_PATH, "utf8"));
43025
+ const raw = JSON.parse((0, import_node_fs7.readFileSync)(AGENT_PAIRING_PATH, "utf8"));
40804
43026
  if (typeof raw.channelId === "string" && typeof raw.agentControlSecret === "string" && typeof raw.relayAuth === "string" && typeof raw.peerIdentityKey === "string") {
40805
43027
  return {
40806
43028
  channelId: raw.channelId,
@@ -40815,8 +43037,8 @@ function loadAgentPairing() {
40815
43037
  }
40816
43038
  function saveAgentPairing(record2) {
40817
43039
  try {
40818
- (0, import_node_fs6.mkdirSync)((0, import_node_path7.join)((0, import_node_os5.homedir)(), ".mrrlin"), { recursive: true });
40819
- (0, import_node_fs6.writeFileSync)(AGENT_PAIRING_PATH, JSON.stringify(record2), { mode: 384 });
43040
+ (0, import_node_fs7.mkdirSync)((0, import_node_path7.join)((0, import_node_os5.homedir)(), ".mrrlin"), { recursive: true });
43041
+ (0, import_node_fs7.writeFileSync)(AGENT_PAIRING_PATH, JSON.stringify(record2), { mode: 384 });
40820
43042
  } catch {
40821
43043
  }
40822
43044
  }
@@ -40985,18 +43207,18 @@ async function renderPairingQrSvg(payload) {
40985
43207
  }
40986
43208
 
40987
43209
  // src/checkout-registry.ts
40988
- var import_node_fs7 = require("node:fs");
43210
+ var import_node_fs8 = require("node:fs");
40989
43211
  var import_node_path8 = require("node:path");
40990
43212
  var CheckoutRegistry = class {
40991
43213
  file;
40992
43214
  constructor(stateDir) {
40993
43215
  this.file = (0, import_node_path8.join)(stateDir, "checkouts.json");
40994
- (0, import_node_fs7.mkdirSync)(stateDir, { recursive: true });
43216
+ (0, import_node_fs8.mkdirSync)(stateDir, { recursive: true });
40995
43217
  }
40996
43218
  read() {
40997
- if (!(0, import_node_fs7.existsSync)(this.file)) return {};
43219
+ if (!(0, import_node_fs8.existsSync)(this.file)) return {};
40998
43220
  try {
40999
- return JSON.parse((0, import_node_fs7.readFileSync)(this.file, "utf8"));
43221
+ return JSON.parse((0, import_node_fs8.readFileSync)(this.file, "utf8"));
41000
43222
  } catch {
41001
43223
  return {};
41002
43224
  }
@@ -41004,15 +43226,15 @@ var CheckoutRegistry = class {
41004
43226
  get(slug) {
41005
43227
  return this.read()[slug] ?? null;
41006
43228
  }
41007
- confirm(slug, path14, now) {
43229
+ confirm(slug, path15, now) {
41008
43230
  const all = this.read();
41009
- all[slug] = { path: path14, confirmedAt: now };
41010
- (0, import_node_fs7.writeFileSync)(this.file, JSON.stringify(all, null, 2));
43231
+ all[slug] = { path: path15, confirmedAt: now };
43232
+ (0, import_node_fs8.writeFileSync)(this.file, JSON.stringify(all, null, 2));
41011
43233
  }
41012
43234
  };
41013
43235
 
41014
43236
  // src/executor-server.ts
41015
- var import_node_fs8 = require("node:fs");
43237
+ var import_node_fs9 = require("node:fs");
41016
43238
  var import_node_os6 = require("node:os");
41017
43239
  var import_node_path9 = require("node:path");
41018
43240
  var DENY_READ_GLOBS = [
@@ -41065,7 +43287,7 @@ function isSecretDirectoryPath(p) {
41065
43287
  }
41066
43288
  function writeExecutorCodexHome(scratchDir, opts) {
41067
43289
  const codexHome = (0, import_node_path9.join)(scratchDir, ".codex");
41068
- (0, import_node_fs8.mkdirSync)(codexHome, { recursive: true });
43290
+ (0, import_node_fs9.mkdirSync)(codexHome, { recursive: true });
41069
43291
  const hasEgress = opts.egressDomains.length > 0;
41070
43292
  const networkSection = hasEgress ? [
41071
43293
  "[permissions.executor.network]",
@@ -41100,21 +43322,21 @@ function writeExecutorCodexHome(scratchDir, opts) {
41100
43322
  networkSection,
41101
43323
  ""
41102
43324
  ].join("\n");
41103
- (0, import_node_fs8.writeFileSync)((0, import_node_path9.join)(codexHome, "config.toml"), toml3, "utf8");
43325
+ (0, import_node_fs9.writeFileSync)((0, import_node_path9.join)(codexHome, "config.toml"), toml3, "utf8");
41104
43326
  return codexHome;
41105
43327
  }
41106
43328
  async function startExecutorServer(opts) {
41107
43329
  const egressDomains = opts.egressDomains ?? DEFAULT_EGRESS_DOMAINS;
41108
43330
  const realHome = (0, import_node_os6.homedir)();
41109
43331
  const denySecretPaths = operatorSecretPaths(realHome);
41110
- const scratchDir = (0, import_node_fs8.mkdtempSync)((0, import_node_path9.join)((0, import_node_os6.tmpdir)(), "mrrlin-executor-"));
43332
+ const scratchDir = (0, import_node_fs9.mkdtempSync)((0, import_node_path9.join)((0, import_node_os6.tmpdir)(), "mrrlin-executor-"));
41111
43333
  const scratchHome = scratchDir;
41112
43334
  let scratchCleaned = false;
41113
43335
  const cleanScratch = () => {
41114
43336
  if (scratchCleaned) return;
41115
43337
  scratchCleaned = true;
41116
43338
  try {
41117
- (0, import_node_fs8.rmSync)(scratchDir, { recursive: true, force: true });
43339
+ (0, import_node_fs9.rmSync)(scratchDir, { recursive: true, force: true });
41118
43340
  } catch {
41119
43341
  }
41120
43342
  };
@@ -41305,7 +43527,7 @@ function extractVerificationSection(markdown) {
41305
43527
  }
41306
43528
 
41307
43529
  // src/bridge-log.ts
41308
- var import_node_fs9 = require("node:fs");
43530
+ var import_node_fs10 = require("node:fs");
41309
43531
  var import_node_path10 = require("node:path");
41310
43532
 
41311
43533
  // src/redact.ts
@@ -41344,8 +43566,8 @@ var IMAGE_DATA_URI_RE = /^(data:image\/[a-zA-Z0-9.+-]+;base64,)([A-Za-z0-9+/=]+)
41344
43566
  function redactImageDataUri(value) {
41345
43567
  const m = value.match(IMAGE_DATA_URI_RE);
41346
43568
  if (!m) return value;
41347
- const prefix = m[1];
41348
- const body = m[2];
43569
+ const [, prefix, body] = m;
43570
+ if (prefix === void 0 || body === void 0) return value;
41349
43571
  return `${prefix}\u2026(${body.length} bytes)`;
41350
43572
  }
41351
43573
  function redactValue(value, depth) {
@@ -41393,7 +43615,7 @@ function createBridgeLogger(stateDir, env = process.env) {
41393
43615
  if (!resolveBridgeLogEnabled(env)) return NOOP_LOGGER;
41394
43616
  const logsDir = (0, import_node_path10.join)(stateDir, "logs");
41395
43617
  try {
41396
- (0, import_node_fs9.mkdirSync)(logsDir, { recursive: true });
43618
+ (0, import_node_fs10.mkdirSync)(logsDir, { recursive: true });
41397
43619
  } catch {
41398
43620
  return NOOP_LOGGER;
41399
43621
  }
@@ -41410,7 +43632,7 @@ function createBridgeLogger(stateDir, env = process.env) {
41410
43632
  ...rec.ms !== void 0 ? { ms: rec.ms } : {},
41411
43633
  payload: redactMessage(rec.payload, { includePrompts })
41412
43634
  }) + "\n";
41413
- (0, import_node_fs9.appendFileSync)(fileFor(), line);
43635
+ (0, import_node_fs10.appendFileSync)(fileFor(), line);
41414
43636
  } catch {
41415
43637
  }
41416
43638
  };
@@ -41422,6 +43644,271 @@ function createBridgeLogger(stateDir, env = process.env) {
41422
43644
  };
41423
43645
  }
41424
43646
 
43647
+ // src/issue-report.ts
43648
+ var import_node_fs11 = require("node:fs");
43649
+ var import_node_os7 = require("node:os");
43650
+ var import_node_path11 = __toESM(require("node:path"), 1);
43651
+ var import_node_child_process3 = require("node:child_process");
43652
+ function summarizeTranscript(entries = []) {
43653
+ const normalized = entries.map((entry) => ({
43654
+ kind: entry.kind,
43655
+ content: squashWhitespace(entry.content)
43656
+ })).filter((entry) => entry.content.length > 0);
43657
+ if (normalized.length <= 20) return normalized;
43658
+ return normalized.slice(normalized.length - 20);
43659
+ }
43660
+ function squashWhitespace(value) {
43661
+ return value.replace(/\s+/g, " ").trim();
43662
+ }
43663
+ function clip(value, maxChars) {
43664
+ if (value.length <= maxChars) return value;
43665
+ return `${value.slice(0, Math.max(0, maxChars - 1))}\u2026`;
43666
+ }
43667
+ function firstSentence(value) {
43668
+ const trimmed = squashWhitespace(value);
43669
+ if (!trimmed) return "";
43670
+ const match = trimmed.match(/^(.{1,120}?[.!?])(?:\s|$)/);
43671
+ return match?.[1] ? squashWhitespace(match[1]) : clip(trimmed, 120);
43672
+ }
43673
+ function describePayload(payload) {
43674
+ if (typeof payload === "string") return payload;
43675
+ try {
43676
+ return JSON.stringify(payload);
43677
+ } catch {
43678
+ return String(payload);
43679
+ }
43680
+ }
43681
+ function resolveLogDir() {
43682
+ const codexHome = process.env.CODEX_HOME?.trim();
43683
+ if (codexHome) {
43684
+ const candidate = import_node_path11.default.join(codexHome, "mrrlin", "director-bridge", "logs");
43685
+ if (existsDir(candidate)) return candidate;
43686
+ }
43687
+ const fallback = import_node_path11.default.join((0, import_node_os7.homedir)(), ".mrrlin", "director-bridge", "logs");
43688
+ return fallback;
43689
+ }
43690
+ function existsDir(candidate) {
43691
+ try {
43692
+ return (0, import_node_fs11.statSync)(candidate).isDirectory();
43693
+ } catch {
43694
+ return false;
43695
+ }
43696
+ }
43697
+ function listRecentLogFiles(logDir) {
43698
+ if (!existsDir(logDir)) return [];
43699
+ return (0, import_node_fs11.readdirSync)(logDir).filter((name) => /^bridge-\d{4}-\d{2}-\d{2}\.jsonl$/.test(name)).sort((a, b) => b.localeCompare(a)).slice(0, 3).map((name) => import_node_path11.default.join(logDir, name));
43700
+ }
43701
+ function parseLogFile(file2) {
43702
+ const lines2 = (0, import_node_fs11.readFileSync)(file2, "utf8").split(/\r?\n/).filter(Boolean);
43703
+ const parsed = [];
43704
+ for (const rawLine of lines2) {
43705
+ try {
43706
+ const raw = JSON.parse(rawLine);
43707
+ if (typeof raw.ts !== "string" || typeof raw.type !== "string" || typeof raw.spanId !== "string") continue;
43708
+ parsed.push({
43709
+ ts: raw.ts,
43710
+ dir: raw.dir === "in" ? "in" : "out",
43711
+ spanId: raw.spanId,
43712
+ sessionId: typeof raw.sessionId === "string" ? raw.sessionId : null,
43713
+ type: raw.type,
43714
+ ms: typeof raw.ms === "number" ? raw.ms : void 0,
43715
+ payload: raw.payload,
43716
+ rawLine,
43717
+ file: file2
43718
+ });
43719
+ } catch {
43720
+ }
43721
+ }
43722
+ return parsed;
43723
+ }
43724
+ function looksLikeError(record2) {
43725
+ if (record2.type === "error" || record2.type === "<parse-error>") return true;
43726
+ const text = `${record2.type} ${describePayload(record2.payload)}`.toLowerCase();
43727
+ return /(^|[^a-z])(error|failed|failure|timed out|timeout|unauthorized|forbidden|invalid|closed before returning a reply)([^a-z]|$)/.test(
43728
+ text
43729
+ );
43730
+ }
43731
+ function buildKeywordSet(input) {
43732
+ return Array.from(
43733
+ new Set(
43734
+ input.toLowerCase().split(/[^a-z0-9_:-]+/).map((part) => part.trim()).filter((part) => part.length >= 4)
43735
+ )
43736
+ ).slice(0, 8);
43737
+ }
43738
+ function pickCluster(records, index) {
43739
+ const from = Math.max(0, index - 10);
43740
+ const to = Math.min(records.length, index + 31);
43741
+ return records.slice(from, to);
43742
+ }
43743
+ function findRelevantLogWindow(request, opts = {}) {
43744
+ const logDir = opts.logDir ?? resolveLogDir();
43745
+ const files = listRecentLogFiles(logDir);
43746
+ if (files.length === 0) {
43747
+ return { strategy: "no-log", matchedOn: "(log directory missing or empty)", records: [], file: null };
43748
+ }
43749
+ const allRecords = files.flatMap((file2) => parseLogFile(file2));
43750
+ if (allRecords.length === 0) {
43751
+ return { strategy: "no-log", matchedOn: "(no readable JSONL records)", records: [], file: files[0] ?? null };
43752
+ }
43753
+ const directorSessionId = request.directorSessionId?.trim() || "";
43754
+ if (directorSessionId) {
43755
+ const sessionRecords = allRecords.filter((record2) => record2.sessionId === directorSessionId);
43756
+ if (sessionRecords.length > 0) {
43757
+ for (let index = sessionRecords.length - 1; index >= 0; index -= 1) {
43758
+ const record2 = sessionRecords[index];
43759
+ if (!record2 || !looksLikeError(record2)) continue;
43760
+ const cluster = pickCluster(sessionRecords, index);
43761
+ return {
43762
+ strategy: "session-error-cluster",
43763
+ matchedOn: clip(record2.rawLine, 160),
43764
+ records: cluster,
43765
+ file: record2.file
43766
+ };
43767
+ }
43768
+ return {
43769
+ strategy: "session-tail",
43770
+ matchedOn: `directorSessionId=${directorSessionId}`,
43771
+ records: sessionRecords.slice(Math.max(0, sessionRecords.length - 30)),
43772
+ file: sessionRecords.at(-1)?.file ?? null
43773
+ };
43774
+ }
43775
+ }
43776
+ const description = request.customerDescription.trim();
43777
+ const keywords = buildKeywordSet(description);
43778
+ if (keywords.length > 0) {
43779
+ for (let index = allRecords.length - 1; index >= 0; index -= 1) {
43780
+ const record2 = allRecords[index];
43781
+ if (!record2) continue;
43782
+ const haystack = `${record2.type} ${describePayload(record2.payload)}`.toLowerCase();
43783
+ if (!keywords.some((keyword) => haystack.includes(keyword))) continue;
43784
+ return {
43785
+ strategy: "hint-cluster",
43786
+ matchedOn: clip(record2.rawLine, 160),
43787
+ records: pickCluster(allRecords, index),
43788
+ file: record2.file
43789
+ };
43790
+ }
43791
+ }
43792
+ for (let index = allRecords.length - 1; index >= 0; index -= 1) {
43793
+ const record2 = allRecords[index];
43794
+ if (!record2 || !looksLikeError(record2)) continue;
43795
+ return {
43796
+ strategy: "global-error-tail",
43797
+ matchedOn: clip(record2.rawLine, 160),
43798
+ records: pickCluster(allRecords, index),
43799
+ file: record2.file
43800
+ };
43801
+ }
43802
+ const tail2 = allRecords.slice(Math.max(0, allRecords.length - 30));
43803
+ return {
43804
+ strategy: "global-error-tail",
43805
+ matchedOn: "(no error cluster; using global tail)",
43806
+ records: tail2,
43807
+ file: tail2.at(-1)?.file ?? null
43808
+ };
43809
+ }
43810
+ function formatTranscript(entries) {
43811
+ if (entries.length === 0) return "(no transcript context)";
43812
+ return entries.map((entry) => `- ${entry.kind}: ${clip(redact(entry.content), 400)}`).join("\n");
43813
+ }
43814
+ function formatLogWindow(window) {
43815
+ if (window.records.length === 0) return "(no relevant bridge log lines found)";
43816
+ const preferred = window.records.filter((record2) => looksLikeError(record2)).concat(window.records.filter((record2) => !looksLikeError(record2)));
43817
+ const unique = preferred.filter((record2, index, array2) => array2.findIndex((item) => item.rawLine === record2.rawLine) === index);
43818
+ return clip(
43819
+ unique.map((record2) => {
43820
+ const payload = clip(redact(describePayload(record2.payload)), 360);
43821
+ return `${record2.ts} ${record2.dir} ${record2.type} span=${record2.spanId}${record2.sessionId ? ` session=${record2.sessionId}` : ""} ${payload}`;
43822
+ }).join("\n"),
43823
+ 5e3
43824
+ );
43825
+ }
43826
+ function titlePrefix(source) {
43827
+ return source === "director-chat" ? "[Director]" : "[Web]";
43828
+ }
43829
+ function buildIssueDraft(request, logWindow) {
43830
+ const customerDescription = clip(redact(request.customerDescription.trim() || "(not provided)"), 4e3);
43831
+ const titleStem = firstSentence(customerDescription) || firstSentence(logWindow.records.find((record2) => looksLikeError(record2))?.rawLine ?? "") || "Issue report";
43832
+ const title = clip(`${titlePrefix(request.source)} ${titleStem}`, 96);
43833
+ const transcript = summarizeTranscript(request.transcript ?? []);
43834
+ const screenshotLines = request.screenshots && request.screenshots.length > 0 ? request.screenshots.map((shot) => `- [${shot.filename}](${shot.url})`).join("\n") : "(no screenshots)";
43835
+ const environment = [
43836
+ `- Created at (UTC): ${(/* @__PURE__ */ new Date()).toISOString()}`,
43837
+ `- Source: ${request.source}`,
43838
+ `- Project: ${request.projectSlug?.trim() || "(unknown)"}`,
43839
+ `- Route: ${request.urlPath?.trim() || "(unknown)"}`,
43840
+ `- Director session: ${request.directorSessionId?.trim() || "(none)"}`,
43841
+ `- @mrrlin-dev/mcp: ${PKG_VERSION}`,
43842
+ `- OS: ${(0, import_node_os7.platform)()}`,
43843
+ `- Node: ${process.version}`
43844
+ ].join("\n");
43845
+ const logLabel = logWindow.file ? import_node_path11.default.basename(logWindow.file) : "(none)";
43846
+ const body = [
43847
+ "## Summary",
43848
+ `${titlePrefix(request.source)} issue report generated from local Mrrlin evidence.`,
43849
+ "",
43850
+ "## Customer report",
43851
+ customerDescription,
43852
+ "",
43853
+ "## Observed behavior",
43854
+ `- Log search strategy: ${logWindow.strategy}`,
43855
+ `- Matched on: ${redact(logWindow.matchedOn)}`,
43856
+ "",
43857
+ "## Director / shell context",
43858
+ environment,
43859
+ "",
43860
+ `## Bridge log excerpt (${logLabel})`,
43861
+ "```text",
43862
+ formatLogWindow(logWindow),
43863
+ "```",
43864
+ "",
43865
+ "## Transcript excerpt",
43866
+ "```text",
43867
+ formatTranscript(transcript),
43868
+ "```",
43869
+ "",
43870
+ "## Screenshots",
43871
+ screenshotLines
43872
+ ].join("\n");
43873
+ return { title, body, labels: ["bug"] };
43874
+ }
43875
+ function ensureGhReady() {
43876
+ const auth = (0, import_node_child_process3.spawnSync)("gh", ["auth", "status", "-h", "github.com"], { encoding: "utf8" });
43877
+ if (auth.status !== 0) {
43878
+ const detail = (auth.stderr || auth.stdout || "gh auth status failed").trim();
43879
+ throw new Error(`GitHub CLI is not ready: ${detail}`);
43880
+ }
43881
+ }
43882
+ function createGithubIssue(draft) {
43883
+ ensureGhReady();
43884
+ const tmpDir = (0, import_node_fs11.mkdtempSync)(import_node_path11.default.join((0, import_node_os7.tmpdir)(), "mrrlin-issue-"));
43885
+ const bodyFile = import_node_path11.default.join(tmpDir, "issue-body.md");
43886
+ try {
43887
+ (0, import_node_fs11.writeFileSync)(bodyFile, draft.body, "utf8");
43888
+ const args = ["issue", "create", "--repo", "fnnzzz/mrrlin", "--title", draft.title, "--body-file", bodyFile];
43889
+ for (const label of draft.labels) args.push("--label", label);
43890
+ const result = (0, import_node_child_process3.spawnSync)("gh", args, { encoding: "utf8" });
43891
+ if (result.status !== 0) {
43892
+ const detail = (result.stderr || result.stdout || "gh issue create failed").trim();
43893
+ throw new Error(detail);
43894
+ }
43895
+ const url2 = (result.stdout || "").trim().split(/\s+/).at(-1) ?? "";
43896
+ if (!/^https?:\/\//.test(url2)) {
43897
+ throw new Error(`Issue created but URL could not be parsed from gh output: ${result.stdout.trim()}`);
43898
+ }
43899
+ const numberMatch = url2.match(/\/issues\/(\d+)$/);
43900
+ return { issueNumber: numberMatch ? Number(numberMatch[1]) : null, url: url2 };
43901
+ } finally {
43902
+ (0, import_node_fs11.rmSync)(tmpDir, { recursive: true, force: true });
43903
+ }
43904
+ }
43905
+ function fileIssueReport(request, opts = {}) {
43906
+ const logWindow = findRelevantLogWindow(request, opts);
43907
+ const draft = buildIssueDraft(request, logWindow);
43908
+ const created = createGithubIssue(draft);
43909
+ return { issueNumber: created.issueNumber, title: draft.title, url: created.url };
43910
+ }
43911
+
41425
43912
  // src/director-bridge.ts
41426
43913
  var DEFAULT_DIRECTOR_BRIDGE_ALLOWED_ORIGINS = [
41427
43914
  "http://localhost:*",
@@ -41443,10 +43930,46 @@ function normalizeModel(value) {
41443
43930
  const trimmed = value.trim();
41444
43931
  return trimmed ? trimmed : null;
41445
43932
  }
43933
+ function normalizeIssueTranscript(value) {
43934
+ if (value === void 0 || value === null) return [];
43935
+ if (!Array.isArray(value)) return { error: "transcript must be an array." };
43936
+ const transcript = [];
43937
+ for (const entry of value.slice(0, 20)) {
43938
+ if (!entry || typeof entry !== "object") return { error: "transcript entries must be objects." };
43939
+ const kind = entry.kind;
43940
+ const content = entry.content;
43941
+ if (kind !== "user" && kind !== "assistant" && kind !== "error" && kind !== "tool") {
43942
+ return { error: "transcript entry kind is invalid." };
43943
+ }
43944
+ if (typeof content !== "string") return { error: "transcript entry content must be a string." };
43945
+ const trimmed = content.trim();
43946
+ if (!trimmed) continue;
43947
+ transcript.push({ kind, content: trimmed });
43948
+ }
43949
+ return transcript;
43950
+ }
43951
+ function normalizeIssueScreenshots(value) {
43952
+ if (value === void 0 || value === null) return [];
43953
+ if (!Array.isArray(value)) return { error: "screenshots must be an array." };
43954
+ const screenshots = [];
43955
+ for (const entry of value.slice(0, 3)) {
43956
+ if (!entry || typeof entry !== "object") return { error: "screenshots entries must be objects." };
43957
+ const filename = entry.filename;
43958
+ const url2 = entry.url;
43959
+ if (typeof filename !== "string" || !filename.trim()) {
43960
+ return { error: "screenshot filename is required." };
43961
+ }
43962
+ if (typeof url2 !== "string" || !/^https?:\/\//.test(url2)) {
43963
+ return { error: "screenshot url must be an absolute http(s) URL." };
43964
+ }
43965
+ screenshots.push({ filename: filename.trim(), url: url2.trim() });
43966
+ }
43967
+ return screenshots;
43968
+ }
41446
43969
  function neutralCheckoutCwd(stateDir) {
41447
- const dir = import_node_path11.default.join(stateDir, "no-checkout");
43970
+ const dir = import_node_path12.default.join(stateDir, "no-checkout");
41448
43971
  try {
41449
- import_node_fs10.default.mkdirSync(dir, { recursive: true });
43972
+ import_node_fs12.default.mkdirSync(dir, { recursive: true });
41450
43973
  } catch {
41451
43974
  }
41452
43975
  return dir;
@@ -41584,6 +44107,7 @@ function tokenRefreshIntervalMs() {
41584
44107
  return seconds * 1e3;
41585
44108
  }
41586
44109
  var COLLECTED_TURN_TIMEOUT_MS = 3e5;
44110
+ var DEFAULT_IMAGE_ONLY_PROMPT = "Look at the attached image.";
41587
44111
  var VERIFICATION_BASE_INSTRUCTIONS = [
41588
44112
  "You are a deployment verification agent. You may ONLY make read-only HTTP requests to the",
41589
44113
  "single allowlisted environment URL to confirm a deploy succeeded. You have NO repository,",
@@ -41637,7 +44161,7 @@ function resolveDefaultBranch(checkoutPath) {
41637
44161
  if (!checkoutPath) return "main";
41638
44162
  const runGit = (args) => {
41639
44163
  try {
41640
- return (0, import_node_child_process3.execFileSync)("git", ["-C", checkoutPath, ...args], {
44164
+ return (0, import_node_child_process4.execFileSync)("git", ["-C", checkoutPath, ...args], {
41641
44165
  encoding: "utf8",
41642
44166
  stdio: ["ignore", "pipe", "ignore"],
41643
44167
  timeout: 15e3,
@@ -41669,7 +44193,7 @@ async function runOrphanWorktreeSweep(client, opts) {
41669
44193
  const cutoff = Date.now() - worktreeRetentionMs();
41670
44194
  const isReapable = (worktreePath) => {
41671
44195
  try {
41672
- return import_node_fs10.default.statSync(worktreePath).mtimeMs < cutoff;
44196
+ return import_node_fs12.default.statSync(worktreePath).mtimeMs < cutoff;
41673
44197
  } catch {
41674
44198
  return false;
41675
44199
  }
@@ -41706,8 +44230,8 @@ async function runOrphanWorktreeSweep(client, opts) {
41706
44230
  }
41707
44231
  }
41708
44232
  function readStateDir() {
41709
- if (process.env.CODEX_HOME) return import_node_path11.default.join(process.env.CODEX_HOME, "mrrlin", "director-bridge");
41710
- return import_node_path11.default.join(import_node_os7.default.homedir(), ".mrrlin", "director-bridge");
44233
+ if (process.env.CODEX_HOME) return import_node_path12.default.join(process.env.CODEX_HOME, "mrrlin", "director-bridge");
44234
+ return import_node_path12.default.join(import_node_os8.default.homedir(), ".mrrlin", "director-bridge");
41711
44235
  }
41712
44236
  function readAllowedOrigins() {
41713
44237
  const raw = (process.env.MRRLIN_DIRECTOR_BRIDGE_ALLOWED_ORIGINS ?? "").trim();
@@ -41782,7 +44306,7 @@ function createBridgeRequestListener(opts) {
41782
44306
  res.end(JSON.stringify({ ok: false, error: "Origin not allowed." }));
41783
44307
  return;
41784
44308
  }
41785
- const nonce = import_node_crypto4.default.randomBytes(16).toString("base64url");
44309
+ const nonce = import_node_crypto5.default.randomBytes(16).toString("base64url");
41786
44310
  res.writeHead(200, { "content-type": "application/json" });
41787
44311
  res.end(JSON.stringify({ ok: true, wsUrl: `ws://${host}:${port}/ws`, token, nonce }));
41788
44312
  return;
@@ -41795,7 +44319,7 @@ function sessionIdOf(msg) {
41795
44319
  return typeof id === "string" ? id : null;
41796
44320
  }
41797
44321
  function attachBridgeWss(server, opts) {
41798
- const { token, allowedOrigins, onReady, logger, onPaired } = opts;
44322
+ const { token, allowedOrigins, onReady, logger, onPaired, selfUpdate } = opts;
41799
44323
  const wss = new import_websocket_server.default({ server, path: "/ws" });
41800
44324
  wss.on("connection", (socket, request) => {
41801
44325
  const origin = request.headers.origin;
@@ -41834,7 +44358,15 @@ function attachBridgeWss(server, opts) {
41834
44358
  })
41835
44359
  );
41836
44360
  }
41837
- send({ type: "ready", bridgeVersion: 1 });
44361
+ send({
44362
+ type: "ready",
44363
+ bridgeVersion: 1,
44364
+ ...selfUpdate ? {
44365
+ version: selfUpdate.version,
44366
+ binSha: selfUpdate.binSha,
44367
+ latestVersion: selfUpdate.getLatestVersion()
44368
+ } : {}
44369
+ });
41838
44370
  onPaired?.();
41839
44371
  onReady?.(socket, request, send, logger ? { logger, span } : void 0);
41840
44372
  });
@@ -41850,7 +44382,7 @@ function createBridgeMessageHandler(deps) {
41850
44382
  boundSessions.clear();
41851
44383
  });
41852
44384
  socket.on("message", async (data) => {
41853
- const spanId = import_node_crypto4.default.randomUUID();
44385
+ const spanId = import_node_crypto5.default.randomUUID();
41854
44386
  if (logCtx) {
41855
44387
  logCtx.span.id = spanId;
41856
44388
  logCtx.span.at = Date.now();
@@ -41938,6 +44470,52 @@ function createBridgeMessageHandler(deps) {
41938
44470
  sendForSpan({ type: "bootstrap", models, rateLimits, ...bootstrapError ? { error: bootstrapError } : {} });
41939
44471
  return;
41940
44472
  }
44473
+ if (msg.type === "report_issue") {
44474
+ if (msg.source !== "director-chat" && msg.source !== "shell-menu") {
44475
+ sendForSpan({ type: "report-issue-result", status: "error", error: "report source is invalid." });
44476
+ return;
44477
+ }
44478
+ const customerDescription = typeof msg.customerDescription === "string" ? msg.customerDescription.trim() : "";
44479
+ if (!customerDescription) {
44480
+ sendForSpan({ type: "report-issue-result", status: "error", error: "customerDescription is required." });
44481
+ return;
44482
+ }
44483
+ const transcript = normalizeIssueTranscript(msg.transcript);
44484
+ if ("error" in transcript) {
44485
+ sendForSpan({ type: "report-issue-result", status: "error", error: transcript.error });
44486
+ return;
44487
+ }
44488
+ const screenshots = normalizeIssueScreenshots(msg.screenshots);
44489
+ if ("error" in screenshots) {
44490
+ sendForSpan({ type: "report-issue-result", status: "error", error: screenshots.error });
44491
+ return;
44492
+ }
44493
+ try {
44494
+ const result = fileIssueReport({
44495
+ source: msg.source,
44496
+ customerDescription,
44497
+ directorSessionId: typeof msg.directorSessionId === "string" ? msg.directorSessionId.trim() || null : null,
44498
+ projectSlug: typeof msg.projectSlug === "string" ? msg.projectSlug.trim() || null : null,
44499
+ urlPath: typeof msg.urlPath === "string" ? msg.urlPath.trim() || null : null,
44500
+ transcript,
44501
+ screenshots
44502
+ });
44503
+ sendForSpan({
44504
+ type: "report-issue-result",
44505
+ status: "ok",
44506
+ issueNumber: result.issueNumber,
44507
+ title: result.title,
44508
+ url: result.url
44509
+ });
44510
+ } catch (error51) {
44511
+ sendForSpan({
44512
+ type: "report-issue-result",
44513
+ status: "error",
44514
+ error: error51 instanceof Error ? error51.message : String(error51)
44515
+ });
44516
+ }
44517
+ return;
44518
+ }
41941
44519
  if (msg.type === "interrupt") {
41942
44520
  const directorSessionId2 = (msg.directorSessionId ?? "").trim();
41943
44521
  const existing = directorSessionId2 ? deps.threads.get(directorSessionId2) : void 0;
@@ -42145,10 +44723,15 @@ function createBridgeMessageHandler(deps) {
42145
44723
  pokeActivity = () => watchdog.poke();
42146
44724
  const runSequence = (async () => {
42147
44725
  const turnInput = [];
42148
- if (inputText.length > 0) {
42149
- const composed = contextPrefix ? `${contextPrefix}
44726
+ const effectiveText = inputText.length > 0 ? inputText : imageDataUri ? DEFAULT_IMAGE_ONLY_PROMPT : "";
44727
+ if (effectiveText.length > 0) {
44728
+ const updateOffer = deps.maybeUpdateOffer ? deps.maybeUpdateOffer() : null;
44729
+ const composedPrefix = updateOffer ? contextPrefix ? `${updateOffer}
42150
44730
 
42151
- ${inputText}` : inputText;
44731
+ ${contextPrefix}` : updateOffer : contextPrefix;
44732
+ const composed = composedPrefix ? `${composedPrefix}
44733
+
44734
+ ${effectiveText}` : effectiveText;
42152
44735
  turnInput.push({ type: "text", text: composed, text_elements: [] });
42153
44736
  }
42154
44737
  if (imageDataUri) {
@@ -42234,9 +44817,59 @@ function parseConfig() {
42234
44817
  const idleThreadTtlMs = Math.max(6e4, readEnvInt("MRRLIN_DIRECTOR_BRIDGE_IDLE_TTL_SECONDS", 1800) * 1e3);
42235
44818
  return { host, port, stateDir, allowedOrigins, token, codexCwd, codexExecutable, idleThreadTtlMs };
42236
44819
  }
44820
+ function scanForOtherBridges() {
44821
+ try {
44822
+ const result = (0, import_node_child_process4.spawnSync)("pgrep", ["-f", "mrrlin-mcp director-bridge"], {
44823
+ encoding: "utf8"
44824
+ });
44825
+ if (result.status !== 0) return [];
44826
+ return result.stdout.trim().split("\n").map((s) => Number.parseInt(s, 10)).filter((n) => Number.isInteger(n) && n !== process.pid);
44827
+ } catch {
44828
+ return [];
44829
+ }
44830
+ }
42237
44831
  async function startDirectorBridge() {
42238
44832
  const config2 = parseConfig();
42239
44833
  const turnLock = createTurnLock();
44834
+ let lastTurnEndedAt = Date.now();
44835
+ const wrappedTurnLock = {
44836
+ runExclusive(fn) {
44837
+ return turnLock.runExclusive(async () => {
44838
+ try {
44839
+ return await fn();
44840
+ } finally {
44841
+ lastTurnEndedAt = Date.now();
44842
+ }
44843
+ });
44844
+ },
44845
+ activeCount: turnLock.activeCount
44846
+ };
44847
+ const shutdownHolder = { fn: null };
44848
+ const selfUpdateHandle = startSelfUpdate({
44849
+ binPath: process.argv[1] ?? "",
44850
+ getActiveTurnCount: () => wrappedTurnLock.activeCount(),
44851
+ getIdleMs: () => Date.now() - lastTurnEndedAt,
44852
+ pkgVersion: PKG_VERSION,
44853
+ shutdown: () => {
44854
+ try {
44855
+ shutdownHolder.fn?.();
44856
+ } catch (e) {
44857
+ process.stderr.write(
44858
+ `[mrrlin-mcp director-bridge] error self_update shutdown threw: ${String(
44859
+ e?.message ?? e
44860
+ )}
44861
+ `
44862
+ );
44863
+ }
44864
+ },
44865
+ log: (level, event, fields) => {
44866
+ const payload = fields ? ` ${JSON.stringify(fields)}` : "";
44867
+ process.stderr.write(
44868
+ `[mrrlin-mcp director-bridge] ${level} ${event}${payload}
44869
+ `
44870
+ );
44871
+ }
44872
+ });
42240
44873
  const consumerState = { inFlightRunId: null, lastClaimAt: null };
42241
44874
  const health = createServiceHealth();
42242
44875
  const apiBaseUrl = readConfiguredApiBaseUrl();
@@ -42312,14 +44945,14 @@ async function startDirectorBridge() {
42312
44945
  // handle returned by acquireExecutorCodex (Fix A + G), so there is no shared
42313
44946
  // mutable `activeExecutorClient` slot to race a concurrent chat/bootstrap turn.
42314
44947
  releaseCodex: () => codexKeepalive.release(),
42315
- runExclusive: turnLock.runExclusive,
44948
+ runExclusive: wrappedTurnLock.runExclusive,
42316
44949
  staleSeconds,
42317
44950
  touchIntervalMs: Math.min(DEFAULT_TOUCH_INTERVAL_MS, Math.floor(staleSeconds * 1e3 / 2)),
42318
44951
  codexCwd: config2.codexCwd,
42319
44952
  codexExecutable: config2.codexExecutable,
42320
44953
  checkoutRegistry,
42321
- worktreeRoot: import_node_path11.default.join(config2.stateDir, "worktrees"),
42322
- locksDir: import_node_path11.default.join(config2.stateDir, "locks"),
44954
+ worktreeRoot: import_node_path12.default.join(config2.stateDir, "worktrees"),
44955
+ locksDir: import_node_path12.default.join(config2.stateDir, "locks"),
42323
44956
  // Wire the profile-enforced executor server for code-execution runs. Each run gets its own
42324
44957
  // sandboxed Codex instance (scrubbed env, scratch CODEX_HOME, deny-read, egress allowlist).
42325
44958
  // The returned handle's dispose() shuts down the spawned app-server CHILD (manager.shutdown(),
@@ -42352,13 +44985,13 @@ async function startDirectorBridge() {
42352
44985
  },
42353
44986
  runVerificationTurn: createRunVerificationTurn({
42354
44987
  startSandbox: async (egressDomains) => {
42355
- const cwd = import_node_fs10.default.mkdtempSync(import_node_path11.default.join(import_node_os7.default.tmpdir(), "mrrlin-verify-"));
44988
+ const cwd = import_node_fs12.default.mkdtempSync(import_node_path12.default.join(import_node_os8.default.tmpdir(), "mrrlin-verify-"));
42356
44989
  let handle;
42357
44990
  try {
42358
44991
  handle = await startExecutorServer({ worktree: cwd, egressDomains });
42359
44992
  } catch (error51) {
42360
44993
  try {
42361
- import_node_fs10.default.rmSync(cwd, { recursive: true, force: true });
44994
+ import_node_fs12.default.rmSync(cwd, { recursive: true, force: true });
42362
44995
  } catch {
42363
44996
  }
42364
44997
  throw error51;
@@ -42369,7 +45002,7 @@ async function startDirectorBridge() {
42369
45002
  dispose: () => {
42370
45003
  handle.dispose();
42371
45004
  try {
42372
- import_node_fs10.default.rmSync(cwd, { recursive: true, force: true });
45005
+ import_node_fs12.default.rmSync(cwd, { recursive: true, force: true });
42373
45006
  } catch {
42374
45007
  }
42375
45008
  }
@@ -42383,7 +45016,7 @@ async function startDirectorBridge() {
42383
45016
  const sessionSinks = createSessionSinkRegistry();
42384
45017
  const asyncConsumerDeps = {
42385
45018
  client,
42386
- runExclusive: turnLock.runExclusive,
45019
+ runExclusive: wrappedTurnLock.runExclusive,
42387
45020
  cwd: config2.codexCwd ?? process.cwd(),
42388
45021
  codexExecutable: config2.codexExecutable,
42389
45022
  staleSeconds,
@@ -42483,7 +45116,7 @@ async function startDirectorBridge() {
42483
45116
  const sharedHandlerDeps = {
42484
45117
  acquireCodex: () => codexKeepalive.acquire(),
42485
45118
  releaseCodex: () => codexKeepalive.release(),
42486
- runExclusive: turnLock.runExclusive,
45119
+ runExclusive: wrappedTurnLock.runExclusive,
42487
45120
  buildStartParams: (msg, desiredModel) => buildThreadStartParams(msg, config2, desiredModel),
42488
45121
  turnInactivity: () => ({ idleMs: chatTurnIdleMs(), maxMs: chatTurnMaxMs() }),
42489
45122
  checkoutRegistry,
@@ -42499,15 +45132,26 @@ async function startDirectorBridge() {
42499
45132
  },
42500
45133
  unbindSessionSink: (directorSessionId, send) => {
42501
45134
  sessionSinks.unbind(directorSessionId, send);
42502
- }
45135
+ },
45136
+ maybeUpdateOffer: () => selfUpdateHandle.maybeUpdateOffer()
42503
45137
  };
42504
45138
  const bridgeLogger = createBridgeLogger(config2.stateDir, process.env);
45139
+ let bridgeBinShaShort = "unknown00000";
45140
+ try {
45141
+ bridgeBinShaShort = import_node_crypto5.default.createHash("sha256").update(import_node_fs12.default.readFileSync(process.argv[1] ?? "")).digest("hex").slice(0, 12);
45142
+ } catch {
45143
+ }
42505
45144
  attachBridgeWss(server, {
42506
45145
  token: config2.token,
42507
45146
  allowedOrigins: config2.allowedOrigins,
42508
45147
  onReady: createBridgeMessageHandler({ ...sharedHandlerDeps, threads, persistThreads }),
42509
45148
  logger: bridgeLogger,
42510
- onPaired: () => health.setPaired(true)
45149
+ onPaired: () => health.setPaired(true),
45150
+ selfUpdate: {
45151
+ version: PKG_VERSION,
45152
+ binSha: bridgeBinShaShort,
45153
+ getLatestVersion: () => selfUpdateHandle.getLatestVersion()
45154
+ }
42511
45155
  });
42512
45156
  if (agentSecret && relayUrl) {
42513
45157
  try {
@@ -42602,8 +45246,8 @@ async function startDirectorBridge() {
42602
45246
  enqueueRun(
42603
45247
  () => runOrphanWorktreeSweep(client, {
42604
45248
  checkoutRegistry,
42605
- worktreeRoot: import_node_path11.default.join(config2.stateDir, "worktrees"),
42606
- locksDir: import_node_path11.default.join(config2.stateDir, "locks")
45249
+ worktreeRoot: import_node_path12.default.join(config2.stateDir, "worktrees"),
45250
+ locksDir: import_node_path12.default.join(config2.stateDir, "locks")
42607
45251
  })
42608
45252
  );
42609
45253
  scheduleClaimLoop();
@@ -42618,10 +45262,34 @@ async function startDirectorBridge() {
42618
45262
  );
42619
45263
  }
42620
45264
  await new Promise((resolve, reject) => {
42621
- server.on("error", reject);
45265
+ server.on("error", (err) => {
45266
+ if (err.code === "EADDRINUSE") {
45267
+ const conflictingPids = scanForOtherBridges();
45268
+ process.stderr.write(
45269
+ `[mrrlin-mcp director-bridge] error bridge.startup.port_in_use ${JSON.stringify({
45270
+ host: config2.host,
45271
+ port: config2.port,
45272
+ conflictingPids
45273
+ })}
45274
+ `
45275
+ );
45276
+ process.exit(1);
45277
+ }
45278
+ reject(err);
45279
+ });
42622
45280
  server.listen(config2.port, config2.host, () => resolve());
42623
45281
  });
42624
- const shutdown = createBridgeShutdown({
45282
+ const orphans = scanForOtherBridges();
45283
+ if (orphans.length > 0) {
45284
+ process.stderr.write(
45285
+ `[mrrlin-mcp director-bridge] warn bridge.startup.zombie_scan ${JSON.stringify({
45286
+ pids: orphans,
45287
+ hint: "run the one-time cleanup from the README to remove them"
45288
+ })}
45289
+ `
45290
+ );
45291
+ }
45292
+ shutdownHolder.fn = createBridgeShutdown({
42625
45293
  closers: [
42626
45294
  () => server.close(),
42627
45295
  () => dispatchServer.close(),
@@ -42632,15 +45300,20 @@ async function startDirectorBridge() {
42632
45300
  claimLoopStopped = true;
42633
45301
  if (claimTimer) clearTimeout(claimTimer);
42634
45302
  },
42635
- () => codexKeepalive.dropNow()
45303
+ () => codexKeepalive.dropNow(),
45304
+ () => selfUpdateHandle.stop()
42636
45305
  ],
42637
45306
  shutdownCodex: () => codexServerManager.shutdown(),
42638
45307
  exit: (code) => process.exit(code),
42639
45308
  log: (message) => process.stderr.write(`${message}
42640
45309
  `)
42641
45310
  });
45311
+ const shutdown = shutdownHolder.fn;
42642
45312
  process.on("SIGTERM", shutdown);
42643
45313
  process.on("SIGINT", shutdown);
45314
+ process.on("SIGUSR2", () => {
45315
+ selfUpdateHandle.requestDrain();
45316
+ });
42644
45317
  process.stderr.write(`[mrrlin-mcp director-bridge] listening on http://${config2.host}:${config2.port} (ws://${config2.host}:${config2.port}/ws)
42645
45318
  `);
42646
45319
  process.stderr.write(`[mrrlin-mcp director-bridge] token: ${config2.token}
@@ -42738,7 +45411,7 @@ function timingSafeTokenEqual(provided, expected) {
42738
45411
  const a = Buffer.from(provided);
42739
45412
  const b = Buffer.from(expected);
42740
45413
  if (a.length !== b.length) return false;
42741
- return import_node_crypto4.default.timingSafeEqual(a, b);
45414
+ return import_node_crypto5.default.timingSafeEqual(a, b);
42742
45415
  }
42743
45416
  function readDispatchBody(req) {
42744
45417
  return new Promise((resolve, reject) => {
@@ -42760,15 +45433,15 @@ function readDispatchBody(req) {
42760
45433
  function readOrCreateBridgeToken(stateDir) {
42761
45434
  const explicit = (process.env.MRRLIN_DIRECTOR_BRIDGE_TOKEN ?? "").trim();
42762
45435
  if (explicit) return explicit;
42763
- const tokenPath = import_node_path11.default.join(stateDir, "token.txt");
45436
+ const tokenPath = import_node_path12.default.join(stateDir, "token.txt");
42764
45437
  try {
42765
- const existing = import_node_fs10.default.readFileSync(tokenPath, "utf8").trim();
45438
+ const existing = import_node_fs12.default.readFileSync(tokenPath, "utf8").trim();
42766
45439
  if (existing) return existing;
42767
45440
  } catch {
42768
45441
  }
42769
- import_node_fs10.default.mkdirSync(stateDir, { recursive: true, mode: 448 });
42770
- const token = import_node_crypto4.default.randomBytes(32).toString("base64url");
42771
- import_node_fs10.default.writeFileSync(tokenPath, `${token}
45442
+ import_node_fs12.default.mkdirSync(stateDir, { recursive: true, mode: 448 });
45443
+ const token = import_node_crypto5.default.randomBytes(32).toString("base64url");
45444
+ import_node_fs12.default.writeFileSync(tokenPath, `${token}
42772
45445
  `, { mode: 384 });
42773
45446
  return token;
42774
45447
  }
@@ -46151,17 +48824,17 @@ var StdioServerTransport = class {
46151
48824
 
46152
48825
  // src/tools.ts
46153
48826
  var import_promises3 = require("node:fs/promises");
46154
- var import_node_fs12 = require("node:fs");
46155
- var import_node_path14 = __toESM(require("node:path"), 1);
46156
- var import_node_os8 = __toESM(require("node:os"), 1);
46157
- var import_node_child_process6 = require("node:child_process");
48827
+ var import_node_fs14 = require("node:fs");
48828
+ var import_node_path15 = __toESM(require("node:path"), 1);
48829
+ var import_node_os9 = __toESM(require("node:os"), 1);
48830
+ var import_node_child_process7 = require("node:child_process");
46158
48831
 
46159
48832
  // ../../packages/wiki/dist/index.js
46160
48833
  var import_promises2 = __toESM(require("node:fs/promises"), 1);
46161
- var import_node_path12 = __toESM(require("node:path"), 1);
48834
+ var import_node_path13 = __toESM(require("node:path"), 1);
46162
48835
  var INCLUDED_DOC_FOLDERS = /* @__PURE__ */ new Set(["_meta", "explanation", "how-to", "reference", "sdd", "tutorials"]);
46163
48836
  function toPosixPath(input) {
46164
- return input.split(import_node_path12.default.sep).join("/");
48837
+ return input.split(import_node_path13.default.sep).join("/");
46165
48838
  }
46166
48839
  function slugifyWikiSegment(input) {
46167
48840
  return input.trim().toLowerCase().replace(/`/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
@@ -46175,12 +48848,12 @@ async function pathExists2(input) {
46175
48848
  }
46176
48849
  }
46177
48850
  async function findWorkspaceRoot(start = process.cwd()) {
46178
- let current = import_node_path12.default.resolve(start);
48851
+ let current = import_node_path13.default.resolve(start);
46179
48852
  while (true) {
46180
- if (await pathExists2(import_node_path12.default.join(current, "pnpm-workspace.yaml")) && await pathExists2(import_node_path12.default.join(current, "docs"))) {
48853
+ if (await pathExists2(import_node_path13.default.join(current, "pnpm-workspace.yaml")) && await pathExists2(import_node_path13.default.join(current, "docs"))) {
46181
48854
  return current;
46182
48855
  }
46183
- const parent = import_node_path12.default.dirname(current);
48856
+ const parent = import_node_path13.default.dirname(current);
46184
48857
  if (parent === current) {
46185
48858
  throw new Error(`Unable to find Mrrlin workspace root from ${start}`);
46186
48859
  }
@@ -46189,28 +48862,28 @@ async function findWorkspaceRoot(start = process.cwd()) {
46189
48862
  }
46190
48863
  async function resolveDocsRoot(input) {
46191
48864
  if (input) {
46192
- return import_node_path12.default.resolve(input);
48865
+ return import_node_path13.default.resolve(input);
46193
48866
  }
46194
48867
  if (process.env.MRRLIN_DOCS_ROOT) {
46195
- return import_node_path12.default.resolve(process.env.MRRLIN_DOCS_ROOT);
48868
+ return import_node_path13.default.resolve(process.env.MRRLIN_DOCS_ROOT);
46196
48869
  }
46197
- return import_node_path12.default.join(await findWorkspaceRoot(), "docs");
48870
+ return import_node_path13.default.join(await findWorkspaceRoot(), "docs");
46198
48871
  }
46199
48872
  async function resolveIndexPath(input) {
46200
48873
  if (input) {
46201
- return import_node_path12.default.resolve(input);
48874
+ return import_node_path13.default.resolve(input);
46202
48875
  }
46203
48876
  if (process.env.MRRLIN_WIKI_INDEX_PATH) {
46204
- return import_node_path12.default.resolve(process.env.MRRLIN_WIKI_INDEX_PATH);
48877
+ return import_node_path13.default.resolve(process.env.MRRLIN_WIKI_INDEX_PATH);
46205
48878
  }
46206
48879
  const workspaceRoot = await findWorkspaceRoot();
46207
- return import_node_path12.default.join(workspaceRoot, "apps", "web", "public", "wiki-index.json");
48880
+ return import_node_path13.default.join(workspaceRoot, "apps", "web", "public", "wiki-index.json");
46208
48881
  }
46209
48882
  async function walkMarkdownFiles(root, dir = root) {
46210
48883
  const entries = await import_promises2.default.readdir(dir, { withFileTypes: true });
46211
48884
  const files = [];
46212
48885
  for (const entry of entries) {
46213
- const absolute = import_node_path12.default.join(dir, entry.name);
48886
+ const absolute = import_node_path13.default.join(dir, entry.name);
46214
48887
  if (entry.isDirectory()) {
46215
48888
  files.push(...await walkMarkdownFiles(root, absolute));
46216
48889
  continue;
@@ -46229,7 +48902,7 @@ function parseTitle(markdown, sourcePath) {
46229
48902
  return title;
46230
48903
  }
46231
48904
  function documentFromFile(docsRoot, absolutePath, markdown) {
46232
- const relativePath = toPosixPath(import_node_path12.default.relative(docsRoot, absolutePath));
48905
+ const relativePath = toPosixPath(import_node_path13.default.relative(docsRoot, absolutePath));
46233
48906
  const [section, fileName] = relativePath.split("/");
46234
48907
  if (!section || !fileName || !INCLUDED_DOC_FOLDERS.has(section)) {
46235
48908
  return null;
@@ -46644,7 +49317,7 @@ async function runCodeGate(_target, deps) {
46644
49317
  }
46645
49318
 
46646
49319
  // src/consensus/codex-exec.ts
46647
- var import_node_child_process4 = require("node:child_process");
49320
+ var import_node_child_process5 = require("node:child_process");
46648
49321
  function extractFinalMessage(stdout) {
46649
49322
  let last = null;
46650
49323
  for (const rawLine of stdout.split(/\r?\n/)) {
@@ -46689,7 +49362,7 @@ function firstString(...values) {
46689
49362
  return null;
46690
49363
  }
46691
49364
  function runCodexExec(input, deps) {
46692
- const spawn2 = deps?.spawn ?? import_node_child_process4.spawn;
49365
+ const spawn2 = deps?.spawn ?? import_node_child_process5.spawn;
46693
49366
  const executable = input.codexExecutable ?? "codex";
46694
49367
  const sandbox = input.sandbox ?? "read-only";
46695
49368
  const fullPrompt = input.developerInstructions.trim() ? `${input.developerInstructions.trim()}
@@ -46761,12 +49434,12 @@ function errMessage(err) {
46761
49434
  }
46762
49435
 
46763
49436
  // src/consensus/wiring.ts
46764
- var import_node_fs11 = __toESM(require("node:fs"), 1);
46765
- var import_node_path13 = __toESM(require("node:path"), 1);
49437
+ var import_node_fs13 = __toESM(require("node:fs"), 1);
49438
+ var import_node_path14 = __toESM(require("node:path"), 1);
46766
49439
  var import_node_url = require("node:url");
46767
49440
 
46768
49441
  // src/consensus/code-gate-git.ts
46769
- var import_node_child_process5 = require("node:child_process");
49442
+ var import_node_child_process6 = require("node:child_process");
46770
49443
  var DIFF_MAX_BYTES = 2e5;
46771
49444
  var FASTGATE_OUTPUT_MAX_BYTES = 16e3;
46772
49445
  var GIT_TIMEOUT_MS = 6e4;
@@ -46782,7 +49455,7 @@ var defaultRunCmd = (cmd, args, opts) => new Promise((resolve) => {
46782
49455
  };
46783
49456
  let child;
46784
49457
  try {
46785
- child = (0, import_node_child_process5.spawn)(cmd, args, {
49458
+ child = (0, import_node_child_process6.spawn)(cmd, args, {
46786
49459
  cwd: opts.cwd,
46787
49460
  env: process.env,
46788
49461
  shell: false,
@@ -46997,15 +49670,15 @@ ${res.stdout}${res.stderr}`);
46997
49670
  var import_meta = {};
46998
49671
  function getPersonasDir() {
46999
49672
  if (typeof __dirname !== "undefined") {
47000
- return import_node_path13.default.join(__dirname, "consensus", "personas");
49673
+ return import_node_path14.default.join(__dirname, "consensus", "personas");
47001
49674
  }
47002
- return import_node_path13.default.join(import_node_path13.default.dirname((0, import_node_url.fileURLToPath)(import_meta.url)), "personas");
49675
+ return import_node_path14.default.join(import_node_path14.default.dirname((0, import_node_url.fileURLToPath)(import_meta.url)), "personas");
47003
49676
  }
47004
49677
  var personaCache = /* @__PURE__ */ new Map();
47005
49678
  function loadPersona(name) {
47006
49679
  const cached2 = personaCache.get(name);
47007
49680
  if (cached2 !== void 0) return cached2;
47008
- const content = import_node_fs11.default.readFileSync(import_node_path13.default.join(getPersonasDir(), `${name}.md`), "utf8");
49681
+ const content = import_node_fs13.default.readFileSync(import_node_path14.default.join(getPersonasDir(), `${name}.md`), "utf8");
47009
49682
  personaCache.set(name, content);
47010
49683
  return content;
47011
49684
  }
@@ -47283,7 +49956,7 @@ var consensusDescriptor = {
47283
49956
  };
47284
49957
 
47285
49958
  // src/async-tools/enqueue.ts
47286
- var import_node_crypto5 = __toESM(require("node:crypto"), 1);
49959
+ var import_node_crypto6 = __toESM(require("node:crypto"), 1);
47287
49960
  async function enqueueAsyncTool(client, descriptor2, input) {
47288
49961
  if (descriptor2.cachedResult) {
47289
49962
  const cached2 = await descriptor2.cachedResult(client, input);
@@ -47296,7 +49969,7 @@ async function enqueueAsyncTool(client, descriptor2, input) {
47296
49969
  if (active) {
47297
49970
  return { status: "already_running", jobId: active.id, message: "Already running; will notify in inbox." };
47298
49971
  }
47299
- const jobId = `AJ-${import_node_crypto5.default.randomUUID()}`;
49972
+ const jobId = `AJ-${import_node_crypto6.default.randomUUID()}`;
47300
49973
  try {
47301
49974
  await client.createAsyncJob(input.projectSlug, {
47302
49975
  id: jobId,
@@ -48768,7 +51441,7 @@ function createMrrlinTools(options) {
48768
51441
  "ARTIFACT_FILE_UPLOAD_FAILED",
48769
51442
  "Unable to upload artifact file.",
48770
51443
  async (c, { projectSlug, path: filePath, class: artifactClass, taskId, runId, description }) => {
48771
- const extension2 = import_node_path14.default.extname(filePath).toLowerCase();
51444
+ const extension2 = import_node_path15.default.extname(filePath).toLowerCase();
48772
51445
  const contentType = ARTIFACT_EXTENSION_TYPES[extension2];
48773
51446
  if (!contentType) {
48774
51447
  throw new McpToolCodedError(
@@ -48796,7 +51469,7 @@ function createMrrlinTools(options) {
48796
51469
  "Artifact exceeds 5MB; split or summarize instead."
48797
51470
  );
48798
51471
  }
48799
- const filename = import_node_path14.default.basename(filePath);
51472
+ const filename = import_node_path15.default.basename(filePath);
48800
51473
  const created = await c.createArtifactFile(projectSlug, {
48801
51474
  class: artifactClass,
48802
51475
  contentType,
@@ -48879,7 +51552,7 @@ function createMrrlinTools(options) {
48879
51552
  "Unable to register local checkout.",
48880
51553
  async (_c, { projectSlug, path: checkoutPath, repo }) => {
48881
51554
  const trimmedPath = checkoutPath.trim();
48882
- if (!import_node_path14.default.isAbsolute(trimmedPath)) {
51555
+ if (!import_node_path15.default.isAbsolute(trimmedPath)) {
48883
51556
  throw new McpToolCodedError(
48884
51557
  "LOCAL_CHECKOUT_PATH_NOT_ABSOLUTE",
48885
51558
  `Path must be absolute, got: ${trimmedPath}`
@@ -48887,7 +51560,7 @@ function createMrrlinTools(options) {
48887
51560
  }
48888
51561
  let resolvedPath;
48889
51562
  try {
48890
- resolvedPath = (0, import_node_fs12.realpathSync)(trimmedPath);
51563
+ resolvedPath = (0, import_node_fs14.realpathSync)(trimmedPath);
48891
51564
  } catch {
48892
51565
  throw new McpToolCodedError(
48893
51566
  "LOCAL_CHECKOUT_PATH_NOT_FOUND",
@@ -48896,7 +51569,7 @@ function createMrrlinTools(options) {
48896
51569
  }
48897
51570
  let remoteUrl;
48898
51571
  try {
48899
- remoteUrl = (0, import_node_child_process6.execFileSync)("git", ["-C", resolvedPath, "remote", "get-url", "origin"], {
51572
+ remoteUrl = (0, import_node_child_process7.execFileSync)("git", ["-C", resolvedPath, "remote", "get-url", "origin"], {
48900
51573
  encoding: "utf8",
48901
51574
  stdio: ["ignore", "pipe", "ignore"],
48902
51575
  timeout: 15e3,
@@ -48914,7 +51587,7 @@ function createMrrlinTools(options) {
48914
51587
  `Origin remote ${remoteUrl} does not match repo ${repo}.`
48915
51588
  );
48916
51589
  }
48917
- const stateDir = process.env.CODEX_HOME ? import_node_path14.default.join(process.env.CODEX_HOME, "mrrlin", "director-bridge") : import_node_path14.default.join(import_node_os8.default.homedir(), ".mrrlin", "director-bridge");
51590
+ const stateDir = process.env.CODEX_HOME ? import_node_path15.default.join(process.env.CODEX_HOME, "mrrlin", "director-bridge") : import_node_path15.default.join(import_node_os9.default.homedir(), ".mrrlin", "director-bridge");
48918
51591
  const registry3 = new CheckoutRegistry(stateDir);
48919
51592
  const confirmedAt = (/* @__PURE__ */ new Date()).toISOString();
48920
51593
  registry3.confirm(projectSlug, resolvedPath, confirmedAt);
@@ -49121,13 +51794,13 @@ function runSetCredential(args) {
49121
51794
  }
49122
51795
 
49123
51796
  // src/install-service.ts
49124
- var import_node_os9 = __toESM(require("node:os"), 1);
49125
- var import_node_path16 = __toESM(require("node:path"), 1);
51797
+ var import_node_os10 = __toESM(require("node:os"), 1);
51798
+ var import_node_path17 = __toESM(require("node:path"), 1);
49126
51799
 
49127
51800
  // src/service-paths.ts
49128
- var import_node_path15 = __toESM(require("node:path"), 1);
51801
+ var import_node_path16 = __toESM(require("node:path"), 1);
49129
51802
  function isWorktreePath(p) {
49130
- const norm = import_node_path15.default.normalize(p).split(import_node_path15.default.sep).join("/");
51803
+ const norm = import_node_path16.default.normalize(p).split(import_node_path16.default.sep).join("/");
49131
51804
  return norm.includes("/.claude/worktrees/");
49132
51805
  }
49133
51806
  function resolveServiceCwd(opts) {
@@ -49161,6 +51834,7 @@ function renderEcosystemConfig(opts) {
49161
51834
  autorestart: true,
49162
51835
  max_restarts: 10,
49163
51836
  restart_delay: 3000,
51837
+ kill_timeout: 10000,
49164
51838
  env: {
49165
51839
  ${envLines}
49166
51840
  },
@@ -49180,7 +51854,7 @@ function installService(deps) {
49180
51854
  deps.log(resolved.reason);
49181
51855
  return { ok: false };
49182
51856
  }
49183
- const home = deps.env.HOME ?? import_node_os9.default.homedir();
51857
+ const home = deps.env.HOME ?? import_node_os10.default.homedir();
49184
51858
  const bins = ["node", "codex", "mrrlin-mcp"].map((b) => deps.which(b));
49185
51859
  if (bins.some((b) => !b)) {
49186
51860
  deps.log("Could not resolve absolute paths for node/codex/mrrlin-mcp on PATH. Install them or fix PATH.");
@@ -49191,7 +51865,7 @@ function installService(deps) {
49191
51865
  return { ok: false };
49192
51866
  }
49193
51867
  const resolvedBins = bins.filter((b) => b !== null);
49194
- const pathEnv = Array.from(new Set(resolvedBins.map((b) => import_node_path16.default.dirname(b)))).join(":");
51868
+ const pathEnv = Array.from(new Set(resolvedBins.map((b) => import_node_path17.default.dirname(b)))).join(":");
49195
51869
  const text = renderEcosystemConfig({
49196
51870
  cwd: resolved.cwd,
49197
51871
  home,
@@ -49200,7 +51874,7 @@ function installService(deps) {
49200
51874
  staging: deps.env.MRRLIN_STAGING === "1",
49201
51875
  apiBaseUrl: deps.env.MRRLIN_API_BASE_URL?.trim() || void 0
49202
51876
  });
49203
- const ecoPath = import_node_path16.default.join(home, ".mrrlin", "ecosystem.config.cjs");
51877
+ const ecoPath = import_node_path17.default.join(home, ".mrrlin", "ecosystem.config.cjs");
49204
51878
  deps.writeFile(ecoPath, text);
49205
51879
  const start = deps.runPm2(["startOrReload", ecoPath]);
49206
51880
  if (start.code !== 0) {
@@ -49231,13 +51905,13 @@ function uninstallService(deps) {
49231
51905
 
49232
51906
  // src/uninstall-codex.ts
49233
51907
  var import_promises4 = __toESM(require("node:fs/promises"), 1);
49234
- var import_node_os10 = __toESM(require("node:os"), 1);
49235
- var import_node_path17 = __toESM(require("node:path"), 1);
51908
+ var import_node_os11 = __toESM(require("node:os"), 1);
51909
+ var import_node_path18 = __toESM(require("node:path"), 1);
49236
51910
  var toml2 = __toESM(require_toml(), 1);
49237
51911
  function resolveCodexHome2(options) {
49238
51912
  if (options.codexHome) return options.codexHome;
49239
51913
  if (process.env.CODEX_HOME) return process.env.CODEX_HOME;
49240
- return import_node_path17.default.join(options.homeDir ?? import_node_os10.default.homedir(), ".codex");
51914
+ return import_node_path18.default.join(options.homeDir ?? import_node_os11.default.homedir(), ".codex");
49241
51915
  }
49242
51916
  async function pathExists3(target) {
49243
51917
  try {
@@ -49250,7 +51924,7 @@ async function pathExists3(target) {
49250
51924
  var MRRLIN_BLOCK_RE2 = /(^|\n)\[mcp_servers\.mrrlin(?:\]|\.[^\]\n]*\])[\s\S]*?(?=\n\[|$)/g;
49251
51925
  async function uninstallCodex(options = {}) {
49252
51926
  const codexHome = resolveCodexHome2(options);
49253
- const configPath = import_node_path17.default.join(codexHome, "config.toml");
51927
+ const configPath = import_node_path18.default.join(codexHome, "config.toml");
49254
51928
  const removePrompts = async () => uninstallPrompts(codexHome, options.promptNames ?? []);
49255
51929
  if (!await pathExists3(configPath)) {
49256
51930
  return { action: "missing", configPath, prompts: await removePrompts() };
@@ -49278,10 +51952,10 @@ async function uninstallCodex(options = {}) {
49278
51952
  }
49279
51953
  async function uninstallPrompts(codexHome, names) {
49280
51954
  if (names.length === 0) return [];
49281
- const promptsDir2 = import_node_path17.default.join(codexHome, "prompts");
51955
+ const promptsDir2 = import_node_path18.default.join(codexHome, "prompts");
49282
51956
  const out = [];
49283
51957
  for (const name of names) {
49284
- const promptPath = import_node_path17.default.join(promptsDir2, `${name}.md`);
51958
+ const promptPath = import_node_path18.default.join(promptsDir2, `${name}.md`);
49285
51959
  try {
49286
51960
  await import_promises4.default.unlink(promptPath);
49287
51961
  out.push({ name, action: "removed", promptPath });
@@ -49298,27 +51972,27 @@ async function uninstallPrompts(codexHome, names) {
49298
51972
  }
49299
51973
 
49300
51974
  // src/report-issue-prompt.ts
49301
- var import_node_fs13 = __toESM(require("node:fs"), 1);
49302
- var import_node_path18 = __toESM(require("node:path"), 1);
51975
+ var import_node_fs15 = __toESM(require("node:fs"), 1);
51976
+ var import_node_path19 = __toESM(require("node:path"), 1);
49303
51977
  var import_node_url2 = require("node:url");
49304
51978
  var import_meta2 = {};
49305
51979
  function promptsDir() {
49306
- if (typeof __dirname !== "undefined") return import_node_path18.default.join(__dirname, "prompts");
49307
- return import_node_path18.default.join(import_node_path18.default.dirname((0, import_node_url2.fileURLToPath)(import_meta2.url)), "prompts");
51980
+ if (typeof __dirname !== "undefined") return import_node_path19.default.join(__dirname, "prompts");
51981
+ return import_node_path19.default.join(import_node_path19.default.dirname((0, import_node_url2.fileURLToPath)(import_meta2.url)), "prompts");
49308
51982
  }
49309
51983
  function readReportIssuePrompt() {
49310
- return import_node_fs13.default.readFileSync(import_node_path18.default.join(promptsDir(), "report-issue.md"), "utf8");
51984
+ return import_node_fs15.default.readFileSync(import_node_path19.default.join(promptsDir(), "report-issue.md"), "utf8");
49311
51985
  }
49312
51986
 
49313
51987
  // src/bin.ts
49314
51988
  function pm2Runner(args) {
49315
- const r = (0, import_node_child_process7.spawnSync)("pm2", args, { encoding: "utf8" });
51989
+ const r = (0, import_node_child_process8.spawnSync)("pm2", args, { encoding: "utf8" });
49316
51990
  process.stderr.write(r.stdout ?? "");
49317
51991
  process.stderr.write(r.stderr ?? "");
49318
51992
  return { code: r.status ?? 1, stdout: r.stdout ?? "" };
49319
51993
  }
49320
51994
  function whichBin(bin) {
49321
- const r = (0, import_node_child_process7.spawnSync)("which", [bin], { encoding: "utf8" });
51995
+ const r = (0, import_node_child_process8.spawnSync)("which", [bin], { encoding: "utf8" });
49322
51996
  const out = (r.stdout ?? "").trim();
49323
51997
  return r.status === 0 && out ? out.split("\n")[0] ?? null : null;
49324
51998
  }
@@ -49426,22 +52100,20 @@ Usage:
49426
52100
  Bearer/JWT tokens, long hex / base64-ish runs)
49427
52101
  from stdin and write the result to stdout. Same
49428
52102
  regex set as the bridge logger. Empty input ->
49429
- empty output, exit 0. Used by the /report-issue
49430
- prompt to ensure no raw text reaches Telegram:
52103
+ empty output, exit 0. Useful for any local
52104
+ support/debug packaging flow:
49431
52105
  printf %s "$HINT" | mrrlin-mcp redact
49432
52106
 
49433
- mrrlin-mcp report-issue Print the bundled support-report prompt to
49434
- stdout. Normal users don't need this \u2014 install-codex
49435
- already drops it as a /report-issue slash command.
49436
- Operator usage from inside Codex (paste a hint \u2014
49437
- pasted error blurb, weird output quote, one-line
49438
- description, or sessionId):
49439
- /report-issue Codex hung after sending a turn
49440
- /report-issue [paste failing stack here]
49441
- The prompt greps the bridge log for that hint
49442
- and only asks follow-ups the log doesn't already
49443
- answer. Useful for: piping ad-hoc, inspecting
49444
- shipped contents, repairing a deleted file:
52107
+ mrrlin-mcp report-issue Print the bundled compatibility prompt for the
52108
+ legacy /report-issue slash command. Preferred
52109
+ flows now live inside the Mrrlin UI:
52110
+ - Director chat: /report-issue <what broke>
52111
+ - Header menu: Report issue
52112
+ Those flows package bridge logs, transcript
52113
+ context, screenshots, and create a GitHub issue
52114
+ in fnnzzz/mrrlin via local gh. This command is
52115
+ mainly useful for inspecting or re-installing
52116
+ the shipped prompt:
49445
52117
  codex "$(mrrlin-mcp report-issue)"
49446
52118
  mrrlin-mcp report-issue > ~/.codex/prompts/report-issue.md
49447
52119
 
@@ -49519,8 +52191,8 @@ async function main() {
49519
52191
  env: process.env,
49520
52192
  cwd: process.cwd(),
49521
52193
  writeFile: (p, c) => {
49522
- (0, import_node_fs14.mkdirSync)(import_node_path20.default.dirname(p), { recursive: true, mode: 448 });
49523
- (0, import_node_fs14.writeFileSync)(p, c, { mode: 384 });
52194
+ (0, import_node_fs16.mkdirSync)(import_node_path21.default.dirname(p), { recursive: true, mode: 448 });
52195
+ (0, import_node_fs16.writeFileSync)(p, c, { mode: 384 });
49524
52196
  },
49525
52197
  runPm2: pm2Runner,
49526
52198
  which: whichBin,
@@ -49537,35 +52209,35 @@ async function main() {
49537
52209
  runPm2: (a) => ({ code: pm2Runner(a).code }),
49538
52210
  removeFile: (p) => {
49539
52211
  try {
49540
- (0, import_node_fs14.rmSync)(p, { force: true });
52212
+ (0, import_node_fs16.rmSync)(p, { force: true });
49541
52213
  } catch {
49542
52214
  }
49543
52215
  },
49544
52216
  purgeSecret: purge,
49545
52217
  secretPath: agentCredentialPath(),
49546
52218
  tokenPath: operatorTokenPath(),
49547
- ecoPath: import_node_path20.default.join(process.env.HOME ?? (0, import_node_os11.homedir)(), ".mrrlin", "ecosystem.config.cjs"),
52219
+ ecoPath: import_node_path21.default.join(process.env.HOME ?? (0, import_node_os12.homedir)(), ".mrrlin", "ecosystem.config.cjs"),
49548
52220
  log: (m) => process.stderr.write(`[mrrlin-mcp uninstall-service] ${m}
49549
52221
  `)
49550
52222
  });
49551
52223
  return;
49552
52224
  }
49553
52225
  case "uninstall": {
49554
- const home = process.env.HOME ?? (0, import_node_os11.homedir)();
52226
+ const home = process.env.HOME ?? (0, import_node_os12.homedir)();
49555
52227
  const log = (m) => process.stderr.write(`[mrrlin-mcp uninstall] ${m}
49556
52228
  `);
49557
52229
  uninstallService({
49558
52230
  runPm2: (a) => ({ code: pm2Runner(a).code }),
49559
52231
  removeFile: (p) => {
49560
52232
  try {
49561
- (0, import_node_fs14.rmSync)(p, { force: true });
52233
+ (0, import_node_fs16.rmSync)(p, { force: true });
49562
52234
  } catch {
49563
52235
  }
49564
52236
  },
49565
52237
  purgeSecret: true,
49566
52238
  secretPath: agentCredentialPath(),
49567
52239
  tokenPath: operatorTokenPath(),
49568
- ecoPath: import_node_path20.default.join(home, ".mrrlin", "ecosystem.config.cjs"),
52240
+ ecoPath: import_node_path21.default.join(home, ".mrrlin", "ecosystem.config.cjs"),
49569
52241
  log
49570
52242
  });
49571
52243
  let codexOk = true;
@@ -49585,7 +52257,7 @@ async function main() {
49585
52257
  log(`codex config NOT modified: ${error51 instanceof Error ? error51.message : String(error51)}`);
49586
52258
  }
49587
52259
  try {
49588
- (0, import_node_fs14.rmSync)(import_node_path20.default.join(home, ".mrrlin"), { recursive: true, force: true });
52260
+ (0, import_node_fs16.rmSync)(import_node_path21.default.join(home, ".mrrlin"), { recursive: true, force: true });
49589
52261
  } catch {
49590
52262
  }
49591
52263
  log("removed ~/.mrrlin");
@@ -49626,7 +52298,7 @@ ${HELP_TEXT}`);
49626
52298
  }
49627
52299
  }
49628
52300
  function resolveSelfBinPath() {
49629
- return import_node_path19.default.resolve(process.argv[1] ?? process.execPath);
52301
+ return import_node_path20.default.resolve(process.argv[1] ?? process.execPath);
49630
52302
  }
49631
52303
  main().catch((error51) => {
49632
52304
  process.stderr.write(`mrrlin-mcp fatal error: ${error51 instanceof Error ? error51.message : String(error51)}