mpd-llm-cli 0.1.25 → 0.1.31

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/api.cjs CHANGED
@@ -2882,7 +2882,7 @@ var require_require_directory = __commonJS({
2882
2882
  "node_modules/require-directory/index.js"(exports2, module2) {
2883
2883
  "use strict";
2884
2884
  var fs29 = require("fs");
2885
- var join14 = require("path").join;
2885
+ var join15 = require("path").join;
2886
2886
  var resolve16 = require("path").resolve;
2887
2887
  var dirname9 = require("path").dirname;
2888
2888
  var defaultOptions2 = {
@@ -2919,7 +2919,7 @@ var require_require_directory = __commonJS({
2919
2919
  }
2920
2920
  path35 = !path35 ? dirname9(m.filename) : resolve16(dirname9(m.filename), path35);
2921
2921
  fs29.readdirSync(path35).forEach(function(filename) {
2922
- var joined = join14(path35, filename), files, key, obj;
2922
+ var joined = join15(path35, filename), files, key, obj;
2923
2923
  if (fs29.statSync(joined).isDirectory() && options.recurse) {
2924
2924
  files = requireDirectory(m, joined, options);
2925
2925
  if (Object.keys(files).length) {
@@ -19533,10 +19533,10 @@ async function cacheCredentials(credentials) {
19533
19533
  await import_node_fs4.promises.writeFile(filePath, credString);
19534
19534
  }
19535
19535
  function getCachedCredentialPath() {
19536
- return import_node_path2.default.join(os2.homedir(), GEMINI_DIR, CREDENTIAL_FILENAME);
19536
+ return import_node_path2.default.join(os2.homedir(), MPDAI_DIR, CREDENTIAL_FILENAME);
19537
19537
  }
19538
19538
  function getGoogleAccountIdCachePath() {
19539
- return import_node_path2.default.join(os2.homedir(), GEMINI_DIR, GOOGLE_ACCOUNT_ID_FILENAME);
19539
+ return import_node_path2.default.join(os2.homedir(), MPDAI_DIR, GOOGLE_ACCOUNT_ID_FILENAME);
19540
19540
  }
19541
19541
  async function cacheGoogleAccountId(googleAccountId) {
19542
19542
  const filePath = getGoogleAccountIdCachePath();
@@ -19591,7 +19591,7 @@ async function getRawGoogleAccountId(client) {
19591
19591
  return null;
19592
19592
  }
19593
19593
  }
19594
- var import_google_auth_library, http, import_url2, import_crypto5, net, import_node_path2, import_node_fs4, os2, OAUTH_CLIENT_ID, OAUTH_CLIENT_SECRET, OAUTH_SCOPE, HTTP_REDIRECT, SIGN_IN_SUCCESS_URL, SIGN_IN_FAILURE_URL, GEMINI_DIR, CREDENTIAL_FILENAME, GOOGLE_ACCOUNT_ID_FILENAME;
19594
+ var import_google_auth_library, http, import_url2, import_crypto5, net, import_node_path2, import_node_fs4, os2, OAUTH_CLIENT_ID, OAUTH_CLIENT_SECRET, OAUTH_SCOPE, HTTP_REDIRECT, SIGN_IN_SUCCESS_URL, SIGN_IN_FAILURE_URL, MPDAI_DIR, CREDENTIAL_FILENAME, GOOGLE_ACCOUNT_ID_FILENAME;
19595
19595
  var init_oauth2 = __esm({
19596
19596
  "packages/core/dist/src/code_assist/oauth2.js"() {
19597
19597
  "use strict";
@@ -19616,7 +19616,7 @@ var init_oauth2 = __esm({
19616
19616
  HTTP_REDIRECT = 301;
19617
19617
  SIGN_IN_SUCCESS_URL = "https://developers.google.com/gemini-code-assist/auth_success_gemini";
19618
19618
  SIGN_IN_FAILURE_URL = "https://developers.google.com/gemini-code-assist/auth_failure_gemini";
19619
- GEMINI_DIR = ".gemini";
19619
+ MPDAI_DIR = ".mpdai";
19620
19620
  CREDENTIAL_FILENAME = "oauth_creds.json";
19621
19621
  GOOGLE_ACCOUNT_ID_FILENAME = "google_account_id";
19622
19622
  }
@@ -19951,7 +19951,7 @@ var init_setup = __esm({
19951
19951
  init_server();
19952
19952
  ProjectIdRequiredError = class extends Error {
19953
19953
  constructor() {
19954
- super("This account requires setting the GOOGLE_CLOUD_PROJECT env var. See https://goo.gle/gemini-cli-auth-docs#workspace-gca");
19954
+ super("This account requires setting the GOOGLE_CLOUD_PROJECT env var. See https://git.rakuten-it.com/projects/MPD-AI/repos/mpd-llm-cli/browse/docs/cli/authentication.md");
19955
19955
  }
19956
19956
  };
19957
19957
  }
@@ -35857,14 +35857,14 @@ var require_util4 = __commonJS({
35857
35857
  });
35858
35858
  }
35859
35859
  exports2.useFunc = useFunc;
35860
- var Type16;
35861
- (function(Type17) {
35862
- Type17[Type17["Num"] = 0] = "Num";
35863
- Type17[Type17["Str"] = 1] = "Str";
35864
- })(Type16 || (exports2.Type = Type16 = {}));
35860
+ var Type21;
35861
+ (function(Type22) {
35862
+ Type22[Type22["Num"] = 0] = "Num";
35863
+ Type22[Type22["Str"] = 1] = "Str";
35864
+ })(Type21 || (exports2.Type = Type21 = {}));
35865
35865
  function getErrorPath(dataProp, dataPropType, jsPropertySyntax) {
35866
35866
  if (dataProp instanceof codegen_1.Name) {
35867
- const isNumber3 = dataPropType === Type16.Num;
35867
+ const isNumber3 = dataPropType === Type21.Num;
35868
35868
  return jsPropertySyntax ? isNumber3 ? (0, codegen_1._)`"[" + ${dataProp} + "]"` : (0, codegen_1._)`"['" + ${dataProp} + "']"` : isNumber3 ? (0, codegen_1._)`"/" + ${dataProp}` : (0, codegen_1._)`"/" + ${dataProp}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
35869
35869
  }
35870
35870
  return jsPropertySyntax ? (0, codegen_1.getProperty)(dataProp).toString() : "/" + escapeJsonPointer(dataProp);
@@ -61736,7 +61736,7 @@ var require_namespace = __commonJS({
61736
61736
  var Field = require_field();
61737
61737
  var util3 = require_util8();
61738
61738
  var OneOf = require_oneof();
61739
- var Type16;
61739
+ var Type21;
61740
61740
  var Service;
61741
61741
  var Enum;
61742
61742
  Namespace.fromJSON = function fromJSON(name2, json) {
@@ -61804,7 +61804,7 @@ var require_namespace = __commonJS({
61804
61804
  nested = nestedJson[names[i]];
61805
61805
  ns.add(
61806
61806
  // most to least likely
61807
- (nested.fields !== void 0 ? Type16.fromJSON : nested.values !== void 0 ? Enum.fromJSON : nested.methods !== void 0 ? Service.fromJSON : nested.id !== void 0 ? Field.fromJSON : Namespace.fromJSON)(names[i], nested)
61807
+ (nested.fields !== void 0 ? Type21.fromJSON : nested.values !== void 0 ? Enum.fromJSON : nested.methods !== void 0 ? Service.fromJSON : nested.id !== void 0 ? Field.fromJSON : Namespace.fromJSON)(names[i], nested)
61808
61808
  );
61809
61809
  }
61810
61810
  }
@@ -61819,14 +61819,14 @@ var require_namespace = __commonJS({
61819
61819
  throw Error("no such enum: " + name2);
61820
61820
  };
61821
61821
  Namespace.prototype.add = function add(object) {
61822
- if (!(object instanceof Field && object.extend !== void 0 || object instanceof Type16 || object instanceof OneOf || object instanceof Enum || object instanceof Service || object instanceof Namespace))
61822
+ if (!(object instanceof Field && object.extend !== void 0 || object instanceof Type21 || object instanceof OneOf || object instanceof Enum || object instanceof Service || object instanceof Namespace))
61823
61823
  throw TypeError("object must be a valid nested object");
61824
61824
  if (!this.nested)
61825
61825
  this.nested = {};
61826
61826
  else {
61827
61827
  var prev = this.get(object.name);
61828
61828
  if (prev) {
61829
- if (prev instanceof Namespace && object instanceof Namespace && !(prev instanceof Type16 || prev instanceof Service)) {
61829
+ if (prev instanceof Namespace && object instanceof Namespace && !(prev instanceof Type21 || prev instanceof Service)) {
61830
61830
  var nested = prev.nestedArray;
61831
61831
  for (var i = 0; i < nested.length; ++i)
61832
61832
  object.add(nested[i]);
@@ -61839,7 +61839,7 @@ var require_namespace = __commonJS({
61839
61839
  }
61840
61840
  }
61841
61841
  this.nested[object.name] = object;
61842
- if (!(this instanceof Type16 || this instanceof Service || this instanceof Enum || this instanceof Field)) {
61842
+ if (!(this instanceof Type21 || this instanceof Service || this instanceof Enum || this instanceof Field)) {
61843
61843
  if (!object._edition) {
61844
61844
  object._edition = object._defaultEdition;
61845
61845
  }
@@ -61966,7 +61966,7 @@ var require_namespace = __commonJS({
61966
61966
  return exact;
61967
61967
  };
61968
61968
  Namespace.prototype.lookupType = function lookupType(path35) {
61969
- var found = this.lookup(path35, [Type16]);
61969
+ var found = this.lookup(path35, [Type21]);
61970
61970
  if (!found)
61971
61971
  throw Error("no such type: " + path35);
61972
61972
  return found;
@@ -61978,7 +61978,7 @@ var require_namespace = __commonJS({
61978
61978
  return found;
61979
61979
  };
61980
61980
  Namespace.prototype.lookupTypeOrEnum = function lookupTypeOrEnum(path35) {
61981
- var found = this.lookup(path35, [Type16, Enum]);
61981
+ var found = this.lookup(path35, [Type21, Enum]);
61982
61982
  if (!found)
61983
61983
  throw Error("no such Type or Enum '" + path35 + "' in " + this);
61984
61984
  return found;
@@ -61990,7 +61990,7 @@ var require_namespace = __commonJS({
61990
61990
  return found;
61991
61991
  };
61992
61992
  Namespace._configure = function(Type_, Service_, Enum_) {
61993
- Type16 = Type_;
61993
+ Type21 = Type_;
61994
61994
  Service = Service_;
61995
61995
  Enum = Enum_;
61996
61996
  };
@@ -62687,9 +62687,9 @@ var require_wrappers = __commonJS({
62687
62687
  var require_type = __commonJS({
62688
62688
  "node_modules/protobufjs/src/type.js"(exports2, module2) {
62689
62689
  "use strict";
62690
- module2.exports = Type16;
62690
+ module2.exports = Type21;
62691
62691
  var Namespace = require_namespace();
62692
- ((Type16.prototype = Object.create(Namespace.prototype)).constructor = Type16).className = "Type";
62692
+ ((Type21.prototype = Object.create(Namespace.prototype)).constructor = Type21).className = "Type";
62693
62693
  var Enum = require_enum3();
62694
62694
  var OneOf = require_oneof();
62695
62695
  var Field = require_field();
@@ -62704,7 +62704,7 @@ var require_type = __commonJS({
62704
62704
  var verifier = require_verifier();
62705
62705
  var converter = require_converter();
62706
62706
  var wrappers = require_wrappers();
62707
- function Type16(name2, options) {
62707
+ function Type21(name2, options) {
62708
62708
  Namespace.call(this, name2, options);
62709
62709
  this.fields = {};
62710
62710
  this.oneofs = void 0;
@@ -62716,7 +62716,7 @@ var require_type = __commonJS({
62716
62716
  this._oneofsArray = null;
62717
62717
  this._ctor = null;
62718
62718
  }
62719
- Object.defineProperties(Type16.prototype, {
62719
+ Object.defineProperties(Type21.prototype, {
62720
62720
  /**
62721
62721
  * Message fields by id.
62722
62722
  * @name Type#fieldsById
@@ -62767,7 +62767,7 @@ var require_type = __commonJS({
62767
62767
  */
62768
62768
  ctor: {
62769
62769
  get: function() {
62770
- return this._ctor || (this.ctor = Type16.generateConstructor(this)());
62770
+ return this._ctor || (this.ctor = Type21.generateConstructor(this)());
62771
62771
  },
62772
62772
  set: function(ctor) {
62773
62773
  var prototype = ctor.prototype;
@@ -62794,7 +62794,7 @@ var require_type = __commonJS({
62794
62794
  }
62795
62795
  }
62796
62796
  });
62797
- Type16.generateConstructor = function generateConstructor(mtype) {
62797
+ Type21.generateConstructor = function generateConstructor(mtype) {
62798
62798
  var gen = util3.codegen(["p"], mtype.name);
62799
62799
  for (var i = 0, field; i < mtype.fieldsArray.length; ++i)
62800
62800
  if ((field = mtype._fieldsArray[i]).map) gen("this%s={}", util3.safeProp(field.name));
@@ -62808,8 +62808,8 @@ var require_type = __commonJS({
62808
62808
  delete type.verify;
62809
62809
  return type;
62810
62810
  }
62811
- Type16.fromJSON = function fromJSON(name2, json) {
62812
- var type = new Type16(name2, json.options);
62811
+ Type21.fromJSON = function fromJSON(name2, json) {
62812
+ var type = new Type21(name2, json.options);
62813
62813
  type.extensions = json.extensions;
62814
62814
  type.reserved = json.reserved;
62815
62815
  var names = Object.keys(json.fields), i = 0;
@@ -62825,7 +62825,7 @@ var require_type = __commonJS({
62825
62825
  var nested = json.nested[names[i]];
62826
62826
  type.add(
62827
62827
  // most to least likely
62828
- (nested.id !== void 0 ? Field.fromJSON : nested.fields !== void 0 ? Type16.fromJSON : nested.values !== void 0 ? Enum.fromJSON : nested.methods !== void 0 ? Service.fromJSON : Namespace.fromJSON)(names[i], nested)
62828
+ (nested.id !== void 0 ? Field.fromJSON : nested.fields !== void 0 ? Type21.fromJSON : nested.values !== void 0 ? Enum.fromJSON : nested.methods !== void 0 ? Service.fromJSON : Namespace.fromJSON)(names[i], nested)
62829
62829
  );
62830
62830
  }
62831
62831
  if (json.extensions && json.extensions.length)
@@ -62841,7 +62841,7 @@ var require_type = __commonJS({
62841
62841
  type._defaultEdition = "proto3";
62842
62842
  return type;
62843
62843
  };
62844
- Type16.prototype.toJSON = function toJSON(toJSONOptions) {
62844
+ Type21.prototype.toJSON = function toJSON(toJSONOptions) {
62845
62845
  var inherited = Namespace.prototype.toJSON.call(this, toJSONOptions);
62846
62846
  var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false;
62847
62847
  return util3.toObject([
@@ -62867,7 +62867,7 @@ var require_type = __commonJS({
62867
62867
  keepComments ? this.comment : void 0
62868
62868
  ]);
62869
62869
  };
62870
- Type16.prototype.resolveAll = function resolveAll() {
62870
+ Type21.prototype.resolveAll = function resolveAll() {
62871
62871
  if (!this._needsRecursiveResolve) return this;
62872
62872
  Namespace.prototype.resolveAll.call(this);
62873
62873
  var oneofs = this.oneofsArray;
@@ -62879,7 +62879,7 @@ var require_type = __commonJS({
62879
62879
  fields[i++].resolve();
62880
62880
  return this;
62881
62881
  };
62882
- Type16.prototype._resolveFeaturesRecursive = function _resolveFeaturesRecursive(edition) {
62882
+ Type21.prototype._resolveFeaturesRecursive = function _resolveFeaturesRecursive(edition) {
62883
62883
  if (!this._needsRecursiveFeatureResolution) return this;
62884
62884
  edition = this._edition || edition;
62885
62885
  Namespace.prototype._resolveFeaturesRecursive.call(this, edition);
@@ -62891,10 +62891,10 @@ var require_type = __commonJS({
62891
62891
  });
62892
62892
  return this;
62893
62893
  };
62894
- Type16.prototype.get = function get2(name2) {
62894
+ Type21.prototype.get = function get2(name2) {
62895
62895
  return this.fields[name2] || this.oneofs && this.oneofs[name2] || this.nested && this.nested[name2] || null;
62896
62896
  };
62897
- Type16.prototype.add = function add(object) {
62897
+ Type21.prototype.add = function add(object) {
62898
62898
  if (this.get(object.name))
62899
62899
  throw Error("duplicate name '" + object.name + "' in " + this);
62900
62900
  if (object instanceof Field && object.extend === void 0) {
@@ -62923,7 +62923,7 @@ var require_type = __commonJS({
62923
62923
  }
62924
62924
  return Namespace.prototype.add.call(this, object);
62925
62925
  };
62926
- Type16.prototype.remove = function remove2(object) {
62926
+ Type21.prototype.remove = function remove2(object) {
62927
62927
  if (object instanceof Field && object.extend === void 0) {
62928
62928
  if (!this.fields || this.fields[object.name] !== object)
62929
62929
  throw Error(object + " is not a member of " + this);
@@ -62942,16 +62942,16 @@ var require_type = __commonJS({
62942
62942
  }
62943
62943
  return Namespace.prototype.remove.call(this, object);
62944
62944
  };
62945
- Type16.prototype.isReservedId = function isReservedId(id) {
62945
+ Type21.prototype.isReservedId = function isReservedId(id) {
62946
62946
  return Namespace.isReservedId(this.reserved, id);
62947
62947
  };
62948
- Type16.prototype.isReservedName = function isReservedName(name2) {
62948
+ Type21.prototype.isReservedName = function isReservedName(name2) {
62949
62949
  return Namespace.isReservedName(this.reserved, name2);
62950
62950
  };
62951
- Type16.prototype.create = function create(properties) {
62951
+ Type21.prototype.create = function create(properties) {
62952
62952
  return new this.ctor(properties);
62953
62953
  };
62954
- Type16.prototype.setup = function setup() {
62954
+ Type21.prototype.setup = function setup() {
62955
62955
  var fullName = this.fullName, types2 = [];
62956
62956
  for (var i = 0; i < /* initializes */
62957
62957
  this.fieldsArray.length; ++i)
@@ -62988,30 +62988,30 @@ var require_type = __commonJS({
62988
62988
  }
62989
62989
  return this;
62990
62990
  };
62991
- Type16.prototype.encode = function encode_setup(message, writer) {
62991
+ Type21.prototype.encode = function encode_setup(message, writer) {
62992
62992
  return this.setup().encode(message, writer);
62993
62993
  };
62994
- Type16.prototype.encodeDelimited = function encodeDelimited(message, writer) {
62994
+ Type21.prototype.encodeDelimited = function encodeDelimited(message, writer) {
62995
62995
  return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim();
62996
62996
  };
62997
- Type16.prototype.decode = function decode_setup(reader, length) {
62997
+ Type21.prototype.decode = function decode_setup(reader, length) {
62998
62998
  return this.setup().decode(reader, length);
62999
62999
  };
63000
- Type16.prototype.decodeDelimited = function decodeDelimited(reader) {
63000
+ Type21.prototype.decodeDelimited = function decodeDelimited(reader) {
63001
63001
  if (!(reader instanceof Reader))
63002
63002
  reader = Reader.create(reader);
63003
63003
  return this.decode(reader, reader.uint32());
63004
63004
  };
63005
- Type16.prototype.verify = function verify_setup(message) {
63005
+ Type21.prototype.verify = function verify_setup(message) {
63006
63006
  return this.setup().verify(message);
63007
63007
  };
63008
- Type16.prototype.fromObject = function fromObject(object) {
63008
+ Type21.prototype.fromObject = function fromObject(object) {
63009
63009
  return this.setup().fromObject(object);
63010
63010
  };
63011
- Type16.prototype.toObject = function toObject(message, options) {
63011
+ Type21.prototype.toObject = function toObject(message, options) {
63012
63012
  return this.setup().toObject(message, options);
63013
63013
  };
63014
- Type16.d = function decorateType(typeName) {
63014
+ Type21.d = function decorateType(typeName) {
63015
63015
  return function typeDecorator(target) {
63016
63016
  util3.decorateType(target, typeName);
63017
63017
  };
@@ -63030,7 +63030,7 @@ var require_root = __commonJS({
63030
63030
  var Enum = require_enum3();
63031
63031
  var OneOf = require_oneof();
63032
63032
  var util3 = require_util8();
63033
- var Type16;
63033
+ var Type21;
63034
63034
  var parse5;
63035
63035
  var common;
63036
63036
  function Root2(options) {
@@ -63214,7 +63214,7 @@ var require_root = __commonJS({
63214
63214
  if (exposeRe.test(object.name))
63215
63215
  object.parent[object.name] = object.values;
63216
63216
  } else if (!(object instanceof OneOf)) {
63217
- if (object instanceof Type16)
63217
+ if (object instanceof Type21)
63218
63218
  for (var i = 0; i < this.deferred.length; )
63219
63219
  if (tryHandleExtension(this, this.deferred[i]))
63220
63220
  this.deferred.splice(i, 1);
@@ -63226,7 +63226,7 @@ var require_root = __commonJS({
63226
63226
  if (exposeRe.test(object.name))
63227
63227
  object.parent[object.name] = object;
63228
63228
  }
63229
- if (object instanceof Type16 || object instanceof Enum || object instanceof Field) {
63229
+ if (object instanceof Type21 || object instanceof Enum || object instanceof Field) {
63230
63230
  this._fullyQualifiedObjects[object.fullName] = object;
63231
63231
  }
63232
63232
  };
@@ -63261,7 +63261,7 @@ var require_root = __commonJS({
63261
63261
  delete this._fullyQualifiedObjects[object.fullName];
63262
63262
  };
63263
63263
  Root2._configure = function(Type_, parse_2, common_) {
63264
- Type16 = Type_;
63264
+ Type21 = Type_;
63265
63265
  parse5 = parse_2;
63266
63266
  common = common_;
63267
63267
  };
@@ -63274,7 +63274,7 @@ var require_util8 = __commonJS({
63274
63274
  "use strict";
63275
63275
  var util3 = module2.exports = require_minimal();
63276
63276
  var roots = require_roots();
63277
- var Type16;
63277
+ var Type21;
63278
63278
  var Enum;
63279
63279
  util3.codegen = require_codegen2();
63280
63280
  util3.fetch = require_fetch();
@@ -63329,9 +63329,9 @@ var require_util8 = __commonJS({
63329
63329
  }
63330
63330
  return ctor.$type;
63331
63331
  }
63332
- if (!Type16)
63333
- Type16 = require_type();
63334
- var type = new Type16(typeName || ctor.name);
63332
+ if (!Type21)
63333
+ Type21 = require_type();
63334
+ var type = new Type21(typeName || ctor.name);
63335
63335
  util3.decorateRoot.add(type);
63336
63336
  type.ctor = ctor;
63337
63337
  Object.defineProperty(ctor, "$type", { value: type, enumerable: false });
@@ -63571,7 +63571,7 @@ var require_field = __commonJS({
63571
63571
  var Enum = require_enum3();
63572
63572
  var types2 = require_types5();
63573
63573
  var util3 = require_util8();
63574
- var Type16;
63574
+ var Type21;
63575
63575
  var ruleRe = /^required|optional|repeated$/;
63576
63576
  Field.fromJSON = function fromJSON(name2, json) {
63577
63577
  var field = new Field(name2, json.id, json.type, json.rule, json.extend, json.options, json.comment);
@@ -63634,7 +63634,7 @@ var require_field = __commonJS({
63634
63634
  });
63635
63635
  Object.defineProperty(Field.prototype, "delimited", {
63636
63636
  get: function() {
63637
- return this.resolvedType instanceof Type16 && this._features.message_encoding === "DELIMITED";
63637
+ return this.resolvedType instanceof Type21 && this._features.message_encoding === "DELIMITED";
63638
63638
  }
63639
63639
  });
63640
63640
  Object.defineProperty(Field.prototype, "packed", {
@@ -63679,7 +63679,7 @@ var require_field = __commonJS({
63679
63679
  return this;
63680
63680
  if ((this.typeDefault = types2.defaults[this.type]) === void 0) {
63681
63681
  this.resolvedType = (this.declaringField ? this.declaringField.parent : this.parent).lookupTypeOrEnum(this.type);
63682
- if (this.resolvedType instanceof Type16)
63682
+ if (this.resolvedType instanceof Type21)
63683
63683
  this.typeDefault = null;
63684
63684
  else
63685
63685
  this.typeDefault = this.resolvedType.values[Object.keys(this.resolvedType.values)[0]];
@@ -63715,7 +63715,7 @@ var require_field = __commonJS({
63715
63715
  this.defaultValue = util3.emptyArray;
63716
63716
  else
63717
63717
  this.defaultValue = this.typeDefault;
63718
- if (this.parent instanceof Type16)
63718
+ if (this.parent instanceof Type21)
63719
63719
  this.parent.ctor.prototype[this.name] = this.defaultValue;
63720
63720
  return ReflectionObject.prototype.resolve.call(this);
63721
63721
  };
@@ -63729,7 +63729,7 @@ var require_field = __commonJS({
63729
63729
  }
63730
63730
  if (this.parent && types2.defaults[this.type] === void 0) {
63731
63731
  var type = this.parent.get(this.type.split(".").pop());
63732
- if (type && type instanceof Type16 && type.group) {
63732
+ if (type && type instanceof Type21 && type.group) {
63733
63733
  features.message_encoding = "DELIMITED";
63734
63734
  }
63735
63735
  }
@@ -63753,7 +63753,7 @@ var require_field = __commonJS({
63753
63753
  };
63754
63754
  };
63755
63755
  Field._configure = function configure(Type_) {
63756
- Type16 = Type_;
63756
+ Type21 = Type_;
63757
63757
  };
63758
63758
  }
63759
63759
  });
@@ -64525,7 +64525,7 @@ var require_parse4 = __commonJS({
64525
64525
  parse5.defaults = { keepCase: false };
64526
64526
  var tokenize2 = require_tokenize();
64527
64527
  var Root2 = require_root();
64528
- var Type16 = require_type();
64528
+ var Type21 = require_type();
64529
64529
  var Field = require_field();
64530
64530
  var MapField = require_mapfield();
64531
64531
  var OneOf = require_oneof();
@@ -64788,7 +64788,7 @@ var require_parse4 = __commonJS({
64788
64788
  function parseType(parent, token3) {
64789
64789
  if (!nameRe.test(token3 = next()))
64790
64790
  throw illegal(token3, "type name");
64791
- var type = new Type16(token3);
64791
+ var type = new Type21(token3);
64792
64792
  ifBlock(type, function parseType_block(token4) {
64793
64793
  if (parseCommon(type, token4))
64794
64794
  return;
@@ -64885,7 +64885,7 @@ var require_parse4 = __commonJS({
64885
64885
  name2 = util3.ucFirst(name2);
64886
64886
  skip("=");
64887
64887
  var id = parseId(next());
64888
- var type = new Type16(name2);
64888
+ var type = new Type21(name2);
64889
64889
  type.group = true;
64890
64890
  var field = new Field(fieldName, id, name2, rule);
64891
64891
  field.filename = parse5.filename;
@@ -66985,7 +66985,7 @@ var require_descriptor2 = __commonJS({
66985
66985
  var Namespace = $protobuf.Namespace;
66986
66986
  var Root2 = $protobuf.Root;
66987
66987
  var Enum = $protobuf.Enum;
66988
- var Type16 = $protobuf.Type;
66988
+ var Type21 = $protobuf.Type;
66989
66989
  var Field = $protobuf.Field;
66990
66990
  var MapField = $protobuf.MapField;
66991
66991
  var OneOf = $protobuf.OneOf;
@@ -67006,7 +67006,7 @@ var require_descriptor2 = __commonJS({
67006
67006
  root.files.push(filePackage.filename = fileDescriptor.name);
67007
67007
  if (fileDescriptor.messageType)
67008
67008
  for (i = 0; i < fileDescriptor.messageType.length; ++i)
67009
- filePackage.add(Type16.fromDescriptor(fileDescriptor.messageType[i], edition));
67009
+ filePackage.add(Type21.fromDescriptor(fileDescriptor.messageType[i], edition));
67010
67010
  if (fileDescriptor.enumType)
67011
67011
  for (i = 0; i < fileDescriptor.enumType.length; ++i)
67012
67012
  filePackage.add(Enum.fromDescriptor(fileDescriptor.enumType[i], edition));
@@ -67037,7 +67037,7 @@ var require_descriptor2 = __commonJS({
67037
67037
  if (!(ns instanceof Root2))
67038
67038
  file["package"] = ns.fullName.substring(1);
67039
67039
  for (var i = 0, nested; i < ns.nestedArray.length; ++i)
67040
- if ((nested = ns._nestedArray[i]) instanceof Type16)
67040
+ if ((nested = ns._nestedArray[i]) instanceof Type21)
67041
67041
  file.messageType.push(nested.toDescriptor(edition));
67042
67042
  else if (nested instanceof Enum)
67043
67043
  file.enumType.push(nested.toDescriptor());
@@ -67053,10 +67053,10 @@ var require_descriptor2 = __commonJS({
67053
67053
  files.push(file);
67054
67054
  }
67055
67055
  var unnamedMessageIndex = 0;
67056
- Type16.fromDescriptor = function fromDescriptor(descriptor, edition, nested) {
67056
+ Type21.fromDescriptor = function fromDescriptor(descriptor, edition, nested) {
67057
67057
  if (typeof descriptor.length === "number")
67058
67058
  descriptor = exports2.DescriptorProto.decode(descriptor);
67059
- var type = new Type16(descriptor.name.length ? descriptor.name : "Type" + unnamedMessageIndex++, fromDescriptorOptions(descriptor.options, exports2.MessageOptions)), i;
67059
+ var type = new Type21(descriptor.name.length ? descriptor.name : "Type" + unnamedMessageIndex++, fromDescriptorOptions(descriptor.options, exports2.MessageOptions)), i;
67060
67060
  if (!nested)
67061
67061
  type._edition = edition;
67062
67062
  if (descriptor.oneofDecl)
@@ -67074,7 +67074,7 @@ var require_descriptor2 = __commonJS({
67074
67074
  type.add(Field.fromDescriptor(descriptor.extension[i], edition, true));
67075
67075
  if (descriptor.nestedType)
67076
67076
  for (i = 0; i < descriptor.nestedType.length; ++i) {
67077
- type.add(Type16.fromDescriptor(descriptor.nestedType[i], edition, true));
67077
+ type.add(Type21.fromDescriptor(descriptor.nestedType[i], edition, true));
67078
67078
  if (descriptor.nestedType[i].options && descriptor.nestedType[i].options.mapEntry)
67079
67079
  type.setOption("map_entry", true);
67080
67080
  }
@@ -67097,7 +67097,7 @@ var require_descriptor2 = __commonJS({
67097
67097
  }
67098
67098
  return type;
67099
67099
  };
67100
- Type16.prototype.toDescriptor = function toDescriptor(edition) {
67100
+ Type21.prototype.toDescriptor = function toDescriptor(edition) {
67101
67101
  var descriptor = exports2.DescriptorProto.create({ name: this.name }), i;
67102
67102
  for (i = 0; i < this.fieldsArray.length; ++i) {
67103
67103
  var fieldDescriptor;
@@ -67122,7 +67122,7 @@ var require_descriptor2 = __commonJS({
67122
67122
  for (i = 0; i < this.nestedArray.length; ++i) {
67123
67123
  if (this._nestedArray[i] instanceof Field)
67124
67124
  descriptor.field.push(this._nestedArray[i].toDescriptor(edition));
67125
- else if (this._nestedArray[i] instanceof Type16)
67125
+ else if (this._nestedArray[i] instanceof Type21)
67126
67126
  descriptor.nestedType.push(this._nestedArray[i].toDescriptor(edition));
67127
67127
  else if (this._nestedArray[i] instanceof Enum)
67128
67128
  descriptor.enumType.push(this._nestedArray[i].toDescriptor());
@@ -67449,7 +67449,7 @@ var require_descriptor2 = __commonJS({
67449
67449
  }
67450
67450
  if (resolvedType instanceof Enum)
67451
67451
  return 14;
67452
- if (resolvedType instanceof Type16)
67452
+ if (resolvedType instanceof Type21)
67453
67453
  return delimited ? 10 : 11;
67454
67454
  throw Error("illegal type: " + type);
67455
67455
  }
@@ -67459,7 +67459,7 @@ var require_descriptor2 = __commonJS({
67459
67459
  if ((key = (field = type._fieldsArray[i]).name) === "uninterpretedOption") continue;
67460
67460
  if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
67461
67461
  var newKey = underScore(key);
67462
- if (field.resolvedType instanceof Type16) {
67462
+ if (field.resolvedType instanceof Type21) {
67463
67463
  val[newKey] = fromDescriptorOptionsRecursive(obj[key], field.resolvedType);
67464
67464
  } else if (field.resolvedType instanceof Enum) {
67465
67465
  val[newKey] = field.resolvedType.valuesById[obj[key]];
@@ -67482,7 +67482,7 @@ var require_descriptor2 = __commonJS({
67482
67482
  var newKey = $protobuf.util.camelCase(key);
67483
67483
  if (!Object.prototype.hasOwnProperty.call(type.fields, newKey)) continue;
67484
67484
  var field = type.fields[newKey];
67485
- if (field.resolvedType instanceof Type16) {
67485
+ if (field.resolvedType instanceof Type21) {
67486
67486
  val[newKey] = toDescriptorOptionsRecursive(obj[key], field.resolvedType);
67487
67487
  } else {
67488
67488
  val[newKey] = obj[key];
@@ -98772,7 +98772,7 @@ var require_homedir = __commonJS({
98772
98772
  "node_modules/resolve/lib/homedir.js"(exports2, module2) {
98773
98773
  "use strict";
98774
98774
  var os11 = require("os");
98775
- module2.exports = os11.homedir || function homedir8() {
98775
+ module2.exports = os11.homedir || function homedir9() {
98776
98776
  var home = process.env.HOME;
98777
98777
  var user = process.env.LOGNAME || process.env.USER || process.env.LNAME || process.env.USERNAME;
98778
98778
  if (process.platform === "win32") {
@@ -99253,11 +99253,11 @@ var require_async2 = __commonJS({
99253
99253
  var normalizeOptions = require_normalize_options();
99254
99254
  var isCore = require_is_core_module();
99255
99255
  var realpathFS = process.platform !== "win32" && fs29.realpath && typeof fs29.realpath.native === "function" ? fs29.realpath.native : fs29.realpath;
99256
- var homedir8 = getHomedir();
99256
+ var homedir9 = getHomedir();
99257
99257
  var defaultPaths = function() {
99258
99258
  return [
99259
- path35.join(homedir8, ".node_modules"),
99260
- path35.join(homedir8, ".node_libraries")
99259
+ path35.join(homedir9, ".node_modules"),
99260
+ path35.join(homedir9, ".node_libraries")
99261
99261
  ];
99262
99262
  };
99263
99263
  var defaultIsFile = function isFile(file, cb) {
@@ -99743,11 +99743,11 @@ var require_sync2 = __commonJS({
99743
99743
  var nodeModulesPaths = require_node_modules_paths();
99744
99744
  var normalizeOptions = require_normalize_options();
99745
99745
  var realpathFS = process.platform !== "win32" && fs29.realpathSync && typeof fs29.realpathSync.native === "function" ? fs29.realpathSync.native : fs29.realpathSync;
99746
- var homedir8 = getHomedir();
99746
+ var homedir9 = getHomedir();
99747
99747
  var defaultPaths = function() {
99748
99748
  return [
99749
- path35.join(homedir8, ".node_modules"),
99750
- path35.join(homedir8, ".node_libraries")
99749
+ path35.join(homedir9, ".node_modules"),
99750
+ path35.join(homedir9, ".node_libraries")
99751
99751
  ];
99752
99752
  };
99753
99753
  var defaultIsFile = function isFile(file) {
@@ -99784,8 +99784,8 @@ var require_sync2 = __commonJS({
99784
99784
  }
99785
99785
  return x;
99786
99786
  };
99787
- var defaultReadPackageSync = function defaultReadPackageSync2(readFileSync10, pkgfile) {
99788
- var body = readFileSync10(pkgfile);
99787
+ var defaultReadPackageSync = function defaultReadPackageSync2(readFileSync11, pkgfile) {
99788
+ var body = readFileSync11(pkgfile);
99789
99789
  try {
99790
99790
  var pkg2 = JSON.parse(body);
99791
99791
  return pkg2;
@@ -99805,7 +99805,7 @@ var require_sync2 = __commonJS({
99805
99805
  }
99806
99806
  var opts = normalizeOptions(x, options);
99807
99807
  var isFile = opts.isFile || defaultIsFile;
99808
- var readFileSync10 = opts.readFileSync || fs29.readFileSync;
99808
+ var readFileSync11 = opts.readFileSync || fs29.readFileSync;
99809
99809
  var isDirectory = opts.isDirectory || defaultIsDir;
99810
99810
  var realpathSync2 = opts.realpathSync || defaultRealpathSync;
99811
99811
  var readPackageSync2 = opts.readPackageSync || defaultReadPackageSync;
@@ -99862,7 +99862,7 @@ var require_sync2 = __commonJS({
99862
99862
  if (!isFile(pkgfile)) {
99863
99863
  return loadpkg(path35.dirname(dir));
99864
99864
  }
99865
- var pkg2 = readPackageSync2(readFileSync10, pkgfile);
99865
+ var pkg2 = readPackageSync2(readFileSync11, pkgfile);
99866
99866
  if (pkg2 && opts.packageFilter) {
99867
99867
  pkg2 = opts.packageFilter(
99868
99868
  pkg2,
@@ -99876,7 +99876,7 @@ var require_sync2 = __commonJS({
99876
99876
  var pkgfile = path35.join(maybeRealpathSync(realpathSync2, x2, opts), "/package.json");
99877
99877
  if (isFile(pkgfile)) {
99878
99878
  try {
99879
- var pkg2 = readPackageSync2(readFileSync10, pkgfile);
99879
+ var pkg2 = readPackageSync2(readFileSync11, pkgfile);
99880
99880
  } catch (e2) {
99881
99881
  }
99882
99882
  if (pkg2 && opts.packageFilter) {
@@ -132761,6 +132761,9 @@ var import_node_process10 = __toESM(require("node:process"), 1);
132761
132761
  // packages/core/dist/src/config/config.js
132762
132762
  var path27 = __toESM(require("node:path"), 1);
132763
132763
  var import_node_process8 = __toESM(require("node:process"), 1);
132764
+ var import_node_fs6 = require("node:fs");
132765
+ var import_node_path7 = require("node:path");
132766
+ var import_node_os3 = require("node:os");
132764
132767
  init_contentGenerator();
132765
132768
 
132766
132769
  // packages/core/dist/src/tools/tool-registry.js
@@ -140496,6 +140499,12 @@ function _sanitizeParameters(schema, visited) {
140496
140499
  return;
140497
140500
  }
140498
140501
  visited.add(schema);
140502
+ if ("$schema" in schema) {
140503
+ delete schema.$schema;
140504
+ }
140505
+ if ("additionalProperties" in schema) {
140506
+ delete schema.additionalProperties;
140507
+ }
140499
140508
  if (schema.anyOf) {
140500
140509
  schema.default = void 0;
140501
140510
  for (const item of schema.anyOf) {
@@ -140585,7 +140594,7 @@ var SchemaValidator = class {
140585
140594
  var import_node_path3 = __toESM(require("node:path"), 1);
140586
140595
  var import_os = __toESM(require("os"), 1);
140587
140596
  var crypto8 = __toESM(require("crypto"), 1);
140588
- var GEMINI_DIR2 = ".gemini";
140597
+ var MPDAI_DIR2 = ".mpdai";
140589
140598
  var TMP_DIR_NAME = "tmp";
140590
140599
  function shortenPath(filePath, maxLen = 35) {
140591
140600
  if (filePath.length <= maxLen) {
@@ -140641,7 +140650,7 @@ function getProjectHash(projectRoot) {
140641
140650
  }
140642
140651
  function getProjectTempDir(projectRoot) {
140643
140652
  const hash = getProjectHash(projectRoot);
140644
- return import_node_path3.default.join(import_os.default.homedir(), GEMINI_DIR2, TMP_DIR_NAME, hash);
140653
+ return import_node_path3.default.join(import_os.default.homedir(), MPDAI_DIR2, TMP_DIR_NAME, hash);
140645
140654
  }
140646
140655
 
140647
140656
  // packages/core/dist/src/tools/ls.js
@@ -141252,7 +141261,7 @@ var ReadFileTool = class _ReadFileTool extends BaseTool {
141252
141261
  const fileService = this.config.getFileService();
141253
141262
  if (fileService.shouldGeminiIgnoreFile(params.absolute_path)) {
141254
141263
  const relativePath = makeRelative(params.absolute_path, this.rootDirectory);
141255
- return `File path '${shortenPath(relativePath)}' is ignored by .geminiignore pattern(s).`;
141264
+ return `File path '${shortenPath(relativePath)}' is ignored by .mpdaiignore pattern(s).`;
141256
141265
  }
141257
141266
  return null;
141258
141267
  }
@@ -149354,7 +149363,7 @@ Do NOT use this tool:
149354
149363
 
149355
149364
  - \`fact\` (string, required): The specific fact or piece of information to remember. This should be a clear, self-contained statement. For example, if the user says "My favorite color is blue", the fact would be "My favorite color is blue".
149356
149365
  `;
149357
- var GEMINI_CONFIG_DIR = ".gemini";
149366
+ var MPDAI_CONFIG_DIR = ".mpdai";
149358
149367
  var DEFAULT_CONTEXT_FILENAME = "MEMORY.md";
149359
149368
  var MEMORY_SECTION_HEADER = "## Memory Added Memories";
149360
149369
  var currentGeminiMdFilename = DEFAULT_CONTEXT_FILENAME;
@@ -149380,7 +149389,7 @@ function getAllGeminiMdFilenames() {
149380
149389
  return [currentGeminiMdFilename];
149381
149390
  }
149382
149391
  function getGlobalMemoryFilePath() {
149383
- return path13.join((0, import_os3.homedir)(), GEMINI_CONFIG_DIR, getCurrentGeminiMdFilename());
149392
+ return path13.join((0, import_os3.homedir)(), MPDAI_CONFIG_DIR, getCurrentGeminiMdFilename());
149384
149393
  }
149385
149394
  function ensureNewlineSeparation(currentContent) {
149386
149395
  if (currentContent.length === 0)
@@ -149600,7 +149609,7 @@ Use this tool when the user's query implies needing the content of several files
149600
149609
  if (this.geminiIgnorePatterns.length > 0) {
149601
149610
  const geminiPatternsInEffect = this.geminiIgnorePatterns.filter((p) => finalExclusionPatternsForDescription.includes(p)).length;
149602
149611
  if (geminiPatternsInEffect > 0) {
149603
- excludeDesc += ` (includes ${geminiPatternsInEffect} from .geminiignore)`;
149612
+ excludeDesc += ` (includes ${geminiPatternsInEffect} from .mpdaiignore)`;
149604
149613
  }
149605
149614
  }
149606
149615
  return `Will attempt to read and concatenate files ${pathDesc}. ${excludeDesc}. File encoding: ${DEFAULT_ENCODING}. Separator: "${DEFAULT_OUTPUT_SEPARATOR_FORMAT.replace("{filePath}", "path/to/file.ext")}".`;
@@ -151715,8 +151724,8 @@ function many(p) {
151715
151724
  function many1(p) {
151716
151725
  return ab(p, many(p), (head, tail) => [head, ...tail]);
151717
151726
  }
151718
- function ab(pa, pb, join14) {
151719
- return (data, i) => mapOuter(pa(data, i), (ma) => mapInner(pb(data, ma.position), (vb, j) => join14(ma.value, vb, data, i, j)));
151727
+ function ab(pa, pb, join15) {
151728
+ return (data, i) => mapOuter(pa(data, i), (ma) => mapInner(pb(data, ma.position), (vb, j) => join15(ma.value, vb, data, i, j)));
151720
151729
  }
151721
151730
  function left2(pa, pb) {
151722
151731
  return ab(pa, pb, (va) => va);
@@ -151724,8 +151733,8 @@ function left2(pa, pb) {
151724
151733
  function right2(pa, pb) {
151725
151734
  return ab(pa, pb, (va, vb) => vb);
151726
151735
  }
151727
- function abc(pa, pb, pc, join14) {
151728
- return (data, i) => mapOuter(pa(data, i), (ma) => mapOuter(pb(data, ma.position), (mb) => mapInner(pc(data, mb.position), (vc, j) => join14(ma.value, mb.value, vc, data, i, j))));
151736
+ function abc(pa, pb, pc, join15) {
151737
+ return (data, i) => mapOuter(pa(data, i), (ma) => mapOuter(pb(data, ma.position), (mb) => mapInner(pc(data, mb.position), (vc, j) => join15(ma.value, mb.value, vc, data, i, j))));
151729
151738
  }
151730
151739
  function middle(pa, pb, pc) {
151731
151740
  return abc(pa, pb, pc, (ra, rb) => rb);
@@ -156388,6 +156397,951 @@ ${modifiedResponseText}`,
156388
156397
  }
156389
156398
  };
156390
156399
 
156400
+ // packages/core/dist/src/tools/confluence-get-page.js
156401
+ var import_genai18 = require("@google/genai");
156402
+ init_errors();
156403
+ var CONFLUENCE_FETCH_TIMEOUT_MS = 3e4;
156404
+ var CONFLUENCE_URL = "https://confluence.rakuten-it.com/confluence";
156405
+ var ConfluenceGetPageTool = class _ConfluenceGetPageTool extends BaseTool {
156406
+ config;
156407
+ static Name = "confluence_get_page";
156408
+ constructor(config2) {
156409
+ super(_ConfluenceGetPageTool.Name, "ConfluenceGetPage", "Retrieves content from a Confluence page by its ID. Uses Personal Access Token from keys.json for authentication and can convert HTML content to markdown.", {
156410
+ properties: {
156411
+ page_id: {
156412
+ description: "The ID of the Confluence page to retrieve",
156413
+ type: import_genai18.Type.STRING
156414
+ },
156415
+ convert_to_markdown: {
156416
+ description: "Whether to convert HTML content to markdown format (default: true)",
156417
+ type: import_genai18.Type.STRING
156418
+ }
156419
+ },
156420
+ required: ["page_id"],
156421
+ type: import_genai18.Type.OBJECT
156422
+ });
156423
+ this.config = config2;
156424
+ }
156425
+ validateParams(params) {
156426
+ const errors = SchemaValidator.validate(this.schema.parameters, params);
156427
+ if (errors) {
156428
+ return errors;
156429
+ }
156430
+ if (!params.page_id || params.page_id.trim() === "") {
156431
+ return "The 'page_id' parameter cannot be empty.";
156432
+ }
156433
+ return null;
156434
+ }
156435
+ getDescription(params) {
156436
+ return `Retrieving Confluence page ${params.page_id} from ${CONFLUENCE_URL}`;
156437
+ }
156438
+ /**
156439
+ * Process HTML content to handle user mentions and page links
156440
+ */
156441
+ processHtmlContent(html, spaceKey, baseUrl) {
156442
+ let processed = html;
156443
+ processed = processed.replace(/<ac:link>[\s\S]*?<ri:user[^>]+ri:username="([^"]+)"\s*\/>[\s\S]*?<\/ac:link>/g, "@$1");
156444
+ processed = processed.replace(/<ac:link[^>]*>[\s\S]*?<ri:page[^>]+ri:content-title="([^"]*)"\s*ri:space-key="([^"]*)"\s*\/>[\s\S]*?<\/ac:link>/g, (match2, title) => {
156445
+ return title || "Page Link";
156446
+ });
156447
+ processed = processed.replace(/<\/?(span|div|p)[^>]*>/g, "\n");
156448
+ processed = processed.replace(/<strong>([^<]*)<\/strong>/g, "**$1**");
156449
+ processed = processed.replace(/<b>([^<]*)<\/b>/g, "**$1**");
156450
+ processed = processed.replace(/<em>([^<]*)<\/em>/g, "*$1*");
156451
+ processed = processed.replace(/<i>([^<]*)<\/i>/g, "*$1*");
156452
+ for (let i = 1; i <= 6; i++) {
156453
+ const tag = `h${i}`;
156454
+ const prefix = "#".repeat(i);
156455
+ processed = processed.replace(new RegExp(`<${tag}>([^<]*)</${tag}>`, "g"), `${prefix} $1`);
156456
+ }
156457
+ processed = processed.replace(/<li>([^<]*)<\/li>/g, "- $1\n");
156458
+ processed = processed.replace(/<ul[^>]*>/g, "\n");
156459
+ processed = processed.replace(/<\/ul>/g, "\n");
156460
+ processed = processed.replace(/<ol[^>]*>/g, "\n");
156461
+ processed = processed.replace(/<\/ol>/g, "\n");
156462
+ processed = processed.replace(/<a[^>]+href="([^"]*)"[^>]*>([^<]*)<\/a>/g, "[$2]($1)");
156463
+ processed = processed.replace(/<[^>]+>/g, "");
156464
+ processed = processed.replace(/\n{3,}/g, "\n\n");
156465
+ return processed.trim();
156466
+ }
156467
+ async execute(params, signal) {
156468
+ const validationError = this.validateParams(params);
156469
+ if (validationError) {
156470
+ return {
156471
+ llmContent: `Error: Invalid parameters provided. Reason: ${validationError}`,
156472
+ returnDisplay: validationError
156473
+ };
156474
+ }
156475
+ const { page_id, convert_to_markdown = true } = params;
156476
+ const personal_access_token = this.config.getConfluenceToken();
156477
+ if (!personal_access_token) {
156478
+ return {
156479
+ llmContent: "Error: Confluence Personal Access Token not found in keys.json. Please configure it first.",
156480
+ returnDisplay: "Confluence token not configured"
156481
+ };
156482
+ }
156483
+ try {
156484
+ const isCloud = CONFLUENCE_URL.includes(".atlassian.net");
156485
+ const apiUrl = `${CONFLUENCE_URL.replace(/\/$/, "")}/rest/api/content/${page_id}`;
156486
+ const paramsObj = new URLSearchParams({
156487
+ expand: "body.storage,version,space,children.attachment,ancestors"
156488
+ });
156489
+ const fullUrl = `${apiUrl}?${paramsObj.toString()}`;
156490
+ const headers = {
156491
+ "Accept": "application/json",
156492
+ "Content-Type": "application/json",
156493
+ "Authorization": `Bearer ${personal_access_token}`
156494
+ };
156495
+ const controller = new AbortController();
156496
+ const timeoutId = setTimeout(() => controller.abort(), CONFLUENCE_FETCH_TIMEOUT_MS);
156497
+ let response;
156498
+ try {
156499
+ response = await fetch(fullUrl, {
156500
+ method: "GET",
156501
+ headers,
156502
+ signal: signal || controller.signal
156503
+ });
156504
+ } finally {
156505
+ clearTimeout(timeoutId);
156506
+ }
156507
+ if (response.status === 401) {
156508
+ return {
156509
+ llmContent: "Error: Authentication failed (401). Personal Access Token may be invalid or expired.",
156510
+ returnDisplay: "Authentication failed (401)"
156511
+ };
156512
+ }
156513
+ if (response.status === 403) {
156514
+ return {
156515
+ llmContent: "Error: Access denied (403). Token may not have sufficient permissions.",
156516
+ returnDisplay: "Access denied (403)"
156517
+ };
156518
+ }
156519
+ if (response.status === 404) {
156520
+ return {
156521
+ llmContent: `Error: Page not found (404). Page ID ${page_id} may not exist.`,
156522
+ returnDisplay: `Page not found (404): ${page_id}`
156523
+ };
156524
+ }
156525
+ if (!response.ok) {
156526
+ const errorText = await response.text().catch(() => "Unknown error");
156527
+ return {
156528
+ llmContent: `Error: API call failed with status ${response.status}: ${errorText}`,
156529
+ returnDisplay: `API error (${response.status})`
156530
+ };
156531
+ }
156532
+ const pageData = await response.json();
156533
+ const content = pageData.body.storage.value;
156534
+ const spaceKey = pageData.space.key;
156535
+ const title = pageData.title;
156536
+ const version2 = pageData.version.number;
156537
+ const created = pageData.created;
156538
+ const updated = pageData.updated;
156539
+ let pageUrl;
156540
+ if (isCloud) {
156541
+ pageUrl = `${CONFLUENCE_URL}/spaces/${spaceKey}/pages/${pageData.id}`;
156542
+ } else {
156543
+ pageUrl = `${CONFLUENCE_URL}/pages/viewpage.action?pageId=${pageData.id}`;
156544
+ }
156545
+ let processedContent;
156546
+ let contentFormat;
156547
+ if (convert_to_markdown) {
156548
+ processedContent = this.processHtmlContent(content, spaceKey, CONFLUENCE_URL);
156549
+ contentFormat = "markdown";
156550
+ } else {
156551
+ processedContent = content;
156552
+ contentFormat = "storage";
156553
+ }
156554
+ const result = {
156555
+ id: pageData.id,
156556
+ title,
156557
+ type: pageData.type,
156558
+ status: pageData.status,
156559
+ created,
156560
+ updated,
156561
+ url: pageUrl,
156562
+ space: {
156563
+ key: spaceKey,
156564
+ name: pageData.space.name
156565
+ },
156566
+ version: version2,
156567
+ attachments: pageData.children?.attachment?.results || [],
156568
+ ancestors: pageData.ancestors || [],
156569
+ content: {
156570
+ value: processedContent,
156571
+ format: contentFormat
156572
+ }
156573
+ };
156574
+ const resultText = `# ${title}
156575
+
156576
+ **Page ID:** ${pageData.id}
156577
+ **Space:** ${spaceKey}
156578
+ **Version:** ${version2}
156579
+ **Created:** ${created}
156580
+ **Updated:** ${updated}
156581
+ **URL:** ${pageUrl}
156582
+
156583
+ ---
156584
+
156585
+ ${processedContent}
156586
+ `;
156587
+ return {
156588
+ llmContent: resultText,
156589
+ returnDisplay: `Retrieved Confluence page: ${title}`
156590
+ };
156591
+ } catch (error) {
156592
+ const errorMessage = `Error retrieving Confluence page ${page_id}: ${getErrorMessage(error)}`;
156593
+ console.error(errorMessage, error);
156594
+ return {
156595
+ llmContent: `Error: ${errorMessage}`,
156596
+ returnDisplay: `Error: ${errorMessage}`
156597
+ };
156598
+ }
156599
+ }
156600
+ };
156601
+
156602
+ // packages/core/dist/src/tools/jira-get-issue.js
156603
+ var import_genai19 = require("@google/genai");
156604
+ init_errors();
156605
+ var JIRA_FETCH_TIMEOUT_MS = 3e4;
156606
+ var JIRA_URL = "https://jira.rakuten-it.com/jira";
156607
+ var JiraGetIssueTool = class _JiraGetIssueTool extends BaseTool {
156608
+ config;
156609
+ static Name = "jira_get_issue";
156610
+ constructor(config2) {
156611
+ super(_JiraGetIssueTool.Name, "JiraGetIssue", "Retrieves content from a Jira issue by its key. Uses Personal Access Token from keys.json for authentication.", {
156612
+ properties: {
156613
+ issue_key: {
156614
+ description: "The Jira issue key to retrieve (e.g., PROJECT-123)",
156615
+ type: import_genai19.Type.STRING
156616
+ },
156617
+ expand: {
156618
+ description: 'Fields to expand in the response (e.g., "renderedFields,changelog")',
156619
+ type: import_genai19.Type.STRING
156620
+ },
156621
+ comment_limit: {
156622
+ description: 'Maximum number of comments to include (default: 10, use "all" for all comments)',
156623
+ type: import_genai19.Type.STRING
156624
+ }
156625
+ },
156626
+ required: ["issue_key"],
156627
+ type: import_genai19.Type.OBJECT
156628
+ });
156629
+ this.config = config2;
156630
+ }
156631
+ validateParams(params) {
156632
+ const errors = SchemaValidator.validate(this.schema.parameters, params);
156633
+ if (errors) {
156634
+ return errors;
156635
+ }
156636
+ if (!params.issue_key || params.issue_key.trim() === "") {
156637
+ return "The 'issue_key' parameter cannot be empty.";
156638
+ }
156639
+ const issueKeyPattern = /^[A-Z]+-\d+$/;
156640
+ if (!issueKeyPattern.test(params.issue_key.trim())) {
156641
+ return "The 'issue_key' must be in format PROJECT-123 (e.g., PROJ-456)";
156642
+ }
156643
+ return null;
156644
+ }
156645
+ getDescription(params) {
156646
+ return `Retrieving Jira issue ${params.issue_key} from ${JIRA_URL}`;
156647
+ }
156648
+ /**
156649
+ * Normalize comment limit to a number
156650
+ */
156651
+ normalizeCommentLimit(commentLimit) {
156652
+ if (commentLimit === void 0) {
156653
+ return 10;
156654
+ }
156655
+ if (typeof commentLimit === "number") {
156656
+ return commentLimit;
156657
+ }
156658
+ if (commentLimit === "all" || commentLimit === "") {
156659
+ return null;
156660
+ }
156661
+ try {
156662
+ return parseInt(commentLimit, 10);
156663
+ } catch {
156664
+ return 10;
156665
+ }
156666
+ }
156667
+ /**
156668
+ * Convert Jira formatted text to plain text
156669
+ */
156670
+ convertJiraTextToPlainText(content) {
156671
+ if (typeof content === "string") {
156672
+ return content;
156673
+ }
156674
+ if (typeof content === "object" && content !== null) {
156675
+ const obj = content;
156676
+ if (Array.isArray(obj.content)) {
156677
+ return this.extractTextFromContent(obj.content);
156678
+ }
156679
+ }
156680
+ return "";
156681
+ }
156682
+ /**
156683
+ * Extract text from Jira content structure
156684
+ */
156685
+ extractTextFromContent(content) {
156686
+ let text = "";
156687
+ for (const item of content) {
156688
+ if (typeof item === "object" && item !== null) {
156689
+ const obj = item;
156690
+ if (obj.text) {
156691
+ text += obj.text;
156692
+ }
156693
+ if (obj.content && Array.isArray(obj.content)) {
156694
+ text += this.extractTextFromContent(obj.content);
156695
+ }
156696
+ }
156697
+ }
156698
+ return text;
156699
+ }
156700
+ /**
156701
+ * Format date string
156702
+ */
156703
+ formatDate(dateStr) {
156704
+ if (!dateStr) {
156705
+ return "";
156706
+ }
156707
+ try {
156708
+ const date = new Date(dateStr);
156709
+ return date.toLocaleString();
156710
+ } catch {
156711
+ return dateStr;
156712
+ }
156713
+ }
156714
+ async execute(params, signal) {
156715
+ const validationError = this.validateParams(params);
156716
+ if (validationError) {
156717
+ return {
156718
+ llmContent: `Error: Invalid parameters provided. Reason: ${validationError}`,
156719
+ returnDisplay: validationError
156720
+ };
156721
+ }
156722
+ const { issue_key, expand: expand2, comment_limit } = params;
156723
+ const personal_access_token = this.config.getJiraToken();
156724
+ if (!personal_access_token) {
156725
+ return {
156726
+ llmContent: "Error: Jira Personal Access Token not found in keys.json. Please configure it first.",
156727
+ returnDisplay: "Jira token not configured"
156728
+ };
156729
+ }
156730
+ try {
156731
+ const apiUrl = `${JIRA_URL}/rest/api/2/issue/${issue_key}`;
156732
+ const queryParams = new URLSearchParams();
156733
+ const expandParams = expand2 ? expand2.split(",").map((s2) => s2.trim()) : [];
156734
+ if (!expandParams.includes("renderedFields")) {
156735
+ expandParams.push("renderedFields");
156736
+ }
156737
+ if (expandParams.length > 0) {
156738
+ queryParams.set("expand", expandParams.join(","));
156739
+ }
156740
+ const fullUrl = `${apiUrl}?${queryParams.toString()}`;
156741
+ const headers = {
156742
+ "Accept": "application/json",
156743
+ "Content-Type": "application/json",
156744
+ "Authorization": `Bearer ${personal_access_token}`
156745
+ };
156746
+ console.log("Jira API request:", {
156747
+ url: fullUrl,
156748
+ authMethod: "Bearer",
156749
+ tokenLength: personal_access_token.length,
156750
+ headers: { ...headers, Authorization: "Bearer ***" }
156751
+ });
156752
+ const controller = new AbortController();
156753
+ const timeoutId = setTimeout(() => controller.abort(), JIRA_FETCH_TIMEOUT_MS);
156754
+ let response;
156755
+ try {
156756
+ response = await fetch(fullUrl, {
156757
+ method: "GET",
156758
+ headers,
156759
+ signal: signal || controller.signal
156760
+ });
156761
+ } finally {
156762
+ clearTimeout(timeoutId);
156763
+ }
156764
+ if (response.status === 401) {
156765
+ return {
156766
+ llmContent: "Error: Authentication failed (401). Personal Access Token may be invalid or expired.",
156767
+ returnDisplay: "Authentication failed (401)"
156768
+ };
156769
+ }
156770
+ if (response.status === 403) {
156771
+ return {
156772
+ llmContent: "Error: Access denied (403). Token may not have sufficient permissions.",
156773
+ returnDisplay: "Access denied (403)"
156774
+ };
156775
+ }
156776
+ if (response.status === 404) {
156777
+ return {
156778
+ llmContent: `Error: Issue not found (404). Issue key ${issue_key} may not exist.`,
156779
+ returnDisplay: `Issue not found (404): ${issue_key}`
156780
+ };
156781
+ }
156782
+ if (!response.ok) {
156783
+ const errorText = await response.text().catch(() => "Unknown error");
156784
+ console.error(`Jira API error (${response.status}):`, errorText.substring(0, 500));
156785
+ return {
156786
+ llmContent: `Error: API call failed with status ${response.status}: ${errorText.substring(0, 200)}`,
156787
+ returnDisplay: `API error (${response.status})`
156788
+ };
156789
+ }
156790
+ const contentType = response.headers.get("content-type") || "";
156791
+ if (!contentType.includes("application/json")) {
156792
+ const responseText = await response.text();
156793
+ console.error("Jira API returned non-JSON response:", responseText.substring(0, 500));
156794
+ return {
156795
+ llmContent: "Error: Jira API returned non-JSON response. This usually means authentication failed. Please check your Personal Access Token in keys.json.",
156796
+ returnDisplay: "Authentication failed - invalid response format"
156797
+ };
156798
+ }
156799
+ const issueData = await response.json();
156800
+ const fields = issueData.fields || {};
156801
+ const summary = fields.summary || "";
156802
+ const status = fields.status?.name || "Unknown";
156803
+ const issueType = fields.issuetype?.name || "Unknown";
156804
+ const created = this.formatDate(fields.created);
156805
+ const updated = this.formatDate(fields.updated);
156806
+ const assignee = fields.assignee?.displayName || fields.assignee?.name || "Unassigned";
156807
+ const reporter = fields.reporter?.displayName || fields.reporter?.name || "Unknown";
156808
+ const description = this.convertJiraTextToPlainText(fields.description);
156809
+ const comments = fields.comment?.comments || [];
156810
+ const normalizedCommentLimit = this.normalizeCommentLimit(comment_limit);
156811
+ const limitedComments = normalizedCommentLimit !== null ? comments.slice(0, normalizedCommentLimit) : comments;
156812
+ const issueUrl = `${JIRA_URL}/browse/${issue_key}`;
156813
+ let resultText = `# ${issue_key}: ${summary}
156814
+
156815
+ `;
156816
+ resultText += `**Type**: ${issueType}
156817
+ `;
156818
+ resultText += `**Status**: ${status}
156819
+ `;
156820
+ resultText += `**Reporter**: ${reporter}
156821
+ `;
156822
+ resultText += `**Assignee**: ${assignee}
156823
+ `;
156824
+ resultText += `**Created**: ${created}
156825
+ `;
156826
+ resultText += `**Updated**: ${updated}
156827
+ `;
156828
+ resultText += `**URL**: ${issueUrl}
156829
+
156830
+ `;
156831
+ if (description) {
156832
+ resultText += `## Description
156833
+
156834
+ ${description}
156835
+
156836
+ `;
156837
+ }
156838
+ if (limitedComments.length > 0) {
156839
+ resultText += `## Comments (${limitedComments.length}${normalizedCommentLimit !== null ? ` of ${comments.length}` : ""})
156840
+
156841
+ `;
156842
+ for (const comment of limitedComments) {
156843
+ const commentAuthor = comment.author?.displayName || comment.author?.name || "Unknown";
156844
+ const commentBody = this.convertJiraTextToPlainText(comment.body);
156845
+ const commentCreated = this.formatDate(comment.created);
156846
+ if (commentBody) {
156847
+ resultText += `**${commentAuthor}** (${commentCreated}):
156848
+ ${commentBody}
156849
+
156850
+ `;
156851
+ }
156852
+ }
156853
+ }
156854
+ return {
156855
+ llmContent: resultText,
156856
+ returnDisplay: `Retrieved Jira issue: ${issue_key}`
156857
+ };
156858
+ } catch (error) {
156859
+ const errorMessage = `Error retrieving Jira issue ${issue_key}: ${getErrorMessage(error)}`;
156860
+ console.error(errorMessage, error);
156861
+ return {
156862
+ llmContent: `Error: ${errorMessage}`,
156863
+ returnDisplay: `Error: ${errorMessage}`
156864
+ };
156865
+ }
156866
+ }
156867
+ };
156868
+
156869
+ // packages/core/dist/src/tools/bitbucket-get-pr-diff.js
156870
+ var import_genai20 = require("@google/genai");
156871
+ init_errors();
156872
+ var BITBUCKET_FETCH_TIMEOUT_MS = 3e4;
156873
+ var BITBUCKET_URL = "https://git.rakuten-it.com";
156874
+ var BitbucketGetPrDiffTool = class _BitbucketGetPrDiffTool extends BaseTool {
156875
+ config;
156876
+ static Name = "bitbucket_get_pr_diff";
156877
+ constructor(config2) {
156878
+ super(_BitbucketGetPrDiffTool.Name, "BitbucketGetPrDiff", "Retrieves the diff content for a specified Bitbucket Pull Request. Uses Personal Access Token from keys.json for authentication.", {
156879
+ properties: {
156880
+ project_key: {
156881
+ description: "The unique identifier for the Bitbucket project that owns the PR",
156882
+ type: import_genai20.Type.STRING
156883
+ },
156884
+ repo_slug: {
156885
+ description: "The repository slug name that owns the PR",
156886
+ type: import_genai20.Type.STRING
156887
+ },
156888
+ pr_id: {
156889
+ description: "The Pull Request unique identifier",
156890
+ type: import_genai20.Type.NUMBER
156891
+ }
156892
+ },
156893
+ required: ["project_key", "repo_slug", "pr_id"],
156894
+ type: import_genai20.Type.OBJECT
156895
+ });
156896
+ this.config = config2;
156897
+ }
156898
+ validateParams(params) {
156899
+ const errors = SchemaValidator.validate(this.schema.parameters, params);
156900
+ if (errors) {
156901
+ return errors;
156902
+ }
156903
+ if (!params.project_key || params.project_key.trim() === "") {
156904
+ return "The 'project_key' parameter cannot be empty.";
156905
+ }
156906
+ if (!params.repo_slug || params.repo_slug.trim() === "") {
156907
+ return "The 'repo_slug' parameter cannot be empty.";
156908
+ }
156909
+ if (params.pr_id <= 0) {
156910
+ return "The 'pr_id' must be a positive number.";
156911
+ }
156912
+ return null;
156913
+ }
156914
+ getDescription(params) {
156915
+ return `Retrieving diff for Bitbucket PR #${params.pr_id} in ${params.project_key}/${params.repo_slug}`;
156916
+ }
156917
+ async execute(params, signal) {
156918
+ const validationError = this.validateParams(params);
156919
+ if (validationError) {
156920
+ return {
156921
+ llmContent: `Error: Invalid parameters provided. Reason: ${validationError}`,
156922
+ returnDisplay: validationError
156923
+ };
156924
+ }
156925
+ const { project_key, repo_slug, pr_id } = params;
156926
+ const personal_access_token = this.config.getBitbucketToken();
156927
+ if (!personal_access_token) {
156928
+ return {
156929
+ llmContent: "Error: Bitbucket Personal Access Token not found in keys.json. Please configure it first.",
156930
+ returnDisplay: "Bitbucket token not configured"
156931
+ };
156932
+ }
156933
+ try {
156934
+ const apiUrl = `${BITBUCKET_URL}/rest/api/1.0/projects/${project_key}/repos/${repo_slug}/pull-requests/${pr_id}/diff`;
156935
+ const headers = {
156936
+ "Authorization": `Bearer ${personal_access_token}`,
156937
+ "Accept": "text/plain"
156938
+ };
156939
+ console.log("Bitbucket API request:", {
156940
+ url: apiUrl,
156941
+ authMethod: "Bearer",
156942
+ tokenLength: personal_access_token.length,
156943
+ headers: { ...headers, Authorization: "Bearer ***" }
156944
+ });
156945
+ const controller = new AbortController();
156946
+ const timeoutId = setTimeout(() => controller.abort(), BITBUCKET_FETCH_TIMEOUT_MS);
156947
+ let response;
156948
+ try {
156949
+ response = await fetch(apiUrl, {
156950
+ method: "GET",
156951
+ headers,
156952
+ signal: signal || controller.signal
156953
+ });
156954
+ } finally {
156955
+ clearTimeout(timeoutId);
156956
+ }
156957
+ if (response.status === 401) {
156958
+ return {
156959
+ llmContent: "Error: Authentication failed (401). Personal Access Token may be invalid or expired.",
156960
+ returnDisplay: "Authentication failed (401)"
156961
+ };
156962
+ }
156963
+ if (response.status === 403) {
156964
+ return {
156965
+ llmContent: "Error: Access denied (403). Token may not have sufficient permissions.",
156966
+ returnDisplay: "Access denied (403)"
156967
+ };
156968
+ }
156969
+ if (response.status === 404) {
156970
+ return {
156971
+ llmContent: `Error: Pull Request not found (404). PR #${pr_id} in ${project_key}/${repo_slug} may not exist.`,
156972
+ returnDisplay: `PR not found (404): #${pr_id}`
156973
+ };
156974
+ }
156975
+ if (!response.ok) {
156976
+ const errorText = await response.text().catch(() => "Unknown error");
156977
+ console.error(`Bitbucket API error (${response.status}):`, errorText.substring(0, 500));
156978
+ return {
156979
+ llmContent: `Error: API call failed with status ${response.status}: ${errorText.substring(0, 200)}`,
156980
+ returnDisplay: `API error (${response.status})`
156981
+ };
156982
+ }
156983
+ const diffText = await response.text();
156984
+ let resultText = `# Pull Request Diff: ${project_key}/${repo_slug}#${pr_id}
156985
+
156986
+ `;
156987
+ resultText += `\`\`\`diff
156988
+ ${diffText}
156989
+ \`\`\``;
156990
+ return {
156991
+ llmContent: resultText,
156992
+ returnDisplay: `Retrieved diff for Bitbucket PR #${pr_id}`
156993
+ };
156994
+ } catch (error) {
156995
+ const errorMessage = `Error retrieving Bitbucket PR diff ${project_key}/${repo_slug}#${pr_id}: ${getErrorMessage(error)}`;
156996
+ console.error(errorMessage, error);
156997
+ return {
156998
+ llmContent: `Error: ${errorMessage}`,
156999
+ returnDisplay: `Error: ${errorMessage}`
157000
+ };
157001
+ }
157002
+ }
157003
+ };
157004
+
157005
+ // packages/core/dist/src/tools/bitbucket-add-pr-comment.js
157006
+ var import_genai21 = require("@google/genai");
157007
+ init_errors();
157008
+ var BITBUCKET_FETCH_TIMEOUT_MS2 = 3e4;
157009
+ var BITBUCKET_URL2 = "https://git.rakuten-it.com";
157010
+ var BitbucketAddPrCommentTool = class _BitbucketAddPrCommentTool extends BaseTool {
157011
+ config;
157012
+ static Name = "bitbucket_add_pr_comment";
157013
+ constructor(config2) {
157014
+ super(_BitbucketAddPrCommentTool.Name, "BitbucketAddPrComment", "Adds a general comment to a specified Bitbucket Pull Request. Uses Personal Access Token from keys.json for authentication.", {
157015
+ properties: {
157016
+ project_key: {
157017
+ description: "The unique identifier for the Bitbucket project that owns the PR",
157018
+ type: import_genai21.Type.STRING
157019
+ },
157020
+ repo_slug: {
157021
+ description: "The repository slug name that owns the PR",
157022
+ type: import_genai21.Type.STRING
157023
+ },
157024
+ pr_id: {
157025
+ description: "The Pull Request unique identifier",
157026
+ type: import_genai21.Type.NUMBER
157027
+ },
157028
+ comment_text: {
157029
+ description: "The text content of the comment to add",
157030
+ type: import_genai21.Type.STRING
157031
+ }
157032
+ },
157033
+ required: ["project_key", "repo_slug", "pr_id", "comment_text"],
157034
+ type: import_genai21.Type.OBJECT
157035
+ });
157036
+ this.config = config2;
157037
+ }
157038
+ validateParams(params) {
157039
+ const errors = SchemaValidator.validate(this.schema.parameters, params);
157040
+ if (errors) {
157041
+ return errors;
157042
+ }
157043
+ if (!params.project_key || params.project_key.trim() === "") {
157044
+ return "The 'project_key' parameter cannot be empty.";
157045
+ }
157046
+ if (!params.repo_slug || params.repo_slug.trim() === "") {
157047
+ return "The 'repo_slug' parameter cannot be empty.";
157048
+ }
157049
+ if (params.pr_id <= 0) {
157050
+ return "The 'pr_id' must be a positive number.";
157051
+ }
157052
+ if (!params.comment_text || params.comment_text.trim() === "") {
157053
+ return "The 'comment_text' parameter cannot be empty.";
157054
+ }
157055
+ return null;
157056
+ }
157057
+ getDescription(params) {
157058
+ return `Adding comment to Bitbucket PR #${params.pr_id} in ${params.project_key}/${params.repo_slug}`;
157059
+ }
157060
+ async execute(params, signal) {
157061
+ const validationError = this.validateParams(params);
157062
+ if (validationError) {
157063
+ return {
157064
+ llmContent: `Error: Invalid parameters provided. Reason: ${validationError}`,
157065
+ returnDisplay: validationError
157066
+ };
157067
+ }
157068
+ const { project_key, repo_slug, pr_id, comment_text } = params;
157069
+ const personal_access_token = this.config.getBitbucketToken();
157070
+ if (!personal_access_token) {
157071
+ return {
157072
+ llmContent: "Error: Bitbucket Personal Access Token not found in keys.json. Please configure it first.",
157073
+ returnDisplay: "Bitbucket token not configured"
157074
+ };
157075
+ }
157076
+ try {
157077
+ const apiUrl = `${BITBUCKET_URL2}/rest/api/latest/projects/${project_key}/repos/${repo_slug}/pull-requests/${pr_id}/comments`;
157078
+ const headers = {
157079
+ "Authorization": `Bearer ${personal_access_token}`,
157080
+ "Content-Type": "application/json"
157081
+ };
157082
+ const payload = {
157083
+ text: comment_text
157084
+ };
157085
+ console.log("Bitbucket API request:", {
157086
+ url: apiUrl,
157087
+ method: "POST",
157088
+ authMethod: "Bearer",
157089
+ tokenLength: personal_access_token.length,
157090
+ headers: { ...headers, Authorization: "Bearer ***" }
157091
+ });
157092
+ const controller = new AbortController();
157093
+ const timeoutId = setTimeout(() => controller.abort(), BITBUCKET_FETCH_TIMEOUT_MS2);
157094
+ let response;
157095
+ try {
157096
+ response = await fetch(apiUrl, {
157097
+ method: "POST",
157098
+ headers,
157099
+ body: JSON.stringify(payload),
157100
+ signal: signal || controller.signal
157101
+ });
157102
+ } finally {
157103
+ clearTimeout(timeoutId);
157104
+ }
157105
+ if (response.status === 401) {
157106
+ return {
157107
+ llmContent: "Error: Authentication failed (401). Personal Access Token may be invalid or expired.",
157108
+ returnDisplay: "Authentication failed (401)"
157109
+ };
157110
+ }
157111
+ if (response.status === 403) {
157112
+ return {
157113
+ llmContent: "Error: Access denied (403). Token may not have sufficient permissions.",
157114
+ returnDisplay: "Access denied (403)"
157115
+ };
157116
+ }
157117
+ if (response.status === 404) {
157118
+ return {
157119
+ llmContent: `Error: Pull Request not found (404). PR #${pr_id} in ${project_key}/${repo_slug} may not exist.`,
157120
+ returnDisplay: `PR not found (404): #${pr_id}`
157121
+ };
157122
+ }
157123
+ if (!response.ok) {
157124
+ const errorText = await response.text().catch(() => "Unknown error");
157125
+ console.error(`Bitbucket API error (${response.status}):`, errorText.substring(0, 500));
157126
+ return {
157127
+ llmContent: `Error: API call failed with status ${response.status}: ${errorText.substring(0, 200)}`,
157128
+ returnDisplay: `API error (${response.status})`
157129
+ };
157130
+ }
157131
+ const responseData = await response.json();
157132
+ let resultText = `# Comment added to Pull Request: ${project_key}/${repo_slug}#${pr_id}
157133
+
157134
+ `;
157135
+ resultText += `**Comment ID**: ${responseData.id || "Unknown"}
157136
+ `;
157137
+ resultText += `**Text**: ${comment_text}
157138
+ `;
157139
+ return {
157140
+ llmContent: resultText,
157141
+ returnDisplay: `Added comment to Bitbucket PR #${pr_id}`
157142
+ };
157143
+ } catch (error) {
157144
+ const errorMessage = `Error adding comment to Bitbucket PR ${project_key}/${repo_slug}#${pr_id}: ${getErrorMessage(error)}`;
157145
+ console.error(errorMessage, error);
157146
+ return {
157147
+ llmContent: `Error: ${errorMessage}`,
157148
+ returnDisplay: `Error: ${errorMessage}`
157149
+ };
157150
+ }
157151
+ }
157152
+ };
157153
+
157154
+ // packages/core/dist/src/tools/bitbucket-add-pr-inline-comment.js
157155
+ var import_genai22 = require("@google/genai");
157156
+ init_errors();
157157
+ var BITBUCKET_FETCH_TIMEOUT_MS3 = 3e4;
157158
+ var BITBUCKET_URL3 = "https://git.rakuten-it.com";
157159
+ var BitbucketAddPrInlineCommentTool = class _BitbucketAddPrInlineCommentTool extends BaseTool {
157160
+ config;
157161
+ static Name = "bitbucket_add_pr_inline_comment";
157162
+ constructor(config2) {
157163
+ super(_BitbucketAddPrInlineCommentTool.Name, "BitbucketAddPrInlineComment", "Adds an inline comment to a specific file and line in a Bitbucket Pull Request diff. Uses Personal Access Token from keys.json for authentication.", {
157164
+ properties: {
157165
+ project_key: {
157166
+ description: "The unique identifier for the Bitbucket project that owns the PR",
157167
+ type: import_genai22.Type.STRING
157168
+ },
157169
+ repo_slug: {
157170
+ description: "The repository slug name that owns the PR",
157171
+ type: import_genai22.Type.STRING
157172
+ },
157173
+ pr_id: {
157174
+ description: "The Pull Request unique identifier",
157175
+ type: import_genai22.Type.NUMBER
157176
+ },
157177
+ file_path: {
157178
+ description: "The file path relative to repository root to add comment to",
157179
+ type: import_genai22.Type.STRING
157180
+ },
157181
+ line: {
157182
+ description: "The line number to add comment to",
157183
+ type: import_genai22.Type.NUMBER
157184
+ },
157185
+ comment_text: {
157186
+ description: "The text content of the inline comment to add",
157187
+ type: import_genai22.Type.STRING
157188
+ },
157189
+ line_type: {
157190
+ description: "The line type, default is ADDED, optional values: ADDED, REMOVED, CONTEXT",
157191
+ type: import_genai22.Type.STRING
157192
+ },
157193
+ file_type: {
157194
+ description: "The file type, default is TO, optional values: TO, FROM",
157195
+ type: import_genai22.Type.STRING
157196
+ }
157197
+ },
157198
+ required: ["project_key", "repo_slug", "pr_id", "file_path", "line", "comment_text"],
157199
+ type: import_genai22.Type.OBJECT
157200
+ });
157201
+ this.config = config2;
157202
+ }
157203
+ validateParams(params) {
157204
+ const errors = SchemaValidator.validate(this.schema.parameters, params);
157205
+ if (errors) {
157206
+ return errors;
157207
+ }
157208
+ if (!params.project_key || params.project_key.trim() === "") {
157209
+ return "The 'project_key' parameter cannot be empty.";
157210
+ }
157211
+ if (!params.repo_slug || params.repo_slug.trim() === "") {
157212
+ return "The 'repo_slug' parameter cannot be empty.";
157213
+ }
157214
+ if (params.pr_id <= 0) {
157215
+ return "The 'pr_id' must be a positive number.";
157216
+ }
157217
+ if (!params.file_path || params.file_path.trim() === "") {
157218
+ return "The 'file_path' parameter cannot be empty.";
157219
+ }
157220
+ if (params.line <= 0) {
157221
+ return "The 'line' must be a positive number.";
157222
+ }
157223
+ if (!params.comment_text || params.comment_text.trim() === "") {
157224
+ return "The 'comment_text' parameter cannot be empty.";
157225
+ }
157226
+ if (params.line_type && !["ADDED", "REMOVED", "CONTEXT"].includes(params.line_type)) {
157227
+ return "The 'line_type' must be one of: ADDED, REMOVED, CONTEXT";
157228
+ }
157229
+ if (params.file_type && !["TO", "FROM"].includes(params.file_type)) {
157230
+ return "The 'file_type' must be one of: TO, FROM";
157231
+ }
157232
+ return null;
157233
+ }
157234
+ getDescription(params) {
157235
+ return `Adding inline comment to Bitbucket PR #${params.pr_id} in ${params.project_key}/${params.repo_slug} at ${params.file_path}:${params.line}`;
157236
+ }
157237
+ async execute(params, signal) {
157238
+ const validationError = this.validateParams(params);
157239
+ if (validationError) {
157240
+ return {
157241
+ llmContent: `Error: Invalid parameters provided. Reason: ${validationError}`,
157242
+ returnDisplay: validationError
157243
+ };
157244
+ }
157245
+ const { project_key, repo_slug, pr_id, file_path, line, comment_text, line_type, file_type } = params;
157246
+ const personal_access_token = this.config.getBitbucketToken();
157247
+ if (!personal_access_token) {
157248
+ return {
157249
+ llmContent: "Error: Bitbucket Personal Access Token not found in keys.json. Please configure it first.",
157250
+ returnDisplay: "Bitbucket token not configured"
157251
+ };
157252
+ }
157253
+ try {
157254
+ const apiUrl = `${BITBUCKET_URL3}/rest/api/latest/projects/${project_key}/repos/${repo_slug}/pull-requests/${pr_id}/comments`;
157255
+ const headers = {
157256
+ "Authorization": `Bearer ${personal_access_token}`,
157257
+ "Content-Type": "application/json"
157258
+ };
157259
+ const payload = {
157260
+ text: comment_text,
157261
+ anchor: {
157262
+ path: file_path,
157263
+ line,
157264
+ lineType: line_type || "ADDED",
157265
+ fileType: file_type || "TO"
157266
+ }
157267
+ };
157268
+ console.log("Bitbucket API request:", {
157269
+ url: apiUrl,
157270
+ method: "POST",
157271
+ authMethod: "Bearer",
157272
+ tokenLength: personal_access_token.length,
157273
+ headers: { ...headers, Authorization: "Bearer ***" }
157274
+ });
157275
+ const controller = new AbortController();
157276
+ const timeoutId = setTimeout(() => controller.abort(), BITBUCKET_FETCH_TIMEOUT_MS3);
157277
+ let response;
157278
+ try {
157279
+ response = await fetch(apiUrl, {
157280
+ method: "POST",
157281
+ headers,
157282
+ body: JSON.stringify(payload),
157283
+ signal: signal || controller.signal
157284
+ });
157285
+ } finally {
157286
+ clearTimeout(timeoutId);
157287
+ }
157288
+ if (response.status === 401) {
157289
+ return {
157290
+ llmContent: "Error: Authentication failed (401). Personal Access Token may be invalid or expired.",
157291
+ returnDisplay: "Authentication failed (401)"
157292
+ };
157293
+ }
157294
+ if (response.status === 403) {
157295
+ return {
157296
+ llmContent: "Error: Access denied (403). Token may not have sufficient permissions.",
157297
+ returnDisplay: "Access denied (403)"
157298
+ };
157299
+ }
157300
+ if (response.status === 404) {
157301
+ return {
157302
+ llmContent: `Error: Pull Request not found (404). PR #${pr_id} in ${project_key}/${repo_slug} may not exist.`,
157303
+ returnDisplay: `PR not found (404): #${pr_id}`
157304
+ };
157305
+ }
157306
+ if (!response.ok) {
157307
+ const errorText = await response.text().catch(() => "Unknown error");
157308
+ console.error(`Bitbucket API error (${response.status}):`, errorText.substring(0, 500));
157309
+ return {
157310
+ llmContent: `Error: API call failed with status ${response.status}: ${errorText.substring(0, 200)}`,
157311
+ returnDisplay: `API error (${response.status})`
157312
+ };
157313
+ }
157314
+ const responseData = await response.json();
157315
+ let resultText = `# Inline comment added to Pull Request: ${project_key}/${repo_slug}#${pr_id}
157316
+
157317
+ `;
157318
+ resultText += `**File**: ${file_path}
157319
+ `;
157320
+ resultText += `**Line**: ${line}
157321
+ `;
157322
+ resultText += `**Line Type**: ${line_type || "ADDED"}
157323
+ `;
157324
+ resultText += `**File Type**: ${file_type || "TO"}
157325
+ `;
157326
+ resultText += `**Comment ID**: ${responseData.id || "Unknown"}
157327
+ `;
157328
+ resultText += `**Text**: ${comment_text}
157329
+ `;
157330
+ return {
157331
+ llmContent: resultText,
157332
+ returnDisplay: `Added inline comment to Bitbucket PR #${pr_id} at ${file_path}:${line}`
157333
+ };
157334
+ } catch (error) {
157335
+ const errorMessage = `Error adding inline comment to Bitbucket PR ${project_key}/${repo_slug}#${pr_id}: ${getErrorMessage(error)}`;
157336
+ console.error(errorMessage, error);
157337
+ return {
157338
+ llmContent: `Error: ${errorMessage}`,
157339
+ returnDisplay: `Error: ${errorMessage}`
157340
+ };
157341
+ }
157342
+ }
157343
+ };
157344
+
156391
157345
  // packages/core/dist/src/utils/getFolderStructure.js
156392
157346
  var fs16 = __toESM(require("fs/promises"), 1);
156393
157347
  var path17 = __toESM(require("path"), 1);
@@ -156751,7 +157705,7 @@ var import_node_fs5 = __toESM(require("node:fs"), 1);
156751
157705
  var import_node_process7 = __toESM(require("node:process"), 1);
156752
157706
  function getCoreSystemPrompt(userMemory) {
156753
157707
  let systemMdEnabled = false;
156754
- let systemMdPath = import_node_path6.default.join(GEMINI_CONFIG_DIR, "system.md");
157708
+ let systemMdPath = import_node_path6.default.join(MPDAI_CONFIG_DIR, "system.md");
156755
157709
  const systemMdVar = import_node_process7.default.env.GEMINI_SYSTEM_MD?.toLowerCase();
156756
157710
  if (systemMdVar && !["0", "false"].includes(systemMdVar)) {
156757
157711
  systemMdEnabled = true;
@@ -157056,7 +158010,7 @@ The structure MUST be as follows:
157056
158010
  }
157057
158011
 
157058
158012
  // packages/core/dist/src/utils/nextSpeakerChecker.js
157059
- var import_genai18 = require("@google/genai");
158013
+ var import_genai23 = require("@google/genai");
157060
158014
  var CHECK_PROMPT = `Analyze *only* the content and structure of your immediately preceding response (your last turn in the conversation history). Based *strictly* on that response, determine who should logically speak next: the 'user' or the 'model' (you).
157061
158015
  **Decision Rules (apply in order):**
157062
158016
  1. **Model Continues:** If your last response explicitly states an immediate next action *you* intend to take (e.g., "Next, I will...", "Now I'll process...", "Moving on to analyze...", indicates an intended tool call that didn't execute), OR if the response seems clearly incomplete (cut off mid-thought without a natural conclusion), then the **'model'** should speak next.
@@ -157083,14 +158037,14 @@ Respond *only* in JSON format according to the following schema. Do not include
157083
158037
  \`\`\`
157084
158038
  `;
157085
158039
  var RESPONSE_SCHEMA = {
157086
- type: import_genai18.Type.OBJECT,
158040
+ type: import_genai23.Type.OBJECT,
157087
158041
  properties: {
157088
158042
  reasoning: {
157089
- type: import_genai18.Type.STRING,
158043
+ type: import_genai23.Type.STRING,
157090
158044
  description: "Brief explanation justifying the 'next_speaker' choice based *strictly* on the applicable rule and the content/structure of the preceding turn."
157091
158045
  },
157092
158046
  next_speaker: {
157093
- type: import_genai18.Type.STRING,
158047
+ type: import_genai23.Type.STRING,
157094
158048
  enum: ["user", "model"],
157095
158049
  description: "Who should speak next based *only* on the preceding turn and the decision rules"
157096
158050
  }
@@ -157178,7 +158132,7 @@ function checkForIncompleteToolCalls(history) {
157178
158132
  }
157179
158133
 
157180
158134
  // packages/core/dist/src/core/geminiChat.js
157181
- var import_genai19 = require("@google/genai");
158135
+ var import_genai24 = require("@google/genai");
157182
158136
 
157183
158137
  // packages/core/dist/src/utils/retry.js
157184
158138
  init_contentGenerator();
@@ -157555,7 +158509,7 @@ var fs19 = __toESM(require("fs"), 1);
157555
158509
  var path20 = __toESM(require("path"), 1);
157556
158510
  var import_crypto7 = require("crypto");
157557
158511
  var homeDir = os6.homedir() ?? "";
157558
- var geminiDir = path20.join(homeDir, GEMINI_DIR2);
158512
+ var geminiDir = path20.join(homeDir, MPDAI_DIR2);
157559
158513
  var installationIdFile = path20.join(geminiDir, "installation_id");
157560
158514
  function ensureGeminiDirExists() {
157561
158515
  if (!fs19.existsSync(geminiDir)) {
@@ -158405,7 +159359,7 @@ var GeminiChat = class {
158405
159359
  */
158406
159360
  async sendMessage(params) {
158407
159361
  await this.sendPromise;
158408
- const userContent = (0, import_genai19.createUserContent)(params.message);
159362
+ const userContent = (0, import_genai24.createUserContent)(params.message);
158409
159363
  const requestContents = this.getHistory(true).concat(userContent);
158410
159364
  this._logApiRequest(requestContents, this.config.getModel());
158411
159365
  const startTime = Date.now();
@@ -158477,7 +159431,7 @@ var GeminiChat = class {
158477
159431
  */
158478
159432
  async sendMessageStream(params) {
158479
159433
  await this.sendPromise;
158480
- const userContent = (0, import_genai19.createUserContent)(params.message);
159434
+ const userContent = (0, import_genai24.createUserContent)(params.message);
158481
159435
  const requestContents = this.getHistory(true).concat(userContent);
158482
159436
  this._logApiRequest(requestContents, this.config.getModel());
158483
159437
  const startTime = Date.now();
@@ -159114,7 +160068,7 @@ var GitIgnoreParser = class {
159114
160068
 
159115
160069
  // packages/core/dist/src/services/fileDiscoveryService.js
159116
160070
  var path22 = __toESM(require("path"), 1);
159117
- var GEMINI_IGNORE_FILE_NAME = ".geminiignore";
160071
+ var GEMINI_IGNORE_FILE_NAME = ".mpdaiignore";
159118
160072
  var FileDiscoveryService = class {
159119
160073
  gitIgnoreFilter = null;
159120
160074
  geminiIgnoreFilter = null;
@@ -159185,7 +160139,7 @@ var FileDiscoveryService = class {
159185
160139
  return false;
159186
160140
  }
159187
160141
  /**
159188
- * Returns loaded patterns from .geminiignore
160142
+ * Returns loaded patterns from .mpdaiignore
159189
160143
  */
159190
160144
  getGeminiIgnorePatterns() {
159191
160145
  return this.geminiIgnoreFilter?.getPatterns() ?? [];
@@ -163728,7 +164682,7 @@ var GitService = class {
163728
164682
  }
163729
164683
  getHistoryDir() {
163730
164684
  const hash = getProjectHash(this.projectRoot);
163731
- return path23.join(os7.homedir(), GEMINI_DIR2, "history", hash);
164685
+ return path23.join(os7.homedir(), MPDAI_DIR2, "history", hash);
163732
164686
  }
163733
164687
  async initialize() {
163734
164688
  if (!isGitRepository(this.projectRoot)) {
@@ -164006,7 +164960,7 @@ async function getGeminiMdFilePathsInternal(currentWorkingDirectory, userHomePat
164006
164960
  for (const geminiMdFilename of geminiMdFilenames) {
164007
164961
  const resolvedCwd = path26.resolve(currentWorkingDirectory);
164008
164962
  const resolvedHome = path26.resolve(userHomePath);
164009
- const globalMemoryPath = path26.join(resolvedHome, GEMINI_CONFIG_DIR, geminiMdFilename);
164963
+ const globalMemoryPath = path26.join(resolvedHome, MPDAI_CONFIG_DIR, geminiMdFilename);
164010
164964
  if (debugMode)
164011
164965
  logger3.debug(`Searching for ${geminiMdFilename} starting from CWD: ${resolvedCwd}`);
164012
164966
  if (debugMode)
@@ -164030,7 +164984,7 @@ async function getGeminiMdFilePathsInternal(currentWorkingDirectory, userHomePat
164030
164984
  if (debugMode) {
164031
164985
  logger3.debug(`Checking for ${geminiMdFilename} in (upward scan): ${currentDir}`);
164032
164986
  }
164033
- if (currentDir === path26.join(resolvedHome, GEMINI_CONFIG_DIR)) {
164987
+ if (currentDir === path26.join(resolvedHome, MPDAI_CONFIG_DIR)) {
164034
164988
  if (debugMode) {
164035
164989
  logger3.debug(`Upward scan reached global config dir path, stopping upward search here: ${currentDir}`);
164036
164990
  }
@@ -164374,7 +165328,7 @@ var Config = class {
164374
165328
  return this.geminiClient;
164375
165329
  }
164376
165330
  getGeminiDir() {
164377
- return path27.join(this.targetDir, GEMINI_CONFIG_DIR);
165331
+ return path27.join(this.targetDir, MPDAI_CONFIG_DIR);
164378
165332
  }
164379
165333
  getProjectTempDir() {
164380
165334
  return getProjectTempDir(this.getProjectRoot());
@@ -164428,6 +165382,72 @@ var Config = class {
164428
165382
  this.setGeminiMdFileCount(fileCount);
164429
165383
  return { memoryContent, fileCount };
164430
165384
  }
165385
+ /**
165386
+ * Get Confluence Advanced Access Token from keys.json
165387
+ * @returns The Personal Access Token or null if not found
165388
+ */
165389
+ getConfluenceToken() {
165390
+ try {
165391
+ const keysJsonPath = (0, import_node_path7.join)((0, import_node_os3.homedir)(), ".mpdai", "keys.json");
165392
+ if (!(0, import_node_fs6.existsSync)(keysJsonPath)) {
165393
+ return null;
165394
+ }
165395
+ const content = (0, import_node_fs6.readFileSync)(keysJsonPath, "utf-8");
165396
+ const keys = JSON.parse(content);
165397
+ const confluenceKey = keys.find((key) => key.name === "confluence");
165398
+ if (confluenceKey && confluenceKey.value1) {
165399
+ return confluenceKey.value1;
165400
+ }
165401
+ return null;
165402
+ } catch (error) {
165403
+ console.error("Failed to read Confluence token from keys.json:", error);
165404
+ return null;
165405
+ }
165406
+ }
165407
+ /**
165408
+ * Get Jira Personal Access Token from keys.json
165409
+ * @returns The Personal Access Token or null if not found
165410
+ */
165411
+ getJiraToken() {
165412
+ try {
165413
+ const keysJsonPath = (0, import_node_path7.join)((0, import_node_os3.homedir)(), ".mpdai", "keys.json");
165414
+ if (!(0, import_node_fs6.existsSync)(keysJsonPath)) {
165415
+ return null;
165416
+ }
165417
+ const content = (0, import_node_fs6.readFileSync)(keysJsonPath, "utf-8");
165418
+ const keys = JSON.parse(content);
165419
+ const jiraKey = keys.find((key) => key.name === "jira");
165420
+ if (jiraKey && jiraKey.value1) {
165421
+ return jiraKey.value1;
165422
+ }
165423
+ return null;
165424
+ } catch (error) {
165425
+ console.error("Failed to read Jira token from keys.json:", error);
165426
+ return null;
165427
+ }
165428
+ }
165429
+ /**
165430
+ * Get Bitbucket Personal Access Token from keys.json
165431
+ * @returns The Personal Access Token or null if not found
165432
+ */
165433
+ getBitbucketToken() {
165434
+ try {
165435
+ const keysJsonPath = (0, import_node_path7.join)((0, import_node_os3.homedir)(), ".mpdai", "keys.json");
165436
+ if (!(0, import_node_fs6.existsSync)(keysJsonPath)) {
165437
+ return null;
165438
+ }
165439
+ const content = (0, import_node_fs6.readFileSync)(keysJsonPath, "utf-8");
165440
+ const keys = JSON.parse(content);
165441
+ const bitbucketKey = keys.find((key) => key.name === "bitbucket");
165442
+ if (bitbucketKey && bitbucketKey.value1) {
165443
+ return bitbucketKey.value1;
165444
+ }
165445
+ return null;
165446
+ } catch (error) {
165447
+ console.error("Failed to read Bitbucket token from keys.json:", error);
165448
+ return null;
165449
+ }
165450
+ }
164431
165451
  async createToolRegistry() {
164432
165452
  const registry = new ToolRegistry(this);
164433
165453
  const targetDir = this.getTargetDir();
@@ -164460,9 +165480,24 @@ var Config = class {
164460
165480
  registerCoreTool(EditTool, this);
164461
165481
  registerCoreTool(WriteFileTool, this);
164462
165482
  }
164463
- if (import_node_process8.default.env.USE_GEMINI_TOOL) {
165483
+ const useMpdaiTool = import_node_process8.default.env.USE_MPDAI_TOOL !== "false";
165484
+ if (useMpdaiTool) {
164464
165485
  registerCoreTool(WebFetchTool, this);
164465
165486
  registerCoreTool(WebSearchTool, this);
165487
+ const confluenceToken = this.getConfluenceToken();
165488
+ if (confluenceToken) {
165489
+ registerCoreTool(ConfluenceGetPageTool, this);
165490
+ }
165491
+ const jiraToken = this.getJiraToken();
165492
+ if (jiraToken) {
165493
+ registerCoreTool(JiraGetIssueTool, this);
165494
+ }
165495
+ const bitbucketToken = this.getBitbucketToken();
165496
+ if (bitbucketToken) {
165497
+ registerCoreTool(BitbucketGetPrDiffTool, this);
165498
+ registerCoreTool(BitbucketAddPrCommentTool, this);
165499
+ registerCoreTool(BitbucketAddPrInlineCommentTool, this);
165500
+ }
164466
165501
  }
164467
165502
  await registry.discoverTools();
164468
165503
  return registry;
@@ -165054,7 +166089,7 @@ init_models();
165054
166089
  var fs26 = __toESM(require("fs"), 1);
165055
166090
  var path29 = __toESM(require("path"), 1);
165056
166091
  var os9 = __toESM(require("os"), 1);
165057
- var EXTENSIONS_DIRECTORY_NAME = path29.join(".gemini", "extensions");
166092
+ var EXTENSIONS_DIRECTORY_NAME = path29.join(".mpdai", "extensions");
165058
166093
  var EXTENSIONS_CONFIG_FILENAME = "gemini-extension.json";
165059
166094
  function loadExtensions(workspaceDir) {
165060
166095
  const allExtensions = [
@@ -165164,25 +166199,25 @@ function filterActiveExtensions(extensions, enabledExtensionNames) {
165164
166199
  }
165165
166200
 
165166
166201
  // node_modules/read-package-up/index.js
165167
- var import_node_path9 = __toESM(require("node:path"), 1);
166202
+ var import_node_path10 = __toESM(require("node:path"), 1);
165168
166203
 
165169
166204
  // node_modules/find-up-simple/index.js
165170
166205
  var import_node_process9 = __toESM(require("node:process"), 1);
165171
166206
  var import_promises5 = __toESM(require("node:fs/promises"), 1);
165172
166207
  var import_node_url4 = require("node:url");
165173
- var import_node_path7 = __toESM(require("node:path"), 1);
166208
+ var import_node_path8 = __toESM(require("node:path"), 1);
165174
166209
  var toPath = (urlOrPath) => urlOrPath instanceof URL ? (0, import_node_url4.fileURLToPath)(urlOrPath) : urlOrPath;
165175
166210
  async function findUp(name2, {
165176
166211
  cwd = import_node_process9.default.cwd(),
165177
166212
  type = "file",
165178
166213
  stopAt
165179
166214
  } = {}) {
165180
- let directory = import_node_path7.default.resolve(toPath(cwd) ?? "");
165181
- const { root } = import_node_path7.default.parse(directory);
165182
- stopAt = import_node_path7.default.resolve(directory, toPath(stopAt ?? root));
165183
- const isAbsoluteName = import_node_path7.default.isAbsolute(name2);
166215
+ let directory = import_node_path8.default.resolve(toPath(cwd) ?? "");
166216
+ const { root } = import_node_path8.default.parse(directory);
166217
+ stopAt = import_node_path8.default.resolve(directory, toPath(stopAt ?? root));
166218
+ const isAbsoluteName = import_node_path8.default.isAbsolute(name2);
165184
166219
  while (directory) {
165185
- const filePath = isAbsoluteName ? name2 : import_node_path7.default.join(directory, name2);
166220
+ const filePath = isAbsoluteName ? name2 : import_node_path8.default.join(directory, name2);
165186
166221
  try {
165187
166222
  const stats = await import_promises5.default.stat(filePath);
165188
166223
  if (type === "file" && stats.isFile() || type === "directory" && stats.isDirectory()) {
@@ -165193,13 +166228,13 @@ async function findUp(name2, {
165193
166228
  if (directory === stopAt || directory === root) {
165194
166229
  break;
165195
166230
  }
165196
- directory = import_node_path7.default.dirname(directory);
166231
+ directory = import_node_path8.default.dirname(directory);
165197
166232
  }
165198
166233
  }
165199
166234
 
165200
166235
  // node_modules/read-pkg/index.js
165201
166236
  var import_promises6 = __toESM(require("node:fs/promises"), 1);
165202
- var import_node_path8 = __toESM(require("node:path"), 1);
166237
+ var import_node_path9 = __toESM(require("node:path"), 1);
165203
166238
 
165204
166239
  // node_modules/parse-json/index.js
165205
166240
  var import_code_frame = __toESM(require_lib4(), 1);
@@ -165328,7 +166363,7 @@ function toPath2(urlOrPath) {
165328
166363
  }
165329
166364
 
165330
166365
  // node_modules/read-pkg/index.js
165331
- var getPackagePath = (cwd) => import_node_path8.default.resolve(toPath2(cwd) ?? ".", "package.json");
166366
+ var getPackagePath = (cwd) => import_node_path9.default.resolve(toPath2(cwd) ?? ".", "package.json");
165332
166367
  var _readPackage = (file, normalize5) => {
165333
166368
  const json = typeof file === "string" ? parseJson(file) : file;
165334
166369
  if (normalize5) {
@@ -165348,7 +166383,7 @@ async function readPackageUp(options) {
165348
166383
  return;
165349
166384
  }
165350
166385
  return {
165351
- packageJson: await readPackage({ ...options, cwd: import_node_path9.default.dirname(filePath) }),
166386
+ packageJson: await readPackage({ ...options, cwd: import_node_path10.default.dirname(filePath) }),
165352
166387
  path: filePath
165353
166388
  };
165354
166389
  }
@@ -166182,7 +167217,7 @@ var DefaultDark = new Theme(
166182
167217
  );
166183
167218
 
166184
167219
  // packages/cli/src/config/settings.ts
166185
- var SETTINGS_DIRECTORY_NAME = ".gemini";
167220
+ var SETTINGS_DIRECTORY_NAME = ".mpdai";
166186
167221
  var USER_SETTINGS_DIR = path34.join((0, import_os7.homedir)(), SETTINGS_DIRECTORY_NAME);
166187
167222
  var USER_SETTINGS_PATH = path34.join(USER_SETTINGS_DIR, "settings.json");
166188
167223
  var LoadedSettings = class {
@@ -166256,7 +167291,7 @@ function resolveEnvVarsInObject(obj) {
166256
167291
  function findEnvFile(startDir) {
166257
167292
  let currentDir = path34.resolve(startDir);
166258
167293
  while (true) {
166259
- const geminiEnvPath = path34.join(currentDir, GEMINI_CONFIG_DIR, ".env");
167294
+ const geminiEnvPath = path34.join(currentDir, MPDAI_CONFIG_DIR, ".env");
166260
167295
  if (fs27.existsSync(geminiEnvPath)) {
166261
167296
  return geminiEnvPath;
166262
167297
  }
@@ -166266,7 +167301,7 @@ function findEnvFile(startDir) {
166266
167301
  }
166267
167302
  const parentDir = path34.dirname(currentDir);
166268
167303
  if (parentDir === currentDir || !parentDir) {
166269
- const homeGeminiEnvPath = path34.join((0, import_os7.homedir)(), GEMINI_CONFIG_DIR, ".env");
167304
+ const homeGeminiEnvPath = path34.join((0, import_os7.homedir)(), MPDAI_CONFIG_DIR, ".env");
166270
167305
  if (fs27.existsSync(homeGeminiEnvPath)) {
166271
167306
  return homeGeminiEnvPath;
166272
167307
  }