mpd-llm-cli 0.1.43 → 0.1.44

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/bundle/gemini.js CHANGED
@@ -24179,13 +24179,13 @@ var require_websocket = __commonJS({
24179
24179
  "node_modules/ws/lib/websocket.js"(exports2, module2) {
24180
24180
  "use strict";
24181
24181
  var EventEmitter7 = __require("events");
24182
- var https2 = __require("https");
24182
+ var https3 = __require("https");
24183
24183
  var http2 = __require("http");
24184
24184
  var net2 = __require("net");
24185
24185
  var tls = __require("tls");
24186
24186
  var { randomBytes, createHash: createHash2 } = __require("crypto");
24187
24187
  var { Duplex, Readable } = __require("stream");
24188
- var { URL: URL4 } = __require("url");
24188
+ var { URL: URL5 } = __require("url");
24189
24189
  var PerMessageDeflate = require_permessage_deflate();
24190
24190
  var Receiver2 = require_receiver();
24191
24191
  var Sender2 = require_sender();
@@ -24675,11 +24675,11 @@ var require_websocket = __commonJS({
24675
24675
  );
24676
24676
  }
24677
24677
  let parsedUrl;
24678
- if (address instanceof URL4) {
24678
+ if (address instanceof URL5) {
24679
24679
  parsedUrl = address;
24680
24680
  } else {
24681
24681
  try {
24682
- parsedUrl = new URL4(address);
24682
+ parsedUrl = new URL5(address);
24683
24683
  } catch (e2) {
24684
24684
  throw new SyntaxError(`Invalid URL: ${address}`);
24685
24685
  }
@@ -24711,7 +24711,7 @@ var require_websocket = __commonJS({
24711
24711
  }
24712
24712
  const defaultPort = isSecure ? 443 : 80;
24713
24713
  const key = randomBytes(16).toString("base64");
24714
- const request2 = isSecure ? https2.request : http2.request;
24714
+ const request2 = isSecure ? https3.request : http2.request;
24715
24715
  const protocolSet = /* @__PURE__ */ new Set();
24716
24716
  let perMessageDeflate;
24717
24717
  opts.createConnection = opts.createConnection || (isSecure ? tlsConnect : netConnect);
@@ -24816,7 +24816,7 @@ var require_websocket = __commonJS({
24816
24816
  req.abort();
24817
24817
  let addr;
24818
24818
  try {
24819
- addr = new URL4(location, address);
24819
+ addr = new URL5(location, address);
24820
24820
  } catch (e2) {
24821
24821
  const err = new SyntaxError(`Invalid URL: ${location}`);
24822
24822
  emitErrorAndClose(websocket, err);
@@ -40930,8 +40930,8 @@ var require_URL = __commonJS({
40930
40930
  var utils2 = require_utils();
40931
40931
  var Impl = require_URL_impl();
40932
40932
  var impl = utils2.implSymbol;
40933
- function URL4(url2) {
40934
- if (!this || this[impl] || !(this instanceof URL4)) {
40933
+ function URL5(url2) {
40934
+ if (!this || this[impl] || !(this instanceof URL5)) {
40935
40935
  throw new TypeError("Failed to construct 'URL': Please use the 'new' operator, this DOM object constructor cannot be called as a function.");
40936
40936
  }
40937
40937
  if (arguments.length < 1) {
@@ -40947,7 +40947,7 @@ var require_URL = __commonJS({
40947
40947
  }
40948
40948
  module2.exports.setup(this, args);
40949
40949
  }
40950
- URL4.prototype.toJSON = function toJSON() {
40950
+ URL5.prototype.toJSON = function toJSON() {
40951
40951
  if (!this || !module2.exports.is(this)) {
40952
40952
  throw new TypeError("Illegal invocation");
40953
40953
  }
@@ -40957,7 +40957,7 @@ var require_URL = __commonJS({
40957
40957
  }
40958
40958
  return this[impl].toJSON.apply(this[impl], args);
40959
40959
  };
40960
- Object.defineProperty(URL4.prototype, "href", {
40960
+ Object.defineProperty(URL5.prototype, "href", {
40961
40961
  get() {
40962
40962
  return this[impl].href;
40963
40963
  },
@@ -40968,20 +40968,20 @@ var require_URL = __commonJS({
40968
40968
  enumerable: true,
40969
40969
  configurable: true
40970
40970
  });
40971
- URL4.prototype.toString = function() {
40971
+ URL5.prototype.toString = function() {
40972
40972
  if (!this || !module2.exports.is(this)) {
40973
40973
  throw new TypeError("Illegal invocation");
40974
40974
  }
40975
40975
  return this.href;
40976
40976
  };
40977
- Object.defineProperty(URL4.prototype, "origin", {
40977
+ Object.defineProperty(URL5.prototype, "origin", {
40978
40978
  get() {
40979
40979
  return this[impl].origin;
40980
40980
  },
40981
40981
  enumerable: true,
40982
40982
  configurable: true
40983
40983
  });
40984
- Object.defineProperty(URL4.prototype, "protocol", {
40984
+ Object.defineProperty(URL5.prototype, "protocol", {
40985
40985
  get() {
40986
40986
  return this[impl].protocol;
40987
40987
  },
@@ -40992,7 +40992,7 @@ var require_URL = __commonJS({
40992
40992
  enumerable: true,
40993
40993
  configurable: true
40994
40994
  });
40995
- Object.defineProperty(URL4.prototype, "username", {
40995
+ Object.defineProperty(URL5.prototype, "username", {
40996
40996
  get() {
40997
40997
  return this[impl].username;
40998
40998
  },
@@ -41003,7 +41003,7 @@ var require_URL = __commonJS({
41003
41003
  enumerable: true,
41004
41004
  configurable: true
41005
41005
  });
41006
- Object.defineProperty(URL4.prototype, "password", {
41006
+ Object.defineProperty(URL5.prototype, "password", {
41007
41007
  get() {
41008
41008
  return this[impl].password;
41009
41009
  },
@@ -41014,7 +41014,7 @@ var require_URL = __commonJS({
41014
41014
  enumerable: true,
41015
41015
  configurable: true
41016
41016
  });
41017
- Object.defineProperty(URL4.prototype, "host", {
41017
+ Object.defineProperty(URL5.prototype, "host", {
41018
41018
  get() {
41019
41019
  return this[impl].host;
41020
41020
  },
@@ -41025,7 +41025,7 @@ var require_URL = __commonJS({
41025
41025
  enumerable: true,
41026
41026
  configurable: true
41027
41027
  });
41028
- Object.defineProperty(URL4.prototype, "hostname", {
41028
+ Object.defineProperty(URL5.prototype, "hostname", {
41029
41029
  get() {
41030
41030
  return this[impl].hostname;
41031
41031
  },
@@ -41036,7 +41036,7 @@ var require_URL = __commonJS({
41036
41036
  enumerable: true,
41037
41037
  configurable: true
41038
41038
  });
41039
- Object.defineProperty(URL4.prototype, "port", {
41039
+ Object.defineProperty(URL5.prototype, "port", {
41040
41040
  get() {
41041
41041
  return this[impl].port;
41042
41042
  },
@@ -41047,7 +41047,7 @@ var require_URL = __commonJS({
41047
41047
  enumerable: true,
41048
41048
  configurable: true
41049
41049
  });
41050
- Object.defineProperty(URL4.prototype, "pathname", {
41050
+ Object.defineProperty(URL5.prototype, "pathname", {
41051
41051
  get() {
41052
41052
  return this[impl].pathname;
41053
41053
  },
@@ -41058,7 +41058,7 @@ var require_URL = __commonJS({
41058
41058
  enumerable: true,
41059
41059
  configurable: true
41060
41060
  });
41061
- Object.defineProperty(URL4.prototype, "search", {
41061
+ Object.defineProperty(URL5.prototype, "search", {
41062
41062
  get() {
41063
41063
  return this[impl].search;
41064
41064
  },
@@ -41069,7 +41069,7 @@ var require_URL = __commonJS({
41069
41069
  enumerable: true,
41070
41070
  configurable: true
41071
41071
  });
41072
- Object.defineProperty(URL4.prototype, "hash", {
41072
+ Object.defineProperty(URL5.prototype, "hash", {
41073
41073
  get() {
41074
41074
  return this[impl].hash;
41075
41075
  },
@@ -41085,7 +41085,7 @@ var require_URL = __commonJS({
41085
41085
  return !!obj && obj[impl] instanceof Impl.implementation;
41086
41086
  },
41087
41087
  create(constructorArgs, privateData) {
41088
- let obj = Object.create(URL4.prototype);
41088
+ let obj = Object.create(URL5.prototype);
41089
41089
  this.setup(obj, constructorArgs, privateData);
41090
41090
  return obj;
41091
41091
  },
@@ -41095,10 +41095,10 @@ var require_URL = __commonJS({
41095
41095
  obj[impl] = new Impl.implementation(constructorArgs, privateData);
41096
41096
  obj[impl][utils2.wrapperSymbol] = obj;
41097
41097
  },
41098
- interface: URL4,
41098
+ interface: URL5,
41099
41099
  expose: {
41100
- Window: { URL: URL4 },
41101
- Worker: { URL: URL4 }
41100
+ Window: { URL: URL5 },
41101
+ Worker: { URL: URL5 }
41102
41102
  }
41103
41103
  };
41104
41104
  }
@@ -41132,7 +41132,7 @@ var require_lib2 = __commonJS({
41132
41132
  var http2 = _interopDefault(__require("http"));
41133
41133
  var Url = _interopDefault(__require("url"));
41134
41134
  var whatwgUrl = _interopDefault(require_public_api());
41135
- var https2 = _interopDefault(__require("https"));
41135
+ var https3 = _interopDefault(__require("https"));
41136
41136
  var zlib = _interopDefault(__require("zlib"));
41137
41137
  var Readable = Stream4.Readable;
41138
41138
  var BUFFER2 = Symbol("buffer");
@@ -41945,12 +41945,12 @@ var require_lib2 = __commonJS({
41945
41945
  configurable: true
41946
41946
  });
41947
41947
  var INTERNALS$2 = Symbol("Request internals");
41948
- var URL4 = Url.URL || whatwgUrl.URL;
41948
+ var URL5 = Url.URL || whatwgUrl.URL;
41949
41949
  var parse_url = Url.parse;
41950
41950
  var format_url = Url.format;
41951
41951
  function parseURL(urlStr) {
41952
41952
  if (/^[a-zA-Z][a-zA-Z\d+\-.]*:/.exec(urlStr)) {
41953
- urlStr = new URL4(urlStr).toString();
41953
+ urlStr = new URL5(urlStr).toString();
41954
41954
  }
41955
41955
  return parse_url(urlStr);
41956
41956
  }
@@ -42122,7 +42122,7 @@ var require_lib2 = __commonJS({
42122
42122
  return new fetch2.Promise(function(resolve18, reject) {
42123
42123
  const request2 = new Request2(url2, opts);
42124
42124
  const options = getNodeRequestOptions(request2);
42125
- const send = (options.protocol === "https:" ? https2 : http2).request;
42125
+ const send = (options.protocol === "https:" ? https3 : http2).request;
42126
42126
  const signal = request2.signal;
42127
42127
  let response = null;
42128
42128
  const abort = function abort2() {
@@ -43903,7 +43903,7 @@ var require_helpers = __commonJS({
43903
43903
  Object.defineProperty(exports2, "__esModule", { value: true });
43904
43904
  exports2.req = exports2.json = exports2.toBuffer = void 0;
43905
43905
  var http2 = __importStar(__require("http"));
43906
- var https2 = __importStar(__require("https"));
43906
+ var https3 = __importStar(__require("https"));
43907
43907
  async function toBuffer(stream2) {
43908
43908
  let length = 0;
43909
43909
  const chunks = [];
@@ -43928,7 +43928,7 @@ var require_helpers = __commonJS({
43928
43928
  exports2.json = json2;
43929
43929
  function req(url2, opts = {}) {
43930
43930
  const href = typeof url2 === "string" ? url2 : url2.href;
43931
- const req2 = (href.startsWith("https:") ? https2 : http2).request(url2, opts);
43931
+ const req2 = (href.startsWith("https:") ? https3 : http2).request(url2, opts);
43932
43932
  const promise = new Promise((resolve18, reject) => {
43933
43933
  req2.once("response", resolve18).once("error", reject).end();
43934
43934
  });
@@ -62351,7 +62351,7 @@ async function createContentGeneratorConfig(model, authType) {
62351
62351
  return contentGeneratorConfig;
62352
62352
  }
62353
62353
  async function createContentGenerator(config2, sessionId2) {
62354
- const version3 = "0.1.43";
62354
+ const version3 = "0.1.44";
62355
62355
  const httpOptions = {
62356
62356
  headers: {
62357
62357
  "User-Agent": `GeminiCLI/${version3} (${process.platform}; ${process.arch})`
@@ -70309,7 +70309,7 @@ var require_formats = __commonJS({
70309
70309
  var URI = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
70310
70310
  var URIREF = /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
70311
70311
  var URITEMPLATE = /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i;
70312
- var URL4 = /^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i;
70312
+ var URL5 = /^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i;
70313
70313
  var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
70314
70314
  var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/;
70315
70315
  var JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;
@@ -70329,7 +70329,7 @@ var require_formats = __commonJS({
70329
70329
  uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,
70330
70330
  "uri-reference": /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,
70331
70331
  "uri-template": URITEMPLATE,
70332
- url: URL4,
70332
+ url: URL5,
70333
70333
  // email (sources from jsen validator):
70334
70334
  // http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address#answer-8829363
70335
70335
  // http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'willful violation')
@@ -70356,7 +70356,7 @@ var require_formats = __commonJS({
70356
70356
  uri,
70357
70357
  "uri-reference": URIREF,
70358
70358
  "uri-template": URITEMPLATE,
70359
- url: URL4,
70359
+ url: URL5,
70360
70360
  email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,
70361
70361
  hostname: HOSTNAME,
70362
70362
  ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,
@@ -80679,7 +80679,7 @@ var require_schemes = __commonJS({
80679
80679
  parse: httpParse,
80680
80680
  serialize: httpSerialize
80681
80681
  };
80682
- var https2 = {
80682
+ var https3 = {
80683
80683
  scheme: "https",
80684
80684
  domainHost: http2.domainHost,
80685
80685
  parse: httpParse,
@@ -80711,7 +80711,7 @@ var require_schemes = __commonJS({
80711
80711
  };
80712
80712
  var SCHEMES = {
80713
80713
  http: http2,
80714
- https: https2,
80714
+ https: https3,
80715
80715
  ws: ws3,
80716
80716
  wss,
80717
80717
  urn,
@@ -115950,7 +115950,7 @@ var require_util6 = __commonJS({
115950
115950
  exports2.configureCompression = exports2.createHttpAgent = exports2.sendWithHttp = void 0;
115951
115951
  var url2 = __require("url");
115952
115952
  var http2 = __require("http");
115953
- var https2 = __require("https");
115953
+ var https3 = __require("https");
115954
115954
  var zlib = __require("zlib");
115955
115955
  var stream_1 = __require("stream");
115956
115956
  var api_1 = (init_esm2(), __toCommonJS(esm_exports));
@@ -115983,7 +115983,7 @@ var require_util6 = __commonJS({
115983
115983
  headers: Object.assign({ "Content-Type": contentType }, collector.headers),
115984
115984
  agent: collector.agent
115985
115985
  };
115986
- const request2 = parsedUrl.protocol === "http:" ? http2.request : https2.request;
115986
+ const request2 = parsedUrl.protocol === "http:" ? http2.request : https3.request;
115987
115987
  const sendWithRetry = (retries = util_1.DEFAULT_EXPORT_MAX_ATTEMPTS, minDelay = util_1.DEFAULT_EXPORT_INITIAL_BACKOFF) => {
115988
115988
  req = request2(options, (res) => {
115989
115989
  let responseData = "";
@@ -116069,7 +116069,7 @@ var require_util6 = __commonJS({
116069
116069
  return void 0;
116070
116070
  try {
116071
116071
  const parsedUrl = new url2.URL(config2.url);
116072
- const Agent = parsedUrl.protocol === "http:" ? http2.Agent : https2.Agent;
116072
+ const Agent = parsedUrl.protocol === "http:" ? http2.Agent : https3.Agent;
116073
116073
  return new Agent(Object.assign({ keepAlive: true }, config2.httpAgentOptions));
116074
116074
  } catch (err) {
116075
116075
  api_1.diag.error(`collector exporter failed to create http agent. err: ${err.message}`);
@@ -136041,7 +136041,7 @@ var require_server = __commonJS({
136041
136041
  throw new Error(`Invalid handlerType ${handlerType}`);
136042
136042
  }
136043
136043
  }
136044
- var Server = (() => {
136044
+ var Server2 = (() => {
136045
136045
  var _a6;
136046
136046
  let _instanceExtraInitializers = [];
136047
136047
  let _start_decorators;
@@ -137193,7 +137193,7 @@ var require_server = __commonJS({
137193
137193
  if (_metadata) Object.defineProperty(_a6, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
137194
137194
  })(), _a6;
137195
137195
  })();
137196
- exports2.Server = Server;
137196
+ exports2.Server = Server2;
137197
137197
  async function handleUnary(call, handler) {
137198
137198
  let stream2;
137199
137199
  function respond(err, value, trailer, flags) {
@@ -162090,7 +162090,7 @@ var require_util12 = __commonJS({
162090
162090
  var api_1 = (init_esm2(), __toCommonJS(esm_exports));
162091
162091
  var core_1 = require_src9();
162092
162092
  var http2 = __require("http");
162093
- var https2 = __require("https");
162093
+ var https3 = __require("https");
162094
162094
  var url2 = __require("url");
162095
162095
  function prepareSend(urlStr, headers) {
162096
162096
  const urlOpts = url2.parse(urlStr);
@@ -162103,7 +162103,7 @@ var require_util12 = __commonJS({
162103
162103
  api_1.diag.debug("Zipkin send with empty spans");
162104
162104
  return done({ code: core_1.ExportResultCode.SUCCESS });
162105
162105
  }
162106
- const { request: request2 } = reqOpts.protocol === "http:" ? http2 : https2;
162106
+ const { request: request2 } = reqOpts.protocol === "http:" ? http2 : https3;
162107
162107
  const req = request2(reqOpts, (res) => {
162108
162108
  let rawData = "";
162109
162109
  res.on("data", (chunk) => {
@@ -175552,7 +175552,7 @@ var require_proxy_agent = __commonJS({
175552
175552
  "node_modules/undici/lib/dispatcher/proxy-agent.js"(exports2, module2) {
175553
175553
  "use strict";
175554
175554
  var { kProxy, kClose, kDestroy, kDispatch, kConnector } = require_symbols();
175555
- var { URL: URL4 } = __require("node:url");
175555
+ var { URL: URL5 } = __require("node:url");
175556
175556
  var Agent = require_agent();
175557
175557
  var Pool = require_pool2();
175558
175558
  var DispatcherBase = require_dispatcher_base();
@@ -175578,7 +175578,7 @@ var require_proxy_agent = __commonJS({
175578
175578
  #client = null;
175579
175579
  constructor(origin, opts) {
175580
175580
  if (typeof origin === "string") {
175581
- origin = new URL4(origin);
175581
+ origin = new URL5(origin);
175582
175582
  }
175583
175583
  if (origin.protocol !== "http:" && origin.protocol !== "https:") {
175584
175584
  throw new InvalidArgumentError("ProxyClient only supports http and https protocols");
@@ -175618,14 +175618,14 @@ var require_proxy_agent = __commonJS({
175618
175618
  return;
175619
175619
  }
175620
175620
  if (typeof origin === "string") {
175621
- opts.origin = new URL4(origin);
175621
+ opts.origin = new URL5(origin);
175622
175622
  }
175623
175623
  return this.#client.dispatch(opts, handler);
175624
175624
  }
175625
175625
  };
175626
175626
  var ProxyAgent2 = class extends DispatcherBase {
175627
175627
  constructor(opts) {
175628
- if (!opts || typeof opts === "object" && !(opts instanceof URL4) && !opts.uri) {
175628
+ if (!opts || typeof opts === "object" && !(opts instanceof URL5) && !opts.uri) {
175629
175629
  throw new InvalidArgumentError("Proxy uri is mandatory");
175630
175630
  }
175631
175631
  const { clientFactory = defaultFactory } = opts;
@@ -175707,10 +175707,10 @@ var require_proxy_agent = __commonJS({
175707
175707
  const headers = buildHeaders2(opts.headers);
175708
175708
  throwIfProxyAuthIsSent(headers);
175709
175709
  if (headers && !("host" in headers) && !("Host" in headers)) {
175710
- const { host } = new URL4(opts.origin);
175710
+ const { host } = new URL5(opts.origin);
175711
175711
  headers.host = host;
175712
175712
  }
175713
- if (!this.#shouldConnect(new URL4(opts.origin))) {
175713
+ if (!this.#shouldConnect(new URL5(opts.origin))) {
175714
175714
  opts.path = opts.origin + opts.path;
175715
175715
  }
175716
175716
  return this[kAgent].dispatch(
@@ -175727,11 +175727,11 @@ var require_proxy_agent = __commonJS({
175727
175727
  */
175728
175728
  #getUrl(opts) {
175729
175729
  if (typeof opts === "string") {
175730
- return new URL4(opts);
175731
- } else if (opts instanceof URL4) {
175730
+ return new URL5(opts);
175731
+ } else if (opts instanceof URL5) {
175732
175732
  return opts;
175733
175733
  } else {
175734
- return new URL4(opts.uri);
175734
+ return new URL5(opts.uri);
175735
175735
  }
175736
175736
  }
175737
175737
  async [kClose]() {
@@ -175744,7 +175744,7 @@ var require_proxy_agent = __commonJS({
175744
175744
  }
175745
175745
  #shouldConnect(uri) {
175746
175746
  if (typeof uri === "string") {
175747
- uri = new URL4(uri);
175747
+ uri = new URL5(uri);
175748
175748
  }
175749
175749
  if (this[kTunnelProxy]) {
175750
175750
  return true;
@@ -199411,7 +199411,7 @@ var init_langfuseClient = __esm({
199411
199411
  userId,
199412
199412
  metadata: {
199413
199413
  ...safeMetadata,
199414
- cli_version: this.safeString("0.1.43", "unknown"),
199414
+ cli_version: this.safeString("0.1.44", "unknown"),
199415
199415
  model: this.safeString(process.env.CUSTOM_LLM_MODEL_NAME, "gemini"),
199416
199416
  auth_type: process.env.USE_CUSTOM_LLM ? "custom_llm" : "google_oauth",
199417
199417
  environment: this.safeString(this.configManager.getConfig()?.environment, "unknown")
@@ -200578,7 +200578,7 @@ var init_langfuseIntegration = __esm({
200578
200578
  const metadata = {
200579
200579
  model: this.config.getModel(),
200580
200580
  auth_type: this.config.getContentGeneratorConfig()?.authType,
200581
- cli_version: "0.1.43",
200581
+ cli_version: "0.1.44",
200582
200582
  start_time: (/* @__PURE__ */ new Date()).toISOString(),
200583
200583
  session_id: this.sessionId
200584
200584
  };
@@ -200637,7 +200637,7 @@ var init_langfuseIntegration = __esm({
200637
200637
  totalCachedTokens: sessionStats.totalCachedTokens,
200638
200638
  totalPromptTokens: sessionStats.totalPromptTokens,
200639
200639
  metadata: {
200640
- cli_version: "0.1.43",
200640
+ cli_version: "0.1.44",
200641
200641
  auth_type: this.config.getContentGeneratorConfig()?.authType,
200642
200642
  session_end_time: (/* @__PURE__ */ new Date()).toISOString()
200643
200643
  }
@@ -200709,7 +200709,7 @@ var init_langfuseIntegration = __esm({
200709
200709
  error,
200710
200710
  metadata: {
200711
200711
  session_id: this.sessionId,
200712
- cli_version: "0.1.43",
200712
+ cli_version: "0.1.44",
200713
200713
  auth_type: this.config.getContentGeneratorConfig()?.authType
200714
200714
  }
200715
200715
  });
@@ -201078,6 +201078,42 @@ var require_jsx_runtime = __commonJS({
201078
201078
  }
201079
201079
  });
201080
201080
 
201081
+ // node_modules/find-up-simple/index.js
201082
+ import process24 from "node:process";
201083
+ import fsPromises2 from "node:fs/promises";
201084
+ import { fileURLToPath as fileURLToPath4 } from "node:url";
201085
+ import path33 from "node:path";
201086
+ async function findUp(name2, {
201087
+ cwd: cwd2 = process24.cwd(),
201088
+ type = "file",
201089
+ stopAt
201090
+ } = {}) {
201091
+ let directory = path33.resolve(toPath(cwd2) ?? "");
201092
+ const { root } = path33.parse(directory);
201093
+ stopAt = path33.resolve(directory, toPath(stopAt ?? root));
201094
+ const isAbsoluteName = path33.isAbsolute(name2);
201095
+ while (directory) {
201096
+ const filePath = isAbsoluteName ? name2 : path33.join(directory, name2);
201097
+ try {
201098
+ const stats = await fsPromises2.stat(filePath);
201099
+ if (type === "file" && stats.isFile() || type === "directory" && stats.isDirectory()) {
201100
+ return filePath;
201101
+ }
201102
+ } catch {
201103
+ }
201104
+ if (directory === stopAt || directory === root) {
201105
+ break;
201106
+ }
201107
+ directory = path33.dirname(directory);
201108
+ }
201109
+ }
201110
+ var toPath;
201111
+ var init_find_up_simple = __esm({
201112
+ "node_modules/find-up-simple/index.js"() {
201113
+ toPath = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath4(urlOrPath) : urlOrPath;
201114
+ }
201115
+ });
201116
+
201081
201117
  // node_modules/picocolors/picocolors.js
201082
201118
  var require_picocolors = __commonJS({
201083
201119
  "node_modules/picocolors/picocolors.js"(exports2, module2) {
@@ -201558,6 +201594,131 @@ ${frame}`;
201558
201594
  }
201559
201595
  });
201560
201596
 
201597
+ // node_modules/index-to-position/index.js
201598
+ function getPosition(text, textIndex) {
201599
+ const lineBreakBefore = textIndex === 0 ? -1 : text.lastIndexOf("\n", textIndex - 1);
201600
+ return {
201601
+ line: lineBreakBefore === -1 ? 0 : text.slice(0, lineBreakBefore + 1).match(/\n/g).length,
201602
+ column: textIndex - lineBreakBefore - 1
201603
+ };
201604
+ }
201605
+ function indexToPosition(text, textIndex, { oneBased = false } = {}) {
201606
+ if (typeof text !== "string") {
201607
+ throw new TypeError("Text parameter should be a string");
201608
+ }
201609
+ if (!Number.isInteger(textIndex)) {
201610
+ throw new TypeError("Index parameter should be an integer");
201611
+ }
201612
+ if (textIndex < 0 || textIndex > text.length) {
201613
+ throw new RangeError("Index out of bounds");
201614
+ }
201615
+ const position = getPosition(text, textIndex);
201616
+ return oneBased ? { line: position.line + 1, column: position.column + 1 } : position;
201617
+ }
201618
+ var init_index_to_position = __esm({
201619
+ "node_modules/index-to-position/index.js"() {
201620
+ }
201621
+ });
201622
+
201623
+ // node_modules/parse-json/index.js
201624
+ function parseJson(string, reviver, fileName) {
201625
+ if (typeof reviver === "string") {
201626
+ fileName = reviver;
201627
+ reviver = void 0;
201628
+ }
201629
+ try {
201630
+ return JSON.parse(string, reviver);
201631
+ } catch (error) {
201632
+ throw new JSONError({
201633
+ jsonParseError: error,
201634
+ fileName,
201635
+ input: string
201636
+ });
201637
+ }
201638
+ }
201639
+ var import_code_frame, getCodePoint2, JSONError, getErrorLocation, addCodePointToUnexpectedToken;
201640
+ var init_parse_json = __esm({
201641
+ "node_modules/parse-json/index.js"() {
201642
+ import_code_frame = __toESM(require_lib4(), 1);
201643
+ init_index_to_position();
201644
+ getCodePoint2 = (character) => `\\u{${character.codePointAt(0).toString(16)}}`;
201645
+ JSONError = class _JSONError extends Error {
201646
+ name = "JSONError";
201647
+ fileName;
201648
+ #input;
201649
+ #jsonParseError;
201650
+ #message;
201651
+ #codeFrame;
201652
+ #rawCodeFrame;
201653
+ constructor(messageOrOptions) {
201654
+ if (typeof messageOrOptions === "string") {
201655
+ super();
201656
+ this.#message = messageOrOptions;
201657
+ } else {
201658
+ const { jsonParseError, fileName, input } = messageOrOptions;
201659
+ super(void 0, { cause: jsonParseError });
201660
+ this.#input = input;
201661
+ this.#jsonParseError = jsonParseError;
201662
+ this.fileName = fileName;
201663
+ }
201664
+ Error.captureStackTrace?.(this, _JSONError);
201665
+ }
201666
+ get message() {
201667
+ this.#message ??= `${addCodePointToUnexpectedToken(this.#jsonParseError.message)}${this.#input === "" ? " while parsing empty string" : ""}`;
201668
+ const { codeFrame } = this;
201669
+ return `${this.#message}${this.fileName ? ` in ${this.fileName}` : ""}${codeFrame ? `
201670
+
201671
+ ${codeFrame}
201672
+ ` : ""}`;
201673
+ }
201674
+ set message(message) {
201675
+ this.#message = message;
201676
+ }
201677
+ #getCodeFrame(highlightCode) {
201678
+ if (!this.#jsonParseError) {
201679
+ return;
201680
+ }
201681
+ const input = this.#input;
201682
+ const location = getErrorLocation(input, this.#jsonParseError.message);
201683
+ if (!location) {
201684
+ return;
201685
+ }
201686
+ return (0, import_code_frame.codeFrameColumns)(input, { start: location }, { highlightCode });
201687
+ }
201688
+ get codeFrame() {
201689
+ this.#codeFrame ??= this.#getCodeFrame(
201690
+ /* highlightCode */
201691
+ true
201692
+ );
201693
+ return this.#codeFrame;
201694
+ }
201695
+ get rawCodeFrame() {
201696
+ this.#rawCodeFrame ??= this.#getCodeFrame(
201697
+ /* highlightCode */
201698
+ false
201699
+ );
201700
+ return this.#rawCodeFrame;
201701
+ }
201702
+ };
201703
+ getErrorLocation = (string, message) => {
201704
+ const match2 = message.match(/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/);
201705
+ if (!match2) {
201706
+ return;
201707
+ }
201708
+ const { index, line, column } = match2.groups;
201709
+ if (line && column) {
201710
+ return { line: Number(line), column: Number(column) };
201711
+ }
201712
+ return indexToPosition(string, Number(index), { oneBased: true });
201713
+ };
201714
+ addCodePointToUnexpectedToken = (message) => message.replace(
201715
+ // TODO[engine:node@>=20]: The token always quoted after Node.js 20
201716
+ /(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,
201717
+ (_, _quote, token2) => `"${token2}"(${getCodePoint2(token2)})`
201718
+ );
201719
+ }
201720
+ });
201721
+
201561
201722
  // node_modules/normalize-package-data/node_modules/semver/internal/debug.js
201562
201723
  var require_debug4 = __commonJS({
201563
201724
  "node_modules/normalize-package-data/node_modules/semver/internal/debug.js"(exports2, module2) {
@@ -205878,6 +206039,106 @@ var require_normalize2 = __commonJS({
205878
206039
  }
205879
206040
  });
205880
206041
 
206042
+ // node_modules/unicorn-magic/default.js
206043
+ var init_default = __esm({
206044
+ "node_modules/unicorn-magic/default.js"() {
206045
+ }
206046
+ });
206047
+
206048
+ // node_modules/unicorn-magic/node.js
206049
+ import { fileURLToPath as fileURLToPath5 } from "node:url";
206050
+ function toPath2(urlOrPath) {
206051
+ return urlOrPath instanceof URL ? fileURLToPath5(urlOrPath) : urlOrPath;
206052
+ }
206053
+ var init_node3 = __esm({
206054
+ "node_modules/unicorn-magic/node.js"() {
206055
+ init_default();
206056
+ }
206057
+ });
206058
+
206059
+ // node_modules/read-pkg/index.js
206060
+ import fsPromises3 from "node:fs/promises";
206061
+ import path34 from "node:path";
206062
+ async function readPackage({ cwd: cwd2, normalize: normalize5 = true } = {}) {
206063
+ const packageFile = await fsPromises3.readFile(getPackagePath(cwd2), "utf8");
206064
+ return _readPackage(packageFile, normalize5);
206065
+ }
206066
+ var import_normalize_package_data, getPackagePath, _readPackage;
206067
+ var init_read_pkg = __esm({
206068
+ "node_modules/read-pkg/index.js"() {
206069
+ init_parse_json();
206070
+ import_normalize_package_data = __toESM(require_normalize2(), 1);
206071
+ init_node3();
206072
+ getPackagePath = (cwd2) => path34.resolve(toPath2(cwd2) ?? ".", "package.json");
206073
+ _readPackage = (file, normalize5) => {
206074
+ const json2 = typeof file === "string" ? parseJson(file) : file;
206075
+ if (normalize5) {
206076
+ (0, import_normalize_package_data.default)(json2);
206077
+ }
206078
+ return json2;
206079
+ };
206080
+ }
206081
+ });
206082
+
206083
+ // node_modules/read-package-up/index.js
206084
+ import path35 from "node:path";
206085
+ async function readPackageUp(options) {
206086
+ const filePath = await findUp("package.json", options);
206087
+ if (!filePath) {
206088
+ return;
206089
+ }
206090
+ return {
206091
+ packageJson: await readPackage({ ...options, cwd: path35.dirname(filePath) }),
206092
+ path: filePath
206093
+ };
206094
+ }
206095
+ var init_read_package_up = __esm({
206096
+ "node_modules/read-package-up/index.js"() {
206097
+ init_find_up_simple();
206098
+ init_read_pkg();
206099
+ }
206100
+ });
206101
+
206102
+ // packages/cli/src/utils/package.ts
206103
+ import { fileURLToPath as fileURLToPath6 } from "url";
206104
+ import path36 from "path";
206105
+ async function getPackageJson() {
206106
+ if (packageJson) {
206107
+ return packageJson;
206108
+ }
206109
+ const result = await readPackageUp({ cwd: __dirname3 });
206110
+ if (!result) {
206111
+ return;
206112
+ }
206113
+ packageJson = result.packageJson;
206114
+ return packageJson;
206115
+ }
206116
+ var __filename, __dirname3, packageJson;
206117
+ var init_package = __esm({
206118
+ "packages/cli/src/utils/package.ts"() {
206119
+ "use strict";
206120
+ init_read_package_up();
206121
+ __filename = fileURLToPath6(import.meta.url);
206122
+ __dirname3 = path36.dirname(__filename);
206123
+ }
206124
+ });
206125
+
206126
+ // packages/cli/src/utils/version.ts
206127
+ var version_exports = {};
206128
+ __export(version_exports, {
206129
+ getCliVersion: () => getCliVersion
206130
+ });
206131
+ async function getCliVersion() {
206132
+ const pkgJson = await getPackageJson();
206133
+ return "0.1.44";
206134
+ }
206135
+ var init_version5 = __esm({
206136
+ "packages/cli/src/utils/version.ts"() {
206137
+ "use strict";
206138
+ init_package();
206139
+ }
206140
+ });
206141
+
205881
206142
  // packages/cli/src/config/mpdaiConfig.ts
205882
206143
  import { readFileSync as readFileSync9, existsSync as existsSync10 } from "fs";
205883
206144
  import { join as join15 } from "path";
@@ -207164,6 +207425,236 @@ var require_readline_sync = __commonJS({
207164
207425
  }
207165
207426
  });
207166
207427
 
207428
+ // packages/cli/src/services/SSOAuthService.ts
207429
+ import { createServer as createServer3 } from "http";
207430
+ import { URL as URL4 } from "url";
207431
+ import https2 from "https";
207432
+ import { URL as URLClass } from "url";
207433
+ var SSOAuthService;
207434
+ var init_SSOAuthService = __esm({
207435
+ "packages/cli/src/services/SSOAuthService.ts"() {
207436
+ "use strict";
207437
+ init_open();
207438
+ init_mpdaiConfig();
207439
+ SSOAuthService = class {
207440
+ mpdaiConfig;
207441
+ ssoUrl;
207442
+ callbackPort = 12345;
207443
+ callbackUrl;
207444
+ constructor() {
207445
+ this.mpdaiConfig = MpdaiConfigManager.getInstance();
207446
+ this.ssoUrl = "https://jid2v2-drill.id.r-local.net/authentication/jwt-token";
207447
+ this.callbackUrl = `http://localhost:${this.callbackPort}/callback`;
207448
+ }
207449
+ /**
207450
+ * 启动 SSO 认证流程
207451
+ */
207452
+ async performSSOAuth() {
207453
+ const isDebugMode = process.env.DEBUG === "true" || process.env.DEBUG_MODE === "true" || process.env.dev === "true";
207454
+ const redirectUrl = encodeURIComponent(this.callbackUrl);
207455
+ const fullSSOUrl = `${this.ssoUrl}?redirecturl=${redirectUrl}`;
207456
+ if (isDebugMode) {
207457
+ console.log(`Opening browser to: ${fullSSOUrl}`);
207458
+ }
207459
+ console.log("\u{1F310} Opening browser for SSO login...");
207460
+ await open_default(fullSSOUrl);
207461
+ console.log("\u23F3 Waiting for SSO result...");
207462
+ const callbackResult = await this.waitForCallback();
207463
+ if (isDebugMode) {
207464
+ console.log(`Received callback with code: ${callbackResult.code.substring(0, 10)}...`);
207465
+ console.log(`User: ${callbackResult.user}`);
207466
+ }
207467
+ try {
207468
+ await this.verifyCodeWithGraphAPI(callbackResult.code);
207469
+ } catch (error) {
207470
+ const errorMessage = error instanceof Error ? error.message : String(error);
207471
+ throw new Error(`SSO authentication failed: ${errorMessage}`);
207472
+ }
207473
+ const authResponse = await this.authenticateWithSSOToken(callbackResult);
207474
+ return authResponse;
207475
+ }
207476
+ /**
207477
+ * 启动 HTTP 服务器并等待回调
207478
+ */
207479
+ waitForCallback() {
207480
+ return new Promise((resolve18, reject) => {
207481
+ const server = createServer3((req, res) => {
207482
+ if (!req.url) {
207483
+ res.writeHead(400);
207484
+ res.end("Bad Request");
207485
+ return;
207486
+ }
207487
+ const url2 = new URL4(req.url, `http://localhost:${this.callbackPort}`);
207488
+ if (url2.pathname === "/callback") {
207489
+ const code = url2.searchParams.get("code");
207490
+ const user = url2.searchParams.get("user");
207491
+ const sub = url2.searchParams.get("sub");
207492
+ if (code && user) {
207493
+ res.writeHead(200, { "Content-Type": "application/json" });
207494
+ res.end(JSON.stringify({ succeed: true }));
207495
+ server.close();
207496
+ resolve18({ code, user, sub: sub || void 0 });
207497
+ } else {
207498
+ const errorMsg = !code ? "Missing code parameter" : "Missing user parameter";
207499
+ res.writeHead(400, { "Content-Type": "application/json" });
207500
+ res.end(JSON.stringify({ succeed: false, error: errorMsg }));
207501
+ server.close();
207502
+ reject(new Error(errorMsg));
207503
+ }
207504
+ } else {
207505
+ res.writeHead(404);
207506
+ res.end("Not Found");
207507
+ }
207508
+ });
207509
+ server.listen(this.callbackPort, () => {
207510
+ const isDebugMode = process.env.DEBUG === "true" || process.env.DEBUG_MODE === "true" || process.env.dev === "true";
207511
+ if (isDebugMode) {
207512
+ console.log(`Callback server listening on port ${this.callbackPort}`);
207513
+ }
207514
+ });
207515
+ server.on("error", (error) => {
207516
+ reject(error);
207517
+ });
207518
+ setTimeout(() => {
207519
+ server.close();
207520
+ reject(new Error("SSO authentication timeout"));
207521
+ }, 5 * 60 * 1e3);
207522
+ });
207523
+ }
207524
+ /**
207525
+ * 使用 code 验证 Microsoft Graph API
207526
+ */
207527
+ async verifyCodeWithGraphAPI(code) {
207528
+ const isDebugMode = process.env.DEBUG === "true" || process.env.DEBUG_MODE === "true" || process.env.dev === "true";
207529
+ const apiUrl = "https://graph.microsoft.com/v1.0/me/memberOf?$select=id,displayName,mail,mailNickname";
207530
+ const url2 = new URLClass(apiUrl);
207531
+ const makeRequest = (rejectUnauthorized) => {
207532
+ return new Promise((resolve18, reject) => {
207533
+ const options = {
207534
+ hostname: url2.hostname,
207535
+ port: url2.port || 443,
207536
+ path: url2.pathname + url2.search,
207537
+ method: "GET",
207538
+ headers: {
207539
+ "Authorization": `Bearer ${code}`,
207540
+ "Content-Type": "application/json"
207541
+ },
207542
+ // 配置 SSL 选项
207543
+ rejectUnauthorized
207544
+ };
207545
+ const req = https2.request(options, (res) => {
207546
+ let data = "";
207547
+ res.on("data", (chunk) => {
207548
+ data += chunk;
207549
+ });
207550
+ res.on("end", () => {
207551
+ resolve18({
207552
+ statusCode: res.statusCode || 0,
207553
+ statusMessage: res.statusMessage || "",
207554
+ data
207555
+ });
207556
+ });
207557
+ });
207558
+ req.on("error", (error) => {
207559
+ reject(error);
207560
+ });
207561
+ req.end();
207562
+ });
207563
+ };
207564
+ try {
207565
+ if (isDebugMode) {
207566
+ console.log("Verifying code with Microsoft Graph API...");
207567
+ }
207568
+ let response = await makeRequest(true);
207569
+ if (response.statusCode !== 200) {
207570
+ throw new Error(`Graph API verification failed: ${response.statusCode} ${response.statusMessage} - ${response.data}`);
207571
+ }
207572
+ if (isDebugMode) {
207573
+ console.log("Graph API verification successful");
207574
+ }
207575
+ } catch (error) {
207576
+ if (error?.code === "SELF_SIGNED_CERT_IN_CHAIN" || error?.message?.includes("self-signed certificate")) {
207577
+ if (isDebugMode) {
207578
+ console.log("SSL certificate verification failed, retrying without certificate verification...");
207579
+ }
207580
+ try {
207581
+ const response = await makeRequest(false);
207582
+ if (response.statusCode !== 200) {
207583
+ throw new Error(`Graph API verification failed: ${response.statusCode} ${response.statusMessage} - ${response.data}`);
207584
+ }
207585
+ if (isDebugMode) {
207586
+ console.log("Graph API verification successful (without certificate verification)");
207587
+ }
207588
+ } catch (retryError) {
207589
+ console.error("Graph API verification error (retry):", retryError);
207590
+ throw retryError;
207591
+ }
207592
+ } else {
207593
+ console.error("Graph API verification error:", error);
207594
+ throw error;
207595
+ }
207596
+ }
207597
+ }
207598
+ /**
207599
+ * 使用 SSO token 进行认证
207600
+ */
207601
+ async authenticateWithSSOToken(callbackResult) {
207602
+ const isDebugMode = process.env.DEBUG === "true" || process.env.DEBUG_MODE === "true" || process.env.dev === "true";
207603
+ const tokenApiUrl = this.mpdaiConfig.getTokenUrl();
207604
+ const user = callbackResult.user;
207605
+ try {
207606
+ if (isDebugMode) {
207607
+ console.log(`Authenticating with SSO token API: ${tokenApiUrl}`);
207608
+ console.log(`User: ${user}`);
207609
+ }
207610
+ const now = Math.floor(Date.now() / 1e3);
207611
+ const sub = callbackResult.sub || user.split("@")[0];
207612
+ const tokenPayload = {
207613
+ r10_transaction_type: "LOGIN",
207614
+ aud: ["jid_sample_client"],
207615
+ sub,
207616
+ r10_factor: "password",
207617
+ r10_mobile_email: user,
207618
+ auth_time: now,
207619
+ iss: "https://stg.login.account.rakuten.com",
207620
+ exp: now + 365 * 24 * 60 * 60,
207621
+ // 1年后过期
207622
+ iat: now,
207623
+ email: user
207624
+ };
207625
+ const response = await fetch(tokenApiUrl, {
207626
+ method: "POST",
207627
+ headers: {
207628
+ "Content-Type": "application/json"
207629
+ },
207630
+ body: JSON.stringify(tokenPayload)
207631
+ });
207632
+ if (!response.ok) {
207633
+ const errorText = await response.text();
207634
+ throw new Error(`SSO token authentication failed: ${response.status} ${response.statusText} - ${errorText}`);
207635
+ }
207636
+ const data = await response.json();
207637
+ if (!data.success) {
207638
+ throw new Error("SSO token authentication failed: Invalid response");
207639
+ }
207640
+ if (isDebugMode) {
207641
+ console.log("SSO token authentication successful");
207642
+ }
207643
+ return data;
207644
+ } catch (error) {
207645
+ console.error("SSO token authentication error:", error);
207646
+ if (error instanceof Error && error.message.includes("fetch failed")) {
207647
+ console.error("\n\u274C \u65E0\u6CD5\u8FDE\u63A5\u5230\u8BA4\u8BC1\u670D\u52A1\u5668\uFF01");
207648
+ console.error("\u8BF7\u786E\u4FDD\u8BA4\u8BC1API\u670D\u52A1\u6B63\u5728\u8FD0\u884C:");
207649
+ console.error(` ${tokenApiUrl}`);
207650
+ }
207651
+ throw error;
207652
+ }
207653
+ }
207654
+ };
207655
+ }
207656
+ });
207657
+
207167
207658
  // packages/cli/src/services/EnvConfigManager.ts
207168
207659
  var EnvConfigManager_exports = {};
207169
207660
  __export(EnvConfigManager_exports, {
@@ -207676,6 +208167,7 @@ var init_AuthService = __esm({
207676
208167
  init_dist3();
207677
208168
  init_mpdaiConfig();
207678
208169
  readlineSync = __toESM(require_readline_sync(), 1);
208170
+ init_SSOAuthService();
207679
208171
  AuthService = class {
207680
208172
  userJsonPath;
207681
208173
  keysJsonPath;
@@ -207707,6 +208199,9 @@ var init_AuthService = __esm({
207707
208199
  }
207708
208200
  const content = readFileSync11(this.userJsonPath, "utf-8");
207709
208201
  const credentials = JSON.parse(content);
208202
+ if (credentials.sso) {
208203
+ return credentials;
208204
+ }
207710
208205
  if (credentials.encodedPassword) {
207711
208206
  credentials.password = Buffer.from(credentials.encodedPassword, "base64").toString("utf-8");
207712
208207
  delete credentials.encodedPassword;
@@ -207718,7 +208213,7 @@ var init_AuthService = __esm({
207718
208213
  }
207719
208214
  }
207720
208215
  /**
207721
- * 检查是否有 username 但没有 encodedPassword
208216
+ * 检查是否有 username 但没有 encodedPassword(且不是 SSO)
207722
208217
  */
207723
208218
  hasUsernameWithoutPassword() {
207724
208219
  try {
@@ -207727,6 +208222,9 @@ var init_AuthService = __esm({
207727
208222
  }
207728
208223
  const content = readFileSync11(this.userJsonPath, "utf-8");
207729
208224
  const credentials = JSON.parse(content);
208225
+ if (credentials.sso) {
208226
+ return false;
208227
+ }
207730
208228
  return !!(credentials.username && !credentials.encodedPassword);
207731
208229
  } catch (error) {
207732
208230
  return false;
@@ -207812,9 +208310,13 @@ var init_AuthService = __esm({
207812
208310
  mkdirSync4(dir, { recursive: true });
207813
208311
  }
207814
208312
  const credentialsToSave = {
207815
- username: credentials.username,
207816
- encodedPassword: Buffer.from(credentials.password, "utf-8").toString("base64")
208313
+ username: credentials.username
207817
208314
  };
208315
+ if (credentials.sso) {
208316
+ credentialsToSave.sso = true;
208317
+ } else if (credentials.password) {
208318
+ credentialsToSave.encodedPassword = Buffer.from(credentials.password, "utf-8").toString("base64");
208319
+ }
207818
208320
  writeFileSync4(this.userJsonPath, JSON.stringify(credentialsToSave, null, 2), "utf-8");
207819
208321
  } catch (error) {
207820
208322
  console.error("Failed to save user credentials:", error);
@@ -207927,6 +208429,25 @@ var init_AuthService = __esm({
207927
208429
  async performAuthFlow() {
207928
208430
  const isDebugMode = process.env.DEBUG === "true" || process.env.DEBUG_MODE === "true" || process.env.dev === "true";
207929
208431
  let credentials = this.getLocalCredentials();
208432
+ if (credentials?.sso) {
208433
+ if (isDebugMode) {
208434
+ console.log("Found SSO credentials, performing SSO login...");
208435
+ }
208436
+ const ssoAuthService = new SSOAuthService();
208437
+ const authResponse2 = await ssoAuthService.performSSOAuth();
208438
+ const ssoCredentials = {
208439
+ username: authResponse2.user.username,
208440
+ sso: true
208441
+ };
208442
+ this.saveCredentials(ssoCredentials);
208443
+ if (authResponse2.keys && authResponse2.keys.length > 0) {
208444
+ this.saveKeys(authResponse2.keys);
208445
+ if (isDebugMode) {
208446
+ console.log(`Saved ${authResponse2.keys.length} keys to local storage`);
208447
+ }
208448
+ }
208449
+ return authResponse2;
208450
+ }
207930
208451
  if (this.hasUsernameWithoutPassword()) {
207931
208452
  if (isDebugMode) {
207932
208453
  console.log("Found username without password, trying token-based authentication...");
@@ -207961,30 +208482,58 @@ var init_AuthService = __esm({
207961
208482
  }
207962
208483
  }
207963
208484
  if (!credentials) {
207964
- if (isDebugMode) {
207965
- console.log("No local credentials found, prompting for user input...");
207966
- console.log("stdin isTTY:", process.stdin.isTTY);
207967
- console.log("stdout isTTY:", process.stdout.isTTY);
207968
- }
207969
- if (isDebugMode) {
207970
- console.log("Prompting for user credentials...");
207971
- }
207972
- const username = readlineSync.question("Enter your username: ");
207973
- if (isDebugMode) {
207974
- console.log("Username received, asking for password...");
207975
- }
207976
- const password = readlineSync.question("Enter your password: ", {
207977
- hideEchoBack: true
207978
- // 隐藏输入,显示*号
207979
- });
207980
- if (isDebugMode) {
207981
- console.log("Credentials received, proceeding with authentication...");
208485
+ console.log("\nPlease select login method:");
208486
+ console.log("1. Rakuten OKTA SSO Login");
208487
+ console.log("2. Username/Password Login");
208488
+ const choice2 = readlineSync.question("\nPlease select (1 or 2): ");
208489
+ if (choice2 === "1") {
208490
+ if (isDebugMode) {
208491
+ console.log("User selected SSO login");
208492
+ }
208493
+ const ssoAuthService = new SSOAuthService();
208494
+ const authResponse2 = await ssoAuthService.performSSOAuth();
208495
+ const ssoCredentials = {
208496
+ username: authResponse2.user.username,
208497
+ sso: true
208498
+ };
208499
+ this.saveCredentials(ssoCredentials);
208500
+ if (authResponse2.keys && authResponse2.keys.length > 0) {
208501
+ this.saveKeys(authResponse2.keys);
208502
+ if (isDebugMode) {
208503
+ console.log(`Saved ${authResponse2.keys.length} keys to local storage`);
208504
+ }
208505
+ }
208506
+ return authResponse2;
208507
+ } else {
208508
+ if (isDebugMode) {
208509
+ console.log("User selected username/password login");
208510
+ console.log("No local credentials found, prompting for user input...");
208511
+ console.log("stdin isTTY:", process.stdin.isTTY);
208512
+ console.log("stdout isTTY:", process.stdout.isTTY);
208513
+ }
208514
+ if (isDebugMode) {
208515
+ console.log("Prompting for user credentials...");
208516
+ }
208517
+ const username = readlineSync.question("Enter your username: ");
208518
+ if (isDebugMode) {
208519
+ console.log("Username received, asking for password...");
208520
+ }
208521
+ const password = readlineSync.question("Enter your password: ", {
208522
+ hideEchoBack: true
208523
+ // 隐藏输入,显示*号
208524
+ });
208525
+ if (isDebugMode) {
208526
+ console.log("Credentials received, proceeding with authentication...");
208527
+ }
208528
+ credentials = { username, password };
207982
208529
  }
207983
- credentials = { username, password };
207984
208530
  } else {
207985
208531
  if (isDebugMode) {
207986
208532
  console.log("Found local credentials, using them for authentication...");
207987
208533
  }
208534
+ if (credentials.sso) {
208535
+ throw new Error("SSO credentials found but not handled. This should not happen.");
208536
+ }
207988
208537
  }
207989
208538
  const authResponse = await this.authenticate(credentials);
207990
208539
  if (!this.hasLocalCredentials()) {
@@ -212010,7 +212559,7 @@ var require_server2 = __commonJS({
212010
212559
  "node_modules/fastify/lib/server.js"(exports2, module2) {
212011
212560
  "use strict";
212012
212561
  var http2 = __require("node:http");
212013
- var https2 = __require("node:https");
212562
+ var https3 = __require("node:https");
212014
212563
  var http22 = __require("node:http2");
212015
212564
  var dns = __require("node:dns");
212016
212565
  var os24 = __require("node:os");
@@ -212023,11 +212572,11 @@ var require_server2 = __commonJS({
212023
212572
  FST_ERR_LISTEN_OPTIONS_INVALID
212024
212573
  } = require_errors4();
212025
212574
  var PonyPromise = require_promise2();
212026
- module2.exports.createServer = createServer4;
212575
+ module2.exports.createServer = createServer5;
212027
212576
  function defaultResolveServerListeningText(address) {
212028
212577
  return `Server listening at ${address}`;
212029
212578
  }
212030
- function createServer4(options, httpHandler) {
212579
+ function createServer5(options, httpHandler) {
212031
212580
  const server = getServerInstance(options, httpHandler);
212032
212581
  function listen(listenOptions = { port: 0, host: "localhost" }, cb = void 0) {
212033
212582
  if (typeof cb === "function") {
@@ -212237,7 +212786,7 @@ var require_server2 = __commonJS({
212237
212786
  server2.setTimeout(options.connectionTimeout);
212238
212787
  return server2;
212239
212788
  }
212240
- const server = httpsOptions ? https2.createServer(httpsOptions, httpHandler) : http2.createServer(options.http, httpHandler);
212789
+ const server = httpsOptions ? https3.createServer(httpsOptions, httpHandler) : http2.createServer(options.http, httpHandler);
212241
212790
  server.keepAliveTimeout = options.keepAliveTimeout;
212242
212791
  server.requestTimeout = options.requestTimeout;
212243
212792
  server.setTimeout(options.connectionTimeout);
@@ -251053,13 +251602,13 @@ var require_process_warning2 = __commonJS({
251053
251602
  var require_parse_url2 = __commonJS({
251054
251603
  "node_modules/light-my-request/lib/parse-url.js"(exports2, module2) {
251055
251604
  "use strict";
251056
- var { URL: URL4 } = __require("node:url");
251605
+ var { URL: URL5 } = __require("node:url");
251057
251606
  var BASE_URL = "http://localhost";
251058
251607
  module2.exports = function parseURL(url2, query) {
251059
251608
  if ((typeof url2 === "string" || Object.prototype.toString.call(url2) === "[object String]") && url2.startsWith("//")) {
251060
251609
  url2 = BASE_URL + url2;
251061
251610
  }
251062
- const result = typeof url2 === "object" ? Object.assign(new URL4(BASE_URL), url2) : new URL4(url2, BASE_URL);
251611
+ const result = typeof url2 === "object" ? Object.assign(new URL5(BASE_URL), url2) : new URL5(url2, BASE_URL);
251063
251612
  if (typeof query === "string") {
251064
251613
  query = new URLSearchParams(query);
251065
251614
  for (const key of query.keys()) {
@@ -252733,7 +253282,7 @@ var require_fastify = __commonJS({
252733
253282
  kGenReqId,
252734
253283
  kErrorHandlerAlreadySet
252735
253284
  } = require_symbols3();
252736
- var { createServer: createServer4 } = require_server2();
253285
+ var { createServer: createServer5 } = require_server2();
252737
253286
  var Reply = require_reply();
252738
253287
  var Request2 = require_request3();
252739
253288
  var Context2 = require_context();
@@ -252843,7 +253392,7 @@ var require_fastify = __commonJS({
252843
253392
  const fourOhFour = build404(options);
252844
253393
  const httpHandler = wrapRouting(router2, options);
252845
253394
  options.http2SessionTimeout = initialConfig.http2SessionTimeout;
252846
- const { server, listen } = createServer4(options, httpHandler);
253395
+ const { server, listen } = createServer5(options, httpHandler);
252847
253396
  const serverHasCloseAllConnections = typeof server.closeAllConnections === "function";
252848
253397
  const serverHasCloseIdleConnections = typeof server.closeIdleConnections === "function";
252849
253398
  const serverHasCloseHttp2Sessions = typeof server.closeHttp2Sessions === "function";
@@ -276275,7 +276824,7 @@ var require_package7 = __commonJS({
276275
276824
  "packages/router/package.json"(exports2, module2) {
276276
276825
  module2.exports = {
276277
276826
  name: "@mpdai/router",
276278
- version: "0.1.8",
276827
+ version: "0.1.9",
276279
276828
  description: "MPD AI Router - Route Claude Code to other LLM providers",
276280
276829
  type: "module",
276281
276830
  main: "dist/index.js",
@@ -276319,7 +276868,7 @@ var require_package7 = __commonJS({
276319
276868
  import { join as join19, dirname as dirname7 } from "path";
276320
276869
  import { fileURLToPath as fileURLToPath7 } from "url";
276321
276870
  import { readdirSync as readdirSync2, statSync as statSync2, readFileSync as readFileSync12, writeFileSync as writeFileSync5, existsSync as existsSync13 } from "fs";
276322
- var import_static, __filename2, __dirname4, createServer3;
276871
+ var import_static, __filename2, __dirname4, createServer4;
276323
276872
  var init_server3 = __esm({
276324
276873
  "packages/router/dist/src/server.js"() {
276325
276874
  "use strict";
@@ -276331,7 +276880,7 @@ var init_server3 = __esm({
276331
276880
  init_constants2();
276332
276881
  __filename2 = fileURLToPath7(import.meta.url);
276333
276882
  __dirname4 = dirname7(__filename2);
276334
- createServer3 = (config2) => {
276883
+ createServer4 = (config2) => {
276335
276884
  const server = new pR(config2);
276336
276885
  server.app.post("/v1/messages/count_tokens", async (req, reply) => {
276337
276886
  const { messages, tools, system } = req.body;
@@ -278092,7 +278641,7 @@ async function run(options = {}) {
278092
278641
  })
278093
278642
  } : false;
278094
278643
  const actualConfigFilePath = await getConfigFilePath();
278095
- const server = createServer3({
278644
+ const server = createServer4({
278096
278645
  jsonPath: actualConfigFilePath,
278097
278646
  initialConfig: {
278098
278647
  providers: config2.Providers || config2.providers,
@@ -310260,221 +310809,10 @@ import { promises as fs36 } from "fs";
310260
310809
  import path40 from "path";
310261
310810
 
310262
310811
  // packages/cli/src/generated/git-commit.ts
310263
- var GIT_COMMIT_INFO = "177fa1b (local modifications)";
310264
-
310265
- // node_modules/read-package-up/index.js
310266
- import path35 from "node:path";
310267
-
310268
- // node_modules/find-up-simple/index.js
310269
- import process24 from "node:process";
310270
- import fsPromises2 from "node:fs/promises";
310271
- import { fileURLToPath as fileURLToPath4 } from "node:url";
310272
- import path33 from "node:path";
310273
- var toPath = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath4(urlOrPath) : urlOrPath;
310274
- async function findUp(name2, {
310275
- cwd: cwd2 = process24.cwd(),
310276
- type = "file",
310277
- stopAt
310278
- } = {}) {
310279
- let directory = path33.resolve(toPath(cwd2) ?? "");
310280
- const { root } = path33.parse(directory);
310281
- stopAt = path33.resolve(directory, toPath(stopAt ?? root));
310282
- const isAbsoluteName = path33.isAbsolute(name2);
310283
- while (directory) {
310284
- const filePath = isAbsoluteName ? name2 : path33.join(directory, name2);
310285
- try {
310286
- const stats = await fsPromises2.stat(filePath);
310287
- if (type === "file" && stats.isFile() || type === "directory" && stats.isDirectory()) {
310288
- return filePath;
310289
- }
310290
- } catch {
310291
- }
310292
- if (directory === stopAt || directory === root) {
310293
- break;
310294
- }
310295
- directory = path33.dirname(directory);
310296
- }
310297
- }
310298
-
310299
- // node_modules/read-pkg/index.js
310300
- import fsPromises3 from "node:fs/promises";
310301
- import path34 from "node:path";
310812
+ var GIT_COMMIT_INFO = "a3c918a (local modifications)";
310302
310813
 
310303
- // node_modules/parse-json/index.js
310304
- var import_code_frame = __toESM(require_lib4(), 1);
310305
-
310306
- // node_modules/index-to-position/index.js
310307
- function getPosition(text, textIndex) {
310308
- const lineBreakBefore = textIndex === 0 ? -1 : text.lastIndexOf("\n", textIndex - 1);
310309
- return {
310310
- line: lineBreakBefore === -1 ? 0 : text.slice(0, lineBreakBefore + 1).match(/\n/g).length,
310311
- column: textIndex - lineBreakBefore - 1
310312
- };
310313
- }
310314
- function indexToPosition(text, textIndex, { oneBased = false } = {}) {
310315
- if (typeof text !== "string") {
310316
- throw new TypeError("Text parameter should be a string");
310317
- }
310318
- if (!Number.isInteger(textIndex)) {
310319
- throw new TypeError("Index parameter should be an integer");
310320
- }
310321
- if (textIndex < 0 || textIndex > text.length) {
310322
- throw new RangeError("Index out of bounds");
310323
- }
310324
- const position = getPosition(text, textIndex);
310325
- return oneBased ? { line: position.line + 1, column: position.column + 1 } : position;
310326
- }
310327
-
310328
- // node_modules/parse-json/index.js
310329
- var getCodePoint2 = (character) => `\\u{${character.codePointAt(0).toString(16)}}`;
310330
- var JSONError = class _JSONError extends Error {
310331
- name = "JSONError";
310332
- fileName;
310333
- #input;
310334
- #jsonParseError;
310335
- #message;
310336
- #codeFrame;
310337
- #rawCodeFrame;
310338
- constructor(messageOrOptions) {
310339
- if (typeof messageOrOptions === "string") {
310340
- super();
310341
- this.#message = messageOrOptions;
310342
- } else {
310343
- const { jsonParseError, fileName, input } = messageOrOptions;
310344
- super(void 0, { cause: jsonParseError });
310345
- this.#input = input;
310346
- this.#jsonParseError = jsonParseError;
310347
- this.fileName = fileName;
310348
- }
310349
- Error.captureStackTrace?.(this, _JSONError);
310350
- }
310351
- get message() {
310352
- this.#message ??= `${addCodePointToUnexpectedToken(this.#jsonParseError.message)}${this.#input === "" ? " while parsing empty string" : ""}`;
310353
- const { codeFrame } = this;
310354
- return `${this.#message}${this.fileName ? ` in ${this.fileName}` : ""}${codeFrame ? `
310355
-
310356
- ${codeFrame}
310357
- ` : ""}`;
310358
- }
310359
- set message(message) {
310360
- this.#message = message;
310361
- }
310362
- #getCodeFrame(highlightCode) {
310363
- if (!this.#jsonParseError) {
310364
- return;
310365
- }
310366
- const input = this.#input;
310367
- const location = getErrorLocation(input, this.#jsonParseError.message);
310368
- if (!location) {
310369
- return;
310370
- }
310371
- return (0, import_code_frame.codeFrameColumns)(input, { start: location }, { highlightCode });
310372
- }
310373
- get codeFrame() {
310374
- this.#codeFrame ??= this.#getCodeFrame(
310375
- /* highlightCode */
310376
- true
310377
- );
310378
- return this.#codeFrame;
310379
- }
310380
- get rawCodeFrame() {
310381
- this.#rawCodeFrame ??= this.#getCodeFrame(
310382
- /* highlightCode */
310383
- false
310384
- );
310385
- return this.#rawCodeFrame;
310386
- }
310387
- };
310388
- var getErrorLocation = (string, message) => {
310389
- const match2 = message.match(/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/);
310390
- if (!match2) {
310391
- return;
310392
- }
310393
- const { index, line, column } = match2.groups;
310394
- if (line && column) {
310395
- return { line: Number(line), column: Number(column) };
310396
- }
310397
- return indexToPosition(string, Number(index), { oneBased: true });
310398
- };
310399
- var addCodePointToUnexpectedToken = (message) => message.replace(
310400
- // TODO[engine:node@>=20]: The token always quoted after Node.js 20
310401
- /(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,
310402
- (_, _quote, token2) => `"${token2}"(${getCodePoint2(token2)})`
310403
- );
310404
- function parseJson(string, reviver, fileName) {
310405
- if (typeof reviver === "string") {
310406
- fileName = reviver;
310407
- reviver = void 0;
310408
- }
310409
- try {
310410
- return JSON.parse(string, reviver);
310411
- } catch (error) {
310412
- throw new JSONError({
310413
- jsonParseError: error,
310414
- fileName,
310415
- input: string
310416
- });
310417
- }
310418
- }
310419
-
310420
- // node_modules/read-pkg/index.js
310421
- var import_normalize_package_data = __toESM(require_normalize2(), 1);
310422
-
310423
- // node_modules/unicorn-magic/node.js
310424
- import { fileURLToPath as fileURLToPath5 } from "node:url";
310425
- function toPath2(urlOrPath) {
310426
- return urlOrPath instanceof URL ? fileURLToPath5(urlOrPath) : urlOrPath;
310427
- }
310428
-
310429
- // node_modules/read-pkg/index.js
310430
- var getPackagePath = (cwd2) => path34.resolve(toPath2(cwd2) ?? ".", "package.json");
310431
- var _readPackage = (file, normalize5) => {
310432
- const json2 = typeof file === "string" ? parseJson(file) : file;
310433
- if (normalize5) {
310434
- (0, import_normalize_package_data.default)(json2);
310435
- }
310436
- return json2;
310437
- };
310438
- async function readPackage({ cwd: cwd2, normalize: normalize5 = true } = {}) {
310439
- const packageFile = await fsPromises3.readFile(getPackagePath(cwd2), "utf8");
310440
- return _readPackage(packageFile, normalize5);
310441
- }
310442
-
310443
- // node_modules/read-package-up/index.js
310444
- async function readPackageUp(options) {
310445
- const filePath = await findUp("package.json", options);
310446
- if (!filePath) {
310447
- return;
310448
- }
310449
- return {
310450
- packageJson: await readPackage({ ...options, cwd: path35.dirname(filePath) }),
310451
- path: filePath
310452
- };
310453
- }
310454
-
310455
- // packages/cli/src/utils/package.ts
310456
- import { fileURLToPath as fileURLToPath6 } from "url";
310457
- import path36 from "path";
310458
- var __filename = fileURLToPath6(import.meta.url);
310459
- var __dirname3 = path36.dirname(__filename);
310460
- var packageJson;
310461
- async function getPackageJson() {
310462
- if (packageJson) {
310463
- return packageJson;
310464
- }
310465
- const result = await readPackageUp({ cwd: __dirname3 });
310466
- if (!result) {
310467
- return;
310468
- }
310469
- packageJson = result.packageJson;
310470
- return packageJson;
310471
- }
310472
-
310473
- // packages/cli/src/utils/version.ts
310474
- async function getCliVersion() {
310475
- const pkgJson = await getPackageJson();
310476
- return "0.1.43";
310477
- }
310814
+ // packages/cli/src/ui/hooks/slashCommandProcessor.ts
310815
+ init_version5();
310478
310816
 
310479
310817
  // packages/cli/src/ui/commands/memoryCommand.ts
310480
310818
  init_dist3();
@@ -330547,8 +330885,12 @@ function filterActiveExtensions(extensions, enabledExtensionNames) {
330547
330885
  return activeExtensions;
330548
330886
  }
330549
330887
 
330888
+ // packages/cli/src/config/config.ts
330889
+ init_version5();
330890
+
330550
330891
  // packages/cli/src/config/sandboxConfig.ts
330551
330892
  var import_command_exists = __toESM(require_command_exists2(), 1);
330893
+ init_package();
330552
330894
  import * as os13 from "node:os";
330553
330895
  var VALID_SANDBOX_COMMANDS = [
330554
330896
  "docker",
@@ -331742,7 +332084,7 @@ var DataCollector = class {
331742
332084
  // 提取元数据
331743
332085
  extractMetadata(data) {
331744
332086
  return {
331745
- cli_version: "0.1.43",
332087
+ cli_version: "0.1.44",
331746
332088
  model: process.env.CUSTOM_LLM_MODEL_NAME || "gemini",
331747
332089
  auth_type: process.env.USE_CUSTOM_LLM ? "custom_llm" : "google_oauth",
331748
332090
  project_path: data.projectPath,
@@ -337156,6 +337498,7 @@ function updateNotifier(options) {
337156
337498
 
337157
337499
  // packages/cli/src/ui/utils/updateCheck.ts
337158
337500
  var import_semver3 = __toESM(require_semver13(), 1);
337501
+ init_package();
337159
337502
  async function checkForUpdates2() {
337160
337503
  try {
337161
337504
  const packageJson4 = await getPackageJson();
@@ -339331,13 +339674,18 @@ async function handleClaudeCodeCommand(args) {
339331
339674
  return true;
339332
339675
  }
339333
339676
  async function main() {
339677
+ const args = process.argv.slice(2);
339678
+ if (args.length > 0 && args[0] === "--version") {
339679
+ const { getCliVersion: getCliVersion2 } = await Promise.resolve().then(() => (init_version5(), version_exports));
339680
+ const version3 = await getCliVersion2();
339681
+ console.log(version3);
339682
+ return;
339683
+ }
339334
339684
  const commandName = basename5(process.argv[1]);
339335
339685
  if (commandName === "frankcode") {
339336
- const args2 = process.argv.slice(2);
339337
- await handleClaudeCodeCommand(args2);
339686
+ await handleClaudeCodeCommand(args);
339338
339687
  return;
339339
339688
  }
339340
- const args = process.argv.slice(2);
339341
339689
  if (args.length > 0 && args[0] === "router") {
339342
339690
  const handled = await handleRouterCommand("router", args.slice(1));
339343
339691
  if (handled) {