mpd-llm-cli 0.1.25 → 0.1.28
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 +1157 -128
- package/bundle/api.js +1150 -121
- package/bundle/gemini.js +1270 -136
- package/package.json +2 -2
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
|
|
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 =
|
|
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(),
|
|
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(),
|
|
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,
|
|
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
|
-
|
|
19619
|
+
MPDAI_DIR = ".mpdai";
|
|
19620
19620
|
CREDENTIAL_FILENAME = "oauth_creds.json";
|
|
19621
19621
|
GOOGLE_ACCOUNT_ID_FILENAME = "google_account_id";
|
|
19622
19622
|
}
|
|
@@ -35857,14 +35857,14 @@ var require_util4 = __commonJS({
|
|
|
35857
35857
|
});
|
|
35858
35858
|
}
|
|
35859
35859
|
exports2.useFunc = useFunc;
|
|
35860
|
-
var
|
|
35861
|
-
(function(
|
|
35862
|
-
|
|
35863
|
-
|
|
35864
|
-
})(
|
|
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 ===
|
|
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
|
|
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 ?
|
|
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
|
|
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
|
|
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
|
|
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, [
|
|
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, [
|
|
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
|
-
|
|
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 =
|
|
62690
|
+
module2.exports = Type21;
|
|
62691
62691
|
var Namespace = require_namespace();
|
|
62692
|
-
((
|
|
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
|
|
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(
|
|
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 =
|
|
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
|
-
|
|
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
|
-
|
|
62812
|
-
var type = new
|
|
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 ?
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
62945
|
+
Type21.prototype.isReservedId = function isReservedId(id) {
|
|
62946
62946
|
return Namespace.isReservedId(this.reserved, id);
|
|
62947
62947
|
};
|
|
62948
|
-
|
|
62948
|
+
Type21.prototype.isReservedName = function isReservedName(name2) {
|
|
62949
62949
|
return Namespace.isReservedName(this.reserved, name2);
|
|
62950
62950
|
};
|
|
62951
|
-
|
|
62951
|
+
Type21.prototype.create = function create(properties) {
|
|
62952
62952
|
return new this.ctor(properties);
|
|
62953
62953
|
};
|
|
62954
|
-
|
|
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
|
-
|
|
62991
|
+
Type21.prototype.encode = function encode_setup(message, writer) {
|
|
62992
62992
|
return this.setup().encode(message, writer);
|
|
62993
62993
|
};
|
|
62994
|
-
|
|
62994
|
+
Type21.prototype.encodeDelimited = function encodeDelimited(message, writer) {
|
|
62995
62995
|
return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim();
|
|
62996
62996
|
};
|
|
62997
|
-
|
|
62997
|
+
Type21.prototype.decode = function decode_setup(reader, length) {
|
|
62998
62998
|
return this.setup().decode(reader, length);
|
|
62999
62999
|
};
|
|
63000
|
-
|
|
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
|
-
|
|
63005
|
+
Type21.prototype.verify = function verify_setup(message) {
|
|
63006
63006
|
return this.setup().verify(message);
|
|
63007
63007
|
};
|
|
63008
|
-
|
|
63008
|
+
Type21.prototype.fromObject = function fromObject(object) {
|
|
63009
63009
|
return this.setup().fromObject(object);
|
|
63010
63010
|
};
|
|
63011
|
-
|
|
63011
|
+
Type21.prototype.toObject = function toObject(message, options) {
|
|
63012
63012
|
return this.setup().toObject(message, options);
|
|
63013
63013
|
};
|
|
63014
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
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 (!
|
|
63333
|
-
|
|
63334
|
-
var type = new
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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(
|
|
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
|
|
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
|
-
|
|
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
|
|
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(
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
99256
|
+
var homedir9 = getHomedir();
|
|
99257
99257
|
var defaultPaths = function() {
|
|
99258
99258
|
return [
|
|
99259
|
-
path35.join(
|
|
99260
|
-
path35.join(
|
|
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
|
|
99746
|
+
var homedir9 = getHomedir();
|
|
99747
99747
|
var defaultPaths = function() {
|
|
99748
99748
|
return [
|
|
99749
|
-
path35.join(
|
|
99750
|
-
path35.join(
|
|
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(
|
|
99788
|
-
var body =
|
|
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
|
|
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(
|
|
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(
|
|
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
|
|
@@ -140585,7 +140588,7 @@ var SchemaValidator = class {
|
|
|
140585
140588
|
var import_node_path3 = __toESM(require("node:path"), 1);
|
|
140586
140589
|
var import_os = __toESM(require("os"), 1);
|
|
140587
140590
|
var crypto8 = __toESM(require("crypto"), 1);
|
|
140588
|
-
var
|
|
140591
|
+
var MPDAI_DIR2 = ".mpdai";
|
|
140589
140592
|
var TMP_DIR_NAME = "tmp";
|
|
140590
140593
|
function shortenPath(filePath, maxLen = 35) {
|
|
140591
140594
|
if (filePath.length <= maxLen) {
|
|
@@ -140641,7 +140644,7 @@ function getProjectHash(projectRoot) {
|
|
|
140641
140644
|
}
|
|
140642
140645
|
function getProjectTempDir(projectRoot) {
|
|
140643
140646
|
const hash = getProjectHash(projectRoot);
|
|
140644
|
-
return import_node_path3.default.join(import_os.default.homedir(),
|
|
140647
|
+
return import_node_path3.default.join(import_os.default.homedir(), MPDAI_DIR2, TMP_DIR_NAME, hash);
|
|
140645
140648
|
}
|
|
140646
140649
|
|
|
140647
140650
|
// packages/core/dist/src/tools/ls.js
|
|
@@ -141252,7 +141255,7 @@ var ReadFileTool = class _ReadFileTool extends BaseTool {
|
|
|
141252
141255
|
const fileService = this.config.getFileService();
|
|
141253
141256
|
if (fileService.shouldGeminiIgnoreFile(params.absolute_path)) {
|
|
141254
141257
|
const relativePath = makeRelative(params.absolute_path, this.rootDirectory);
|
|
141255
|
-
return `File path '${shortenPath(relativePath)}' is ignored by .
|
|
141258
|
+
return `File path '${shortenPath(relativePath)}' is ignored by .mpdaiignore pattern(s).`;
|
|
141256
141259
|
}
|
|
141257
141260
|
return null;
|
|
141258
141261
|
}
|
|
@@ -149354,7 +149357,7 @@ Do NOT use this tool:
|
|
|
149354
149357
|
|
|
149355
149358
|
- \`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
149359
|
`;
|
|
149357
|
-
var
|
|
149360
|
+
var MPDAI_CONFIG_DIR = ".mpdai";
|
|
149358
149361
|
var DEFAULT_CONTEXT_FILENAME = "MEMORY.md";
|
|
149359
149362
|
var MEMORY_SECTION_HEADER = "## Memory Added Memories";
|
|
149360
149363
|
var currentGeminiMdFilename = DEFAULT_CONTEXT_FILENAME;
|
|
@@ -149380,7 +149383,7 @@ function getAllGeminiMdFilenames() {
|
|
|
149380
149383
|
return [currentGeminiMdFilename];
|
|
149381
149384
|
}
|
|
149382
149385
|
function getGlobalMemoryFilePath() {
|
|
149383
|
-
return path13.join((0, import_os3.homedir)(),
|
|
149386
|
+
return path13.join((0, import_os3.homedir)(), MPDAI_CONFIG_DIR, getCurrentGeminiMdFilename());
|
|
149384
149387
|
}
|
|
149385
149388
|
function ensureNewlineSeparation(currentContent) {
|
|
149386
149389
|
if (currentContent.length === 0)
|
|
@@ -149600,7 +149603,7 @@ Use this tool when the user's query implies needing the content of several files
|
|
|
149600
149603
|
if (this.geminiIgnorePatterns.length > 0) {
|
|
149601
149604
|
const geminiPatternsInEffect = this.geminiIgnorePatterns.filter((p) => finalExclusionPatternsForDescription.includes(p)).length;
|
|
149602
149605
|
if (geminiPatternsInEffect > 0) {
|
|
149603
|
-
excludeDesc += ` (includes ${geminiPatternsInEffect} from .
|
|
149606
|
+
excludeDesc += ` (includes ${geminiPatternsInEffect} from .mpdaiignore)`;
|
|
149604
149607
|
}
|
|
149605
149608
|
}
|
|
149606
149609
|
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 +151718,8 @@ function many(p) {
|
|
|
151715
151718
|
function many1(p) {
|
|
151716
151719
|
return ab(p, many(p), (head, tail) => [head, ...tail]);
|
|
151717
151720
|
}
|
|
151718
|
-
function ab(pa, pb,
|
|
151719
|
-
return (data, i) => mapOuter(pa(data, i), (ma) => mapInner(pb(data, ma.position), (vb, j) =>
|
|
151721
|
+
function ab(pa, pb, join15) {
|
|
151722
|
+
return (data, i) => mapOuter(pa(data, i), (ma) => mapInner(pb(data, ma.position), (vb, j) => join15(ma.value, vb, data, i, j)));
|
|
151720
151723
|
}
|
|
151721
151724
|
function left2(pa, pb) {
|
|
151722
151725
|
return ab(pa, pb, (va) => va);
|
|
@@ -151724,8 +151727,8 @@ function left2(pa, pb) {
|
|
|
151724
151727
|
function right2(pa, pb) {
|
|
151725
151728
|
return ab(pa, pb, (va, vb) => vb);
|
|
151726
151729
|
}
|
|
151727
|
-
function abc(pa, pb, pc,
|
|
151728
|
-
return (data, i) => mapOuter(pa(data, i), (ma) => mapOuter(pb(data, ma.position), (mb) => mapInner(pc(data, mb.position), (vc, j) =>
|
|
151730
|
+
function abc(pa, pb, pc, join15) {
|
|
151731
|
+
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
151732
|
}
|
|
151730
151733
|
function middle(pa, pb, pc) {
|
|
151731
151734
|
return abc(pa, pb, pc, (ra, rb) => rb);
|
|
@@ -156388,6 +156391,951 @@ ${modifiedResponseText}`,
|
|
|
156388
156391
|
}
|
|
156389
156392
|
};
|
|
156390
156393
|
|
|
156394
|
+
// packages/core/dist/src/tools/confluence-get-page.js
|
|
156395
|
+
var import_genai18 = require("@google/genai");
|
|
156396
|
+
init_errors();
|
|
156397
|
+
var CONFLUENCE_FETCH_TIMEOUT_MS = 3e4;
|
|
156398
|
+
var CONFLUENCE_URL = "https://confluence.rakuten-it.com/confluence";
|
|
156399
|
+
var ConfluenceGetPageTool = class _ConfluenceGetPageTool extends BaseTool {
|
|
156400
|
+
config;
|
|
156401
|
+
static Name = "confluence_get_page";
|
|
156402
|
+
constructor(config2) {
|
|
156403
|
+
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.", {
|
|
156404
|
+
properties: {
|
|
156405
|
+
page_id: {
|
|
156406
|
+
description: "The ID of the Confluence page to retrieve",
|
|
156407
|
+
type: import_genai18.Type.STRING
|
|
156408
|
+
},
|
|
156409
|
+
convert_to_markdown: {
|
|
156410
|
+
description: "Whether to convert HTML content to markdown format (default: true)",
|
|
156411
|
+
type: import_genai18.Type.STRING
|
|
156412
|
+
}
|
|
156413
|
+
},
|
|
156414
|
+
required: ["page_id"],
|
|
156415
|
+
type: import_genai18.Type.OBJECT
|
|
156416
|
+
});
|
|
156417
|
+
this.config = config2;
|
|
156418
|
+
}
|
|
156419
|
+
validateParams(params) {
|
|
156420
|
+
const errors = SchemaValidator.validate(this.schema.parameters, params);
|
|
156421
|
+
if (errors) {
|
|
156422
|
+
return errors;
|
|
156423
|
+
}
|
|
156424
|
+
if (!params.page_id || params.page_id.trim() === "") {
|
|
156425
|
+
return "The 'page_id' parameter cannot be empty.";
|
|
156426
|
+
}
|
|
156427
|
+
return null;
|
|
156428
|
+
}
|
|
156429
|
+
getDescription(params) {
|
|
156430
|
+
return `Retrieving Confluence page ${params.page_id} from ${CONFLUENCE_URL}`;
|
|
156431
|
+
}
|
|
156432
|
+
/**
|
|
156433
|
+
* Process HTML content to handle user mentions and page links
|
|
156434
|
+
*/
|
|
156435
|
+
processHtmlContent(html, spaceKey, baseUrl) {
|
|
156436
|
+
let processed = html;
|
|
156437
|
+
processed = processed.replace(/<ac:link>[\s\S]*?<ri:user[^>]+ri:username="([^"]+)"\s*\/>[\s\S]*?<\/ac:link>/g, "@$1");
|
|
156438
|
+
processed = processed.replace(/<ac:link[^>]*>[\s\S]*?<ri:page[^>]+ri:content-title="([^"]*)"\s*ri:space-key="([^"]*)"\s*\/>[\s\S]*?<\/ac:link>/g, (match2, title) => {
|
|
156439
|
+
return title || "Page Link";
|
|
156440
|
+
});
|
|
156441
|
+
processed = processed.replace(/<\/?(span|div|p)[^>]*>/g, "\n");
|
|
156442
|
+
processed = processed.replace(/<strong>([^<]*)<\/strong>/g, "**$1**");
|
|
156443
|
+
processed = processed.replace(/<b>([^<]*)<\/b>/g, "**$1**");
|
|
156444
|
+
processed = processed.replace(/<em>([^<]*)<\/em>/g, "*$1*");
|
|
156445
|
+
processed = processed.replace(/<i>([^<]*)<\/i>/g, "*$1*");
|
|
156446
|
+
for (let i = 1; i <= 6; i++) {
|
|
156447
|
+
const tag = `h${i}`;
|
|
156448
|
+
const prefix = "#".repeat(i);
|
|
156449
|
+
processed = processed.replace(new RegExp(`<${tag}>([^<]*)</${tag}>`, "g"), `${prefix} $1`);
|
|
156450
|
+
}
|
|
156451
|
+
processed = processed.replace(/<li>([^<]*)<\/li>/g, "- $1\n");
|
|
156452
|
+
processed = processed.replace(/<ul[^>]*>/g, "\n");
|
|
156453
|
+
processed = processed.replace(/<\/ul>/g, "\n");
|
|
156454
|
+
processed = processed.replace(/<ol[^>]*>/g, "\n");
|
|
156455
|
+
processed = processed.replace(/<\/ol>/g, "\n");
|
|
156456
|
+
processed = processed.replace(/<a[^>]+href="([^"]*)"[^>]*>([^<]*)<\/a>/g, "[$2]($1)");
|
|
156457
|
+
processed = processed.replace(/<[^>]+>/g, "");
|
|
156458
|
+
processed = processed.replace(/\n{3,}/g, "\n\n");
|
|
156459
|
+
return processed.trim();
|
|
156460
|
+
}
|
|
156461
|
+
async execute(params, signal) {
|
|
156462
|
+
const validationError = this.validateParams(params);
|
|
156463
|
+
if (validationError) {
|
|
156464
|
+
return {
|
|
156465
|
+
llmContent: `Error: Invalid parameters provided. Reason: ${validationError}`,
|
|
156466
|
+
returnDisplay: validationError
|
|
156467
|
+
};
|
|
156468
|
+
}
|
|
156469
|
+
const { page_id, convert_to_markdown = true } = params;
|
|
156470
|
+
const personal_access_token = this.config.getConfluenceToken();
|
|
156471
|
+
if (!personal_access_token) {
|
|
156472
|
+
return {
|
|
156473
|
+
llmContent: "Error: Confluence Personal Access Token not found in keys.json. Please configure it first.",
|
|
156474
|
+
returnDisplay: "Confluence token not configured"
|
|
156475
|
+
};
|
|
156476
|
+
}
|
|
156477
|
+
try {
|
|
156478
|
+
const isCloud = CONFLUENCE_URL.includes(".atlassian.net");
|
|
156479
|
+
const apiUrl = `${CONFLUENCE_URL.replace(/\/$/, "")}/rest/api/content/${page_id}`;
|
|
156480
|
+
const paramsObj = new URLSearchParams({
|
|
156481
|
+
expand: "body.storage,version,space,children.attachment,ancestors"
|
|
156482
|
+
});
|
|
156483
|
+
const fullUrl = `${apiUrl}?${paramsObj.toString()}`;
|
|
156484
|
+
const headers = {
|
|
156485
|
+
"Accept": "application/json",
|
|
156486
|
+
"Content-Type": "application/json",
|
|
156487
|
+
"Authorization": `Bearer ${personal_access_token}`
|
|
156488
|
+
};
|
|
156489
|
+
const controller = new AbortController();
|
|
156490
|
+
const timeoutId = setTimeout(() => controller.abort(), CONFLUENCE_FETCH_TIMEOUT_MS);
|
|
156491
|
+
let response;
|
|
156492
|
+
try {
|
|
156493
|
+
response = await fetch(fullUrl, {
|
|
156494
|
+
method: "GET",
|
|
156495
|
+
headers,
|
|
156496
|
+
signal: signal || controller.signal
|
|
156497
|
+
});
|
|
156498
|
+
} finally {
|
|
156499
|
+
clearTimeout(timeoutId);
|
|
156500
|
+
}
|
|
156501
|
+
if (response.status === 401) {
|
|
156502
|
+
return {
|
|
156503
|
+
llmContent: "Error: Authentication failed (401). Personal Access Token may be invalid or expired.",
|
|
156504
|
+
returnDisplay: "Authentication failed (401)"
|
|
156505
|
+
};
|
|
156506
|
+
}
|
|
156507
|
+
if (response.status === 403) {
|
|
156508
|
+
return {
|
|
156509
|
+
llmContent: "Error: Access denied (403). Token may not have sufficient permissions.",
|
|
156510
|
+
returnDisplay: "Access denied (403)"
|
|
156511
|
+
};
|
|
156512
|
+
}
|
|
156513
|
+
if (response.status === 404) {
|
|
156514
|
+
return {
|
|
156515
|
+
llmContent: `Error: Page not found (404). Page ID ${page_id} may not exist.`,
|
|
156516
|
+
returnDisplay: `Page not found (404): ${page_id}`
|
|
156517
|
+
};
|
|
156518
|
+
}
|
|
156519
|
+
if (!response.ok) {
|
|
156520
|
+
const errorText = await response.text().catch(() => "Unknown error");
|
|
156521
|
+
return {
|
|
156522
|
+
llmContent: `Error: API call failed with status ${response.status}: ${errorText}`,
|
|
156523
|
+
returnDisplay: `API error (${response.status})`
|
|
156524
|
+
};
|
|
156525
|
+
}
|
|
156526
|
+
const pageData = await response.json();
|
|
156527
|
+
const content = pageData.body.storage.value;
|
|
156528
|
+
const spaceKey = pageData.space.key;
|
|
156529
|
+
const title = pageData.title;
|
|
156530
|
+
const version2 = pageData.version.number;
|
|
156531
|
+
const created = pageData.created;
|
|
156532
|
+
const updated = pageData.updated;
|
|
156533
|
+
let pageUrl;
|
|
156534
|
+
if (isCloud) {
|
|
156535
|
+
pageUrl = `${CONFLUENCE_URL}/spaces/${spaceKey}/pages/${pageData.id}`;
|
|
156536
|
+
} else {
|
|
156537
|
+
pageUrl = `${CONFLUENCE_URL}/pages/viewpage.action?pageId=${pageData.id}`;
|
|
156538
|
+
}
|
|
156539
|
+
let processedContent;
|
|
156540
|
+
let contentFormat;
|
|
156541
|
+
if (convert_to_markdown) {
|
|
156542
|
+
processedContent = this.processHtmlContent(content, spaceKey, CONFLUENCE_URL);
|
|
156543
|
+
contentFormat = "markdown";
|
|
156544
|
+
} else {
|
|
156545
|
+
processedContent = content;
|
|
156546
|
+
contentFormat = "storage";
|
|
156547
|
+
}
|
|
156548
|
+
const result = {
|
|
156549
|
+
id: pageData.id,
|
|
156550
|
+
title,
|
|
156551
|
+
type: pageData.type,
|
|
156552
|
+
status: pageData.status,
|
|
156553
|
+
created,
|
|
156554
|
+
updated,
|
|
156555
|
+
url: pageUrl,
|
|
156556
|
+
space: {
|
|
156557
|
+
key: spaceKey,
|
|
156558
|
+
name: pageData.space.name
|
|
156559
|
+
},
|
|
156560
|
+
version: version2,
|
|
156561
|
+
attachments: pageData.children?.attachment?.results || [],
|
|
156562
|
+
ancestors: pageData.ancestors || [],
|
|
156563
|
+
content: {
|
|
156564
|
+
value: processedContent,
|
|
156565
|
+
format: contentFormat
|
|
156566
|
+
}
|
|
156567
|
+
};
|
|
156568
|
+
const resultText = `# ${title}
|
|
156569
|
+
|
|
156570
|
+
**Page ID:** ${pageData.id}
|
|
156571
|
+
**Space:** ${spaceKey}
|
|
156572
|
+
**Version:** ${version2}
|
|
156573
|
+
**Created:** ${created}
|
|
156574
|
+
**Updated:** ${updated}
|
|
156575
|
+
**URL:** ${pageUrl}
|
|
156576
|
+
|
|
156577
|
+
---
|
|
156578
|
+
|
|
156579
|
+
${processedContent}
|
|
156580
|
+
`;
|
|
156581
|
+
return {
|
|
156582
|
+
llmContent: resultText,
|
|
156583
|
+
returnDisplay: `Retrieved Confluence page: ${title}`
|
|
156584
|
+
};
|
|
156585
|
+
} catch (error) {
|
|
156586
|
+
const errorMessage = `Error retrieving Confluence page ${page_id}: ${getErrorMessage(error)}`;
|
|
156587
|
+
console.error(errorMessage, error);
|
|
156588
|
+
return {
|
|
156589
|
+
llmContent: `Error: ${errorMessage}`,
|
|
156590
|
+
returnDisplay: `Error: ${errorMessage}`
|
|
156591
|
+
};
|
|
156592
|
+
}
|
|
156593
|
+
}
|
|
156594
|
+
};
|
|
156595
|
+
|
|
156596
|
+
// packages/core/dist/src/tools/jira-get-issue.js
|
|
156597
|
+
var import_genai19 = require("@google/genai");
|
|
156598
|
+
init_errors();
|
|
156599
|
+
var JIRA_FETCH_TIMEOUT_MS = 3e4;
|
|
156600
|
+
var JIRA_URL = "https://jira.rakuten-it.com/jira";
|
|
156601
|
+
var JiraGetIssueTool = class _JiraGetIssueTool extends BaseTool {
|
|
156602
|
+
config;
|
|
156603
|
+
static Name = "jira_get_issue";
|
|
156604
|
+
constructor(config2) {
|
|
156605
|
+
super(_JiraGetIssueTool.Name, "JiraGetIssue", "Retrieves content from a Jira issue by its key. Uses Personal Access Token from keys.json for authentication.", {
|
|
156606
|
+
properties: {
|
|
156607
|
+
issue_key: {
|
|
156608
|
+
description: "The Jira issue key to retrieve (e.g., PROJECT-123)",
|
|
156609
|
+
type: import_genai19.Type.STRING
|
|
156610
|
+
},
|
|
156611
|
+
expand: {
|
|
156612
|
+
description: 'Fields to expand in the response (e.g., "renderedFields,changelog")',
|
|
156613
|
+
type: import_genai19.Type.STRING
|
|
156614
|
+
},
|
|
156615
|
+
comment_limit: {
|
|
156616
|
+
description: 'Maximum number of comments to include (default: 10, use "all" for all comments)',
|
|
156617
|
+
type: import_genai19.Type.STRING
|
|
156618
|
+
}
|
|
156619
|
+
},
|
|
156620
|
+
required: ["issue_key"],
|
|
156621
|
+
type: import_genai19.Type.OBJECT
|
|
156622
|
+
});
|
|
156623
|
+
this.config = config2;
|
|
156624
|
+
}
|
|
156625
|
+
validateParams(params) {
|
|
156626
|
+
const errors = SchemaValidator.validate(this.schema.parameters, params);
|
|
156627
|
+
if (errors) {
|
|
156628
|
+
return errors;
|
|
156629
|
+
}
|
|
156630
|
+
if (!params.issue_key || params.issue_key.trim() === "") {
|
|
156631
|
+
return "The 'issue_key' parameter cannot be empty.";
|
|
156632
|
+
}
|
|
156633
|
+
const issueKeyPattern = /^[A-Z]+-\d+$/;
|
|
156634
|
+
if (!issueKeyPattern.test(params.issue_key.trim())) {
|
|
156635
|
+
return "The 'issue_key' must be in format PROJECT-123 (e.g., PROJ-456)";
|
|
156636
|
+
}
|
|
156637
|
+
return null;
|
|
156638
|
+
}
|
|
156639
|
+
getDescription(params) {
|
|
156640
|
+
return `Retrieving Jira issue ${params.issue_key} from ${JIRA_URL}`;
|
|
156641
|
+
}
|
|
156642
|
+
/**
|
|
156643
|
+
* Normalize comment limit to a number
|
|
156644
|
+
*/
|
|
156645
|
+
normalizeCommentLimit(commentLimit) {
|
|
156646
|
+
if (commentLimit === void 0) {
|
|
156647
|
+
return 10;
|
|
156648
|
+
}
|
|
156649
|
+
if (typeof commentLimit === "number") {
|
|
156650
|
+
return commentLimit;
|
|
156651
|
+
}
|
|
156652
|
+
if (commentLimit === "all" || commentLimit === "") {
|
|
156653
|
+
return null;
|
|
156654
|
+
}
|
|
156655
|
+
try {
|
|
156656
|
+
return parseInt(commentLimit, 10);
|
|
156657
|
+
} catch {
|
|
156658
|
+
return 10;
|
|
156659
|
+
}
|
|
156660
|
+
}
|
|
156661
|
+
/**
|
|
156662
|
+
* Convert Jira formatted text to plain text
|
|
156663
|
+
*/
|
|
156664
|
+
convertJiraTextToPlainText(content) {
|
|
156665
|
+
if (typeof content === "string") {
|
|
156666
|
+
return content;
|
|
156667
|
+
}
|
|
156668
|
+
if (typeof content === "object" && content !== null) {
|
|
156669
|
+
const obj = content;
|
|
156670
|
+
if (Array.isArray(obj.content)) {
|
|
156671
|
+
return this.extractTextFromContent(obj.content);
|
|
156672
|
+
}
|
|
156673
|
+
}
|
|
156674
|
+
return "";
|
|
156675
|
+
}
|
|
156676
|
+
/**
|
|
156677
|
+
* Extract text from Jira content structure
|
|
156678
|
+
*/
|
|
156679
|
+
extractTextFromContent(content) {
|
|
156680
|
+
let text = "";
|
|
156681
|
+
for (const item of content) {
|
|
156682
|
+
if (typeof item === "object" && item !== null) {
|
|
156683
|
+
const obj = item;
|
|
156684
|
+
if (obj.text) {
|
|
156685
|
+
text += obj.text;
|
|
156686
|
+
}
|
|
156687
|
+
if (obj.content && Array.isArray(obj.content)) {
|
|
156688
|
+
text += this.extractTextFromContent(obj.content);
|
|
156689
|
+
}
|
|
156690
|
+
}
|
|
156691
|
+
}
|
|
156692
|
+
return text;
|
|
156693
|
+
}
|
|
156694
|
+
/**
|
|
156695
|
+
* Format date string
|
|
156696
|
+
*/
|
|
156697
|
+
formatDate(dateStr) {
|
|
156698
|
+
if (!dateStr) {
|
|
156699
|
+
return "";
|
|
156700
|
+
}
|
|
156701
|
+
try {
|
|
156702
|
+
const date = new Date(dateStr);
|
|
156703
|
+
return date.toLocaleString();
|
|
156704
|
+
} catch {
|
|
156705
|
+
return dateStr;
|
|
156706
|
+
}
|
|
156707
|
+
}
|
|
156708
|
+
async execute(params, signal) {
|
|
156709
|
+
const validationError = this.validateParams(params);
|
|
156710
|
+
if (validationError) {
|
|
156711
|
+
return {
|
|
156712
|
+
llmContent: `Error: Invalid parameters provided. Reason: ${validationError}`,
|
|
156713
|
+
returnDisplay: validationError
|
|
156714
|
+
};
|
|
156715
|
+
}
|
|
156716
|
+
const { issue_key, expand: expand2, comment_limit } = params;
|
|
156717
|
+
const personal_access_token = this.config.getJiraToken();
|
|
156718
|
+
if (!personal_access_token) {
|
|
156719
|
+
return {
|
|
156720
|
+
llmContent: "Error: Jira Personal Access Token not found in keys.json. Please configure it first.",
|
|
156721
|
+
returnDisplay: "Jira token not configured"
|
|
156722
|
+
};
|
|
156723
|
+
}
|
|
156724
|
+
try {
|
|
156725
|
+
const apiUrl = `${JIRA_URL}/rest/api/2/issue/${issue_key}`;
|
|
156726
|
+
const queryParams = new URLSearchParams();
|
|
156727
|
+
const expandParams = expand2 ? expand2.split(",").map((s2) => s2.trim()) : [];
|
|
156728
|
+
if (!expandParams.includes("renderedFields")) {
|
|
156729
|
+
expandParams.push("renderedFields");
|
|
156730
|
+
}
|
|
156731
|
+
if (expandParams.length > 0) {
|
|
156732
|
+
queryParams.set("expand", expandParams.join(","));
|
|
156733
|
+
}
|
|
156734
|
+
const fullUrl = `${apiUrl}?${queryParams.toString()}`;
|
|
156735
|
+
const headers = {
|
|
156736
|
+
"Accept": "application/json",
|
|
156737
|
+
"Content-Type": "application/json",
|
|
156738
|
+
"Authorization": `Bearer ${personal_access_token}`
|
|
156739
|
+
};
|
|
156740
|
+
console.log("Jira API request:", {
|
|
156741
|
+
url: fullUrl,
|
|
156742
|
+
authMethod: "Bearer",
|
|
156743
|
+
tokenLength: personal_access_token.length,
|
|
156744
|
+
headers: { ...headers, Authorization: "Bearer ***" }
|
|
156745
|
+
});
|
|
156746
|
+
const controller = new AbortController();
|
|
156747
|
+
const timeoutId = setTimeout(() => controller.abort(), JIRA_FETCH_TIMEOUT_MS);
|
|
156748
|
+
let response;
|
|
156749
|
+
try {
|
|
156750
|
+
response = await fetch(fullUrl, {
|
|
156751
|
+
method: "GET",
|
|
156752
|
+
headers,
|
|
156753
|
+
signal: signal || controller.signal
|
|
156754
|
+
});
|
|
156755
|
+
} finally {
|
|
156756
|
+
clearTimeout(timeoutId);
|
|
156757
|
+
}
|
|
156758
|
+
if (response.status === 401) {
|
|
156759
|
+
return {
|
|
156760
|
+
llmContent: "Error: Authentication failed (401). Personal Access Token may be invalid or expired.",
|
|
156761
|
+
returnDisplay: "Authentication failed (401)"
|
|
156762
|
+
};
|
|
156763
|
+
}
|
|
156764
|
+
if (response.status === 403) {
|
|
156765
|
+
return {
|
|
156766
|
+
llmContent: "Error: Access denied (403). Token may not have sufficient permissions.",
|
|
156767
|
+
returnDisplay: "Access denied (403)"
|
|
156768
|
+
};
|
|
156769
|
+
}
|
|
156770
|
+
if (response.status === 404) {
|
|
156771
|
+
return {
|
|
156772
|
+
llmContent: `Error: Issue not found (404). Issue key ${issue_key} may not exist.`,
|
|
156773
|
+
returnDisplay: `Issue not found (404): ${issue_key}`
|
|
156774
|
+
};
|
|
156775
|
+
}
|
|
156776
|
+
if (!response.ok) {
|
|
156777
|
+
const errorText = await response.text().catch(() => "Unknown error");
|
|
156778
|
+
console.error(`Jira API error (${response.status}):`, errorText.substring(0, 500));
|
|
156779
|
+
return {
|
|
156780
|
+
llmContent: `Error: API call failed with status ${response.status}: ${errorText.substring(0, 200)}`,
|
|
156781
|
+
returnDisplay: `API error (${response.status})`
|
|
156782
|
+
};
|
|
156783
|
+
}
|
|
156784
|
+
const contentType = response.headers.get("content-type") || "";
|
|
156785
|
+
if (!contentType.includes("application/json")) {
|
|
156786
|
+
const responseText = await response.text();
|
|
156787
|
+
console.error("Jira API returned non-JSON response:", responseText.substring(0, 500));
|
|
156788
|
+
return {
|
|
156789
|
+
llmContent: "Error: Jira API returned non-JSON response. This usually means authentication failed. Please check your Personal Access Token in keys.json.",
|
|
156790
|
+
returnDisplay: "Authentication failed - invalid response format"
|
|
156791
|
+
};
|
|
156792
|
+
}
|
|
156793
|
+
const issueData = await response.json();
|
|
156794
|
+
const fields = issueData.fields || {};
|
|
156795
|
+
const summary = fields.summary || "";
|
|
156796
|
+
const status = fields.status?.name || "Unknown";
|
|
156797
|
+
const issueType = fields.issuetype?.name || "Unknown";
|
|
156798
|
+
const created = this.formatDate(fields.created);
|
|
156799
|
+
const updated = this.formatDate(fields.updated);
|
|
156800
|
+
const assignee = fields.assignee?.displayName || fields.assignee?.name || "Unassigned";
|
|
156801
|
+
const reporter = fields.reporter?.displayName || fields.reporter?.name || "Unknown";
|
|
156802
|
+
const description = this.convertJiraTextToPlainText(fields.description);
|
|
156803
|
+
const comments = fields.comment?.comments || [];
|
|
156804
|
+
const normalizedCommentLimit = this.normalizeCommentLimit(comment_limit);
|
|
156805
|
+
const limitedComments = normalizedCommentLimit !== null ? comments.slice(0, normalizedCommentLimit) : comments;
|
|
156806
|
+
const issueUrl = `${JIRA_URL}/browse/${issue_key}`;
|
|
156807
|
+
let resultText = `# ${issue_key}: ${summary}
|
|
156808
|
+
|
|
156809
|
+
`;
|
|
156810
|
+
resultText += `**Type**: ${issueType}
|
|
156811
|
+
`;
|
|
156812
|
+
resultText += `**Status**: ${status}
|
|
156813
|
+
`;
|
|
156814
|
+
resultText += `**Reporter**: ${reporter}
|
|
156815
|
+
`;
|
|
156816
|
+
resultText += `**Assignee**: ${assignee}
|
|
156817
|
+
`;
|
|
156818
|
+
resultText += `**Created**: ${created}
|
|
156819
|
+
`;
|
|
156820
|
+
resultText += `**Updated**: ${updated}
|
|
156821
|
+
`;
|
|
156822
|
+
resultText += `**URL**: ${issueUrl}
|
|
156823
|
+
|
|
156824
|
+
`;
|
|
156825
|
+
if (description) {
|
|
156826
|
+
resultText += `## Description
|
|
156827
|
+
|
|
156828
|
+
${description}
|
|
156829
|
+
|
|
156830
|
+
`;
|
|
156831
|
+
}
|
|
156832
|
+
if (limitedComments.length > 0) {
|
|
156833
|
+
resultText += `## Comments (${limitedComments.length}${normalizedCommentLimit !== null ? ` of ${comments.length}` : ""})
|
|
156834
|
+
|
|
156835
|
+
`;
|
|
156836
|
+
for (const comment of limitedComments) {
|
|
156837
|
+
const commentAuthor = comment.author?.displayName || comment.author?.name || "Unknown";
|
|
156838
|
+
const commentBody = this.convertJiraTextToPlainText(comment.body);
|
|
156839
|
+
const commentCreated = this.formatDate(comment.created);
|
|
156840
|
+
if (commentBody) {
|
|
156841
|
+
resultText += `**${commentAuthor}** (${commentCreated}):
|
|
156842
|
+
${commentBody}
|
|
156843
|
+
|
|
156844
|
+
`;
|
|
156845
|
+
}
|
|
156846
|
+
}
|
|
156847
|
+
}
|
|
156848
|
+
return {
|
|
156849
|
+
llmContent: resultText,
|
|
156850
|
+
returnDisplay: `Retrieved Jira issue: ${issue_key}`
|
|
156851
|
+
};
|
|
156852
|
+
} catch (error) {
|
|
156853
|
+
const errorMessage = `Error retrieving Jira issue ${issue_key}: ${getErrorMessage(error)}`;
|
|
156854
|
+
console.error(errorMessage, error);
|
|
156855
|
+
return {
|
|
156856
|
+
llmContent: `Error: ${errorMessage}`,
|
|
156857
|
+
returnDisplay: `Error: ${errorMessage}`
|
|
156858
|
+
};
|
|
156859
|
+
}
|
|
156860
|
+
}
|
|
156861
|
+
};
|
|
156862
|
+
|
|
156863
|
+
// packages/core/dist/src/tools/bitbucket-get-pr-diff.js
|
|
156864
|
+
var import_genai20 = require("@google/genai");
|
|
156865
|
+
init_errors();
|
|
156866
|
+
var BITBUCKET_FETCH_TIMEOUT_MS = 3e4;
|
|
156867
|
+
var BITBUCKET_URL = "https://git.rakuten-it.com";
|
|
156868
|
+
var BitbucketGetPrDiffTool = class _BitbucketGetPrDiffTool extends BaseTool {
|
|
156869
|
+
config;
|
|
156870
|
+
static Name = "bitbucket_get_pr_diff";
|
|
156871
|
+
constructor(config2) {
|
|
156872
|
+
super(_BitbucketGetPrDiffTool.Name, "BitbucketGetPrDiff", "Retrieves the diff content for a specified Bitbucket Pull Request. Uses Personal Access Token from keys.json for authentication.", {
|
|
156873
|
+
properties: {
|
|
156874
|
+
project_key: {
|
|
156875
|
+
description: "The unique identifier for the Bitbucket project that owns the PR",
|
|
156876
|
+
type: import_genai20.Type.STRING
|
|
156877
|
+
},
|
|
156878
|
+
repo_slug: {
|
|
156879
|
+
description: "The repository slug name that owns the PR",
|
|
156880
|
+
type: import_genai20.Type.STRING
|
|
156881
|
+
},
|
|
156882
|
+
pr_id: {
|
|
156883
|
+
description: "The Pull Request unique identifier",
|
|
156884
|
+
type: import_genai20.Type.NUMBER
|
|
156885
|
+
}
|
|
156886
|
+
},
|
|
156887
|
+
required: ["project_key", "repo_slug", "pr_id"],
|
|
156888
|
+
type: import_genai20.Type.OBJECT
|
|
156889
|
+
});
|
|
156890
|
+
this.config = config2;
|
|
156891
|
+
}
|
|
156892
|
+
validateParams(params) {
|
|
156893
|
+
const errors = SchemaValidator.validate(this.schema.parameters, params);
|
|
156894
|
+
if (errors) {
|
|
156895
|
+
return errors;
|
|
156896
|
+
}
|
|
156897
|
+
if (!params.project_key || params.project_key.trim() === "") {
|
|
156898
|
+
return "The 'project_key' parameter cannot be empty.";
|
|
156899
|
+
}
|
|
156900
|
+
if (!params.repo_slug || params.repo_slug.trim() === "") {
|
|
156901
|
+
return "The 'repo_slug' parameter cannot be empty.";
|
|
156902
|
+
}
|
|
156903
|
+
if (params.pr_id <= 0) {
|
|
156904
|
+
return "The 'pr_id' must be a positive number.";
|
|
156905
|
+
}
|
|
156906
|
+
return null;
|
|
156907
|
+
}
|
|
156908
|
+
getDescription(params) {
|
|
156909
|
+
return `Retrieving diff for Bitbucket PR #${params.pr_id} in ${params.project_key}/${params.repo_slug}`;
|
|
156910
|
+
}
|
|
156911
|
+
async execute(params, signal) {
|
|
156912
|
+
const validationError = this.validateParams(params);
|
|
156913
|
+
if (validationError) {
|
|
156914
|
+
return {
|
|
156915
|
+
llmContent: `Error: Invalid parameters provided. Reason: ${validationError}`,
|
|
156916
|
+
returnDisplay: validationError
|
|
156917
|
+
};
|
|
156918
|
+
}
|
|
156919
|
+
const { project_key, repo_slug, pr_id } = params;
|
|
156920
|
+
const personal_access_token = this.config.getBitbucketToken();
|
|
156921
|
+
if (!personal_access_token) {
|
|
156922
|
+
return {
|
|
156923
|
+
llmContent: "Error: Bitbucket Personal Access Token not found in keys.json. Please configure it first.",
|
|
156924
|
+
returnDisplay: "Bitbucket token not configured"
|
|
156925
|
+
};
|
|
156926
|
+
}
|
|
156927
|
+
try {
|
|
156928
|
+
const apiUrl = `${BITBUCKET_URL}/rest/api/1.0/projects/${project_key}/repos/${repo_slug}/pull-requests/${pr_id}/diff`;
|
|
156929
|
+
const headers = {
|
|
156930
|
+
"Authorization": `Bearer ${personal_access_token}`,
|
|
156931
|
+
"Accept": "text/plain"
|
|
156932
|
+
};
|
|
156933
|
+
console.log("Bitbucket API request:", {
|
|
156934
|
+
url: apiUrl,
|
|
156935
|
+
authMethod: "Bearer",
|
|
156936
|
+
tokenLength: personal_access_token.length,
|
|
156937
|
+
headers: { ...headers, Authorization: "Bearer ***" }
|
|
156938
|
+
});
|
|
156939
|
+
const controller = new AbortController();
|
|
156940
|
+
const timeoutId = setTimeout(() => controller.abort(), BITBUCKET_FETCH_TIMEOUT_MS);
|
|
156941
|
+
let response;
|
|
156942
|
+
try {
|
|
156943
|
+
response = await fetch(apiUrl, {
|
|
156944
|
+
method: "GET",
|
|
156945
|
+
headers,
|
|
156946
|
+
signal: signal || controller.signal
|
|
156947
|
+
});
|
|
156948
|
+
} finally {
|
|
156949
|
+
clearTimeout(timeoutId);
|
|
156950
|
+
}
|
|
156951
|
+
if (response.status === 401) {
|
|
156952
|
+
return {
|
|
156953
|
+
llmContent: "Error: Authentication failed (401). Personal Access Token may be invalid or expired.",
|
|
156954
|
+
returnDisplay: "Authentication failed (401)"
|
|
156955
|
+
};
|
|
156956
|
+
}
|
|
156957
|
+
if (response.status === 403) {
|
|
156958
|
+
return {
|
|
156959
|
+
llmContent: "Error: Access denied (403). Token may not have sufficient permissions.",
|
|
156960
|
+
returnDisplay: "Access denied (403)"
|
|
156961
|
+
};
|
|
156962
|
+
}
|
|
156963
|
+
if (response.status === 404) {
|
|
156964
|
+
return {
|
|
156965
|
+
llmContent: `Error: Pull Request not found (404). PR #${pr_id} in ${project_key}/${repo_slug} may not exist.`,
|
|
156966
|
+
returnDisplay: `PR not found (404): #${pr_id}`
|
|
156967
|
+
};
|
|
156968
|
+
}
|
|
156969
|
+
if (!response.ok) {
|
|
156970
|
+
const errorText = await response.text().catch(() => "Unknown error");
|
|
156971
|
+
console.error(`Bitbucket API error (${response.status}):`, errorText.substring(0, 500));
|
|
156972
|
+
return {
|
|
156973
|
+
llmContent: `Error: API call failed with status ${response.status}: ${errorText.substring(0, 200)}`,
|
|
156974
|
+
returnDisplay: `API error (${response.status})`
|
|
156975
|
+
};
|
|
156976
|
+
}
|
|
156977
|
+
const diffText = await response.text();
|
|
156978
|
+
let resultText = `# Pull Request Diff: ${project_key}/${repo_slug}#${pr_id}
|
|
156979
|
+
|
|
156980
|
+
`;
|
|
156981
|
+
resultText += `\`\`\`diff
|
|
156982
|
+
${diffText}
|
|
156983
|
+
\`\`\``;
|
|
156984
|
+
return {
|
|
156985
|
+
llmContent: resultText,
|
|
156986
|
+
returnDisplay: `Retrieved diff for Bitbucket PR #${pr_id}`
|
|
156987
|
+
};
|
|
156988
|
+
} catch (error) {
|
|
156989
|
+
const errorMessage = `Error retrieving Bitbucket PR diff ${project_key}/${repo_slug}#${pr_id}: ${getErrorMessage(error)}`;
|
|
156990
|
+
console.error(errorMessage, error);
|
|
156991
|
+
return {
|
|
156992
|
+
llmContent: `Error: ${errorMessage}`,
|
|
156993
|
+
returnDisplay: `Error: ${errorMessage}`
|
|
156994
|
+
};
|
|
156995
|
+
}
|
|
156996
|
+
}
|
|
156997
|
+
};
|
|
156998
|
+
|
|
156999
|
+
// packages/core/dist/src/tools/bitbucket-add-pr-comment.js
|
|
157000
|
+
var import_genai21 = require("@google/genai");
|
|
157001
|
+
init_errors();
|
|
157002
|
+
var BITBUCKET_FETCH_TIMEOUT_MS2 = 3e4;
|
|
157003
|
+
var BITBUCKET_URL2 = "https://git.rakuten-it.com";
|
|
157004
|
+
var BitbucketAddPrCommentTool = class _BitbucketAddPrCommentTool extends BaseTool {
|
|
157005
|
+
config;
|
|
157006
|
+
static Name = "bitbucket_add_pr_comment";
|
|
157007
|
+
constructor(config2) {
|
|
157008
|
+
super(_BitbucketAddPrCommentTool.Name, "BitbucketAddPrComment", "Adds a general comment to a specified Bitbucket Pull Request. Uses Personal Access Token from keys.json for authentication.", {
|
|
157009
|
+
properties: {
|
|
157010
|
+
project_key: {
|
|
157011
|
+
description: "The unique identifier for the Bitbucket project that owns the PR",
|
|
157012
|
+
type: import_genai21.Type.STRING
|
|
157013
|
+
},
|
|
157014
|
+
repo_slug: {
|
|
157015
|
+
description: "The repository slug name that owns the PR",
|
|
157016
|
+
type: import_genai21.Type.STRING
|
|
157017
|
+
},
|
|
157018
|
+
pr_id: {
|
|
157019
|
+
description: "The Pull Request unique identifier",
|
|
157020
|
+
type: import_genai21.Type.NUMBER
|
|
157021
|
+
},
|
|
157022
|
+
comment_text: {
|
|
157023
|
+
description: "The text content of the comment to add",
|
|
157024
|
+
type: import_genai21.Type.STRING
|
|
157025
|
+
}
|
|
157026
|
+
},
|
|
157027
|
+
required: ["project_key", "repo_slug", "pr_id", "comment_text"],
|
|
157028
|
+
type: import_genai21.Type.OBJECT
|
|
157029
|
+
});
|
|
157030
|
+
this.config = config2;
|
|
157031
|
+
}
|
|
157032
|
+
validateParams(params) {
|
|
157033
|
+
const errors = SchemaValidator.validate(this.schema.parameters, params);
|
|
157034
|
+
if (errors) {
|
|
157035
|
+
return errors;
|
|
157036
|
+
}
|
|
157037
|
+
if (!params.project_key || params.project_key.trim() === "") {
|
|
157038
|
+
return "The 'project_key' parameter cannot be empty.";
|
|
157039
|
+
}
|
|
157040
|
+
if (!params.repo_slug || params.repo_slug.trim() === "") {
|
|
157041
|
+
return "The 'repo_slug' parameter cannot be empty.";
|
|
157042
|
+
}
|
|
157043
|
+
if (params.pr_id <= 0) {
|
|
157044
|
+
return "The 'pr_id' must be a positive number.";
|
|
157045
|
+
}
|
|
157046
|
+
if (!params.comment_text || params.comment_text.trim() === "") {
|
|
157047
|
+
return "The 'comment_text' parameter cannot be empty.";
|
|
157048
|
+
}
|
|
157049
|
+
return null;
|
|
157050
|
+
}
|
|
157051
|
+
getDescription(params) {
|
|
157052
|
+
return `Adding comment to Bitbucket PR #${params.pr_id} in ${params.project_key}/${params.repo_slug}`;
|
|
157053
|
+
}
|
|
157054
|
+
async execute(params, signal) {
|
|
157055
|
+
const validationError = this.validateParams(params);
|
|
157056
|
+
if (validationError) {
|
|
157057
|
+
return {
|
|
157058
|
+
llmContent: `Error: Invalid parameters provided. Reason: ${validationError}`,
|
|
157059
|
+
returnDisplay: validationError
|
|
157060
|
+
};
|
|
157061
|
+
}
|
|
157062
|
+
const { project_key, repo_slug, pr_id, comment_text } = params;
|
|
157063
|
+
const personal_access_token = this.config.getBitbucketToken();
|
|
157064
|
+
if (!personal_access_token) {
|
|
157065
|
+
return {
|
|
157066
|
+
llmContent: "Error: Bitbucket Personal Access Token not found in keys.json. Please configure it first.",
|
|
157067
|
+
returnDisplay: "Bitbucket token not configured"
|
|
157068
|
+
};
|
|
157069
|
+
}
|
|
157070
|
+
try {
|
|
157071
|
+
const apiUrl = `${BITBUCKET_URL2}/rest/api/latest/projects/${project_key}/repos/${repo_slug}/pull-requests/${pr_id}/comments`;
|
|
157072
|
+
const headers = {
|
|
157073
|
+
"Authorization": `Bearer ${personal_access_token}`,
|
|
157074
|
+
"Content-Type": "application/json"
|
|
157075
|
+
};
|
|
157076
|
+
const payload = {
|
|
157077
|
+
text: comment_text
|
|
157078
|
+
};
|
|
157079
|
+
console.log("Bitbucket API request:", {
|
|
157080
|
+
url: apiUrl,
|
|
157081
|
+
method: "POST",
|
|
157082
|
+
authMethod: "Bearer",
|
|
157083
|
+
tokenLength: personal_access_token.length,
|
|
157084
|
+
headers: { ...headers, Authorization: "Bearer ***" }
|
|
157085
|
+
});
|
|
157086
|
+
const controller = new AbortController();
|
|
157087
|
+
const timeoutId = setTimeout(() => controller.abort(), BITBUCKET_FETCH_TIMEOUT_MS2);
|
|
157088
|
+
let response;
|
|
157089
|
+
try {
|
|
157090
|
+
response = await fetch(apiUrl, {
|
|
157091
|
+
method: "POST",
|
|
157092
|
+
headers,
|
|
157093
|
+
body: JSON.stringify(payload),
|
|
157094
|
+
signal: signal || controller.signal
|
|
157095
|
+
});
|
|
157096
|
+
} finally {
|
|
157097
|
+
clearTimeout(timeoutId);
|
|
157098
|
+
}
|
|
157099
|
+
if (response.status === 401) {
|
|
157100
|
+
return {
|
|
157101
|
+
llmContent: "Error: Authentication failed (401). Personal Access Token may be invalid or expired.",
|
|
157102
|
+
returnDisplay: "Authentication failed (401)"
|
|
157103
|
+
};
|
|
157104
|
+
}
|
|
157105
|
+
if (response.status === 403) {
|
|
157106
|
+
return {
|
|
157107
|
+
llmContent: "Error: Access denied (403). Token may not have sufficient permissions.",
|
|
157108
|
+
returnDisplay: "Access denied (403)"
|
|
157109
|
+
};
|
|
157110
|
+
}
|
|
157111
|
+
if (response.status === 404) {
|
|
157112
|
+
return {
|
|
157113
|
+
llmContent: `Error: Pull Request not found (404). PR #${pr_id} in ${project_key}/${repo_slug} may not exist.`,
|
|
157114
|
+
returnDisplay: `PR not found (404): #${pr_id}`
|
|
157115
|
+
};
|
|
157116
|
+
}
|
|
157117
|
+
if (!response.ok) {
|
|
157118
|
+
const errorText = await response.text().catch(() => "Unknown error");
|
|
157119
|
+
console.error(`Bitbucket API error (${response.status}):`, errorText.substring(0, 500));
|
|
157120
|
+
return {
|
|
157121
|
+
llmContent: `Error: API call failed with status ${response.status}: ${errorText.substring(0, 200)}`,
|
|
157122
|
+
returnDisplay: `API error (${response.status})`
|
|
157123
|
+
};
|
|
157124
|
+
}
|
|
157125
|
+
const responseData = await response.json();
|
|
157126
|
+
let resultText = `# Comment added to Pull Request: ${project_key}/${repo_slug}#${pr_id}
|
|
157127
|
+
|
|
157128
|
+
`;
|
|
157129
|
+
resultText += `**Comment ID**: ${responseData.id || "Unknown"}
|
|
157130
|
+
`;
|
|
157131
|
+
resultText += `**Text**: ${comment_text}
|
|
157132
|
+
`;
|
|
157133
|
+
return {
|
|
157134
|
+
llmContent: resultText,
|
|
157135
|
+
returnDisplay: `Added comment to Bitbucket PR #${pr_id}`
|
|
157136
|
+
};
|
|
157137
|
+
} catch (error) {
|
|
157138
|
+
const errorMessage = `Error adding comment to Bitbucket PR ${project_key}/${repo_slug}#${pr_id}: ${getErrorMessage(error)}`;
|
|
157139
|
+
console.error(errorMessage, error);
|
|
157140
|
+
return {
|
|
157141
|
+
llmContent: `Error: ${errorMessage}`,
|
|
157142
|
+
returnDisplay: `Error: ${errorMessage}`
|
|
157143
|
+
};
|
|
157144
|
+
}
|
|
157145
|
+
}
|
|
157146
|
+
};
|
|
157147
|
+
|
|
157148
|
+
// packages/core/dist/src/tools/bitbucket-add-pr-inline-comment.js
|
|
157149
|
+
var import_genai22 = require("@google/genai");
|
|
157150
|
+
init_errors();
|
|
157151
|
+
var BITBUCKET_FETCH_TIMEOUT_MS3 = 3e4;
|
|
157152
|
+
var BITBUCKET_URL3 = "https://git.rakuten-it.com";
|
|
157153
|
+
var BitbucketAddPrInlineCommentTool = class _BitbucketAddPrInlineCommentTool extends BaseTool {
|
|
157154
|
+
config;
|
|
157155
|
+
static Name = "bitbucket_add_pr_inline_comment";
|
|
157156
|
+
constructor(config2) {
|
|
157157
|
+
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.", {
|
|
157158
|
+
properties: {
|
|
157159
|
+
project_key: {
|
|
157160
|
+
description: "The unique identifier for the Bitbucket project that owns the PR",
|
|
157161
|
+
type: import_genai22.Type.STRING
|
|
157162
|
+
},
|
|
157163
|
+
repo_slug: {
|
|
157164
|
+
description: "The repository slug name that owns the PR",
|
|
157165
|
+
type: import_genai22.Type.STRING
|
|
157166
|
+
},
|
|
157167
|
+
pr_id: {
|
|
157168
|
+
description: "The Pull Request unique identifier",
|
|
157169
|
+
type: import_genai22.Type.NUMBER
|
|
157170
|
+
},
|
|
157171
|
+
file_path: {
|
|
157172
|
+
description: "The file path relative to repository root to add comment to",
|
|
157173
|
+
type: import_genai22.Type.STRING
|
|
157174
|
+
},
|
|
157175
|
+
line: {
|
|
157176
|
+
description: "The line number to add comment to",
|
|
157177
|
+
type: import_genai22.Type.NUMBER
|
|
157178
|
+
},
|
|
157179
|
+
comment_text: {
|
|
157180
|
+
description: "The text content of the inline comment to add",
|
|
157181
|
+
type: import_genai22.Type.STRING
|
|
157182
|
+
},
|
|
157183
|
+
line_type: {
|
|
157184
|
+
description: "The line type, default is ADDED, optional values: ADDED, REMOVED, CONTEXT",
|
|
157185
|
+
type: import_genai22.Type.STRING
|
|
157186
|
+
},
|
|
157187
|
+
file_type: {
|
|
157188
|
+
description: "The file type, default is TO, optional values: TO, FROM",
|
|
157189
|
+
type: import_genai22.Type.STRING
|
|
157190
|
+
}
|
|
157191
|
+
},
|
|
157192
|
+
required: ["project_key", "repo_slug", "pr_id", "file_path", "line", "comment_text"],
|
|
157193
|
+
type: import_genai22.Type.OBJECT
|
|
157194
|
+
});
|
|
157195
|
+
this.config = config2;
|
|
157196
|
+
}
|
|
157197
|
+
validateParams(params) {
|
|
157198
|
+
const errors = SchemaValidator.validate(this.schema.parameters, params);
|
|
157199
|
+
if (errors) {
|
|
157200
|
+
return errors;
|
|
157201
|
+
}
|
|
157202
|
+
if (!params.project_key || params.project_key.trim() === "") {
|
|
157203
|
+
return "The 'project_key' parameter cannot be empty.";
|
|
157204
|
+
}
|
|
157205
|
+
if (!params.repo_slug || params.repo_slug.trim() === "") {
|
|
157206
|
+
return "The 'repo_slug' parameter cannot be empty.";
|
|
157207
|
+
}
|
|
157208
|
+
if (params.pr_id <= 0) {
|
|
157209
|
+
return "The 'pr_id' must be a positive number.";
|
|
157210
|
+
}
|
|
157211
|
+
if (!params.file_path || params.file_path.trim() === "") {
|
|
157212
|
+
return "The 'file_path' parameter cannot be empty.";
|
|
157213
|
+
}
|
|
157214
|
+
if (params.line <= 0) {
|
|
157215
|
+
return "The 'line' must be a positive number.";
|
|
157216
|
+
}
|
|
157217
|
+
if (!params.comment_text || params.comment_text.trim() === "") {
|
|
157218
|
+
return "The 'comment_text' parameter cannot be empty.";
|
|
157219
|
+
}
|
|
157220
|
+
if (params.line_type && !["ADDED", "REMOVED", "CONTEXT"].includes(params.line_type)) {
|
|
157221
|
+
return "The 'line_type' must be one of: ADDED, REMOVED, CONTEXT";
|
|
157222
|
+
}
|
|
157223
|
+
if (params.file_type && !["TO", "FROM"].includes(params.file_type)) {
|
|
157224
|
+
return "The 'file_type' must be one of: TO, FROM";
|
|
157225
|
+
}
|
|
157226
|
+
return null;
|
|
157227
|
+
}
|
|
157228
|
+
getDescription(params) {
|
|
157229
|
+
return `Adding inline comment to Bitbucket PR #${params.pr_id} in ${params.project_key}/${params.repo_slug} at ${params.file_path}:${params.line}`;
|
|
157230
|
+
}
|
|
157231
|
+
async execute(params, signal) {
|
|
157232
|
+
const validationError = this.validateParams(params);
|
|
157233
|
+
if (validationError) {
|
|
157234
|
+
return {
|
|
157235
|
+
llmContent: `Error: Invalid parameters provided. Reason: ${validationError}`,
|
|
157236
|
+
returnDisplay: validationError
|
|
157237
|
+
};
|
|
157238
|
+
}
|
|
157239
|
+
const { project_key, repo_slug, pr_id, file_path, line, comment_text, line_type, file_type } = params;
|
|
157240
|
+
const personal_access_token = this.config.getBitbucketToken();
|
|
157241
|
+
if (!personal_access_token) {
|
|
157242
|
+
return {
|
|
157243
|
+
llmContent: "Error: Bitbucket Personal Access Token not found in keys.json. Please configure it first.",
|
|
157244
|
+
returnDisplay: "Bitbucket token not configured"
|
|
157245
|
+
};
|
|
157246
|
+
}
|
|
157247
|
+
try {
|
|
157248
|
+
const apiUrl = `${BITBUCKET_URL3}/rest/api/latest/projects/${project_key}/repos/${repo_slug}/pull-requests/${pr_id}/comments`;
|
|
157249
|
+
const headers = {
|
|
157250
|
+
"Authorization": `Bearer ${personal_access_token}`,
|
|
157251
|
+
"Content-Type": "application/json"
|
|
157252
|
+
};
|
|
157253
|
+
const payload = {
|
|
157254
|
+
text: comment_text,
|
|
157255
|
+
anchor: {
|
|
157256
|
+
path: file_path,
|
|
157257
|
+
line,
|
|
157258
|
+
lineType: line_type || "ADDED",
|
|
157259
|
+
fileType: file_type || "TO"
|
|
157260
|
+
}
|
|
157261
|
+
};
|
|
157262
|
+
console.log("Bitbucket API request:", {
|
|
157263
|
+
url: apiUrl,
|
|
157264
|
+
method: "POST",
|
|
157265
|
+
authMethod: "Bearer",
|
|
157266
|
+
tokenLength: personal_access_token.length,
|
|
157267
|
+
headers: { ...headers, Authorization: "Bearer ***" }
|
|
157268
|
+
});
|
|
157269
|
+
const controller = new AbortController();
|
|
157270
|
+
const timeoutId = setTimeout(() => controller.abort(), BITBUCKET_FETCH_TIMEOUT_MS3);
|
|
157271
|
+
let response;
|
|
157272
|
+
try {
|
|
157273
|
+
response = await fetch(apiUrl, {
|
|
157274
|
+
method: "POST",
|
|
157275
|
+
headers,
|
|
157276
|
+
body: JSON.stringify(payload),
|
|
157277
|
+
signal: signal || controller.signal
|
|
157278
|
+
});
|
|
157279
|
+
} finally {
|
|
157280
|
+
clearTimeout(timeoutId);
|
|
157281
|
+
}
|
|
157282
|
+
if (response.status === 401) {
|
|
157283
|
+
return {
|
|
157284
|
+
llmContent: "Error: Authentication failed (401). Personal Access Token may be invalid or expired.",
|
|
157285
|
+
returnDisplay: "Authentication failed (401)"
|
|
157286
|
+
};
|
|
157287
|
+
}
|
|
157288
|
+
if (response.status === 403) {
|
|
157289
|
+
return {
|
|
157290
|
+
llmContent: "Error: Access denied (403). Token may not have sufficient permissions.",
|
|
157291
|
+
returnDisplay: "Access denied (403)"
|
|
157292
|
+
};
|
|
157293
|
+
}
|
|
157294
|
+
if (response.status === 404) {
|
|
157295
|
+
return {
|
|
157296
|
+
llmContent: `Error: Pull Request not found (404). PR #${pr_id} in ${project_key}/${repo_slug} may not exist.`,
|
|
157297
|
+
returnDisplay: `PR not found (404): #${pr_id}`
|
|
157298
|
+
};
|
|
157299
|
+
}
|
|
157300
|
+
if (!response.ok) {
|
|
157301
|
+
const errorText = await response.text().catch(() => "Unknown error");
|
|
157302
|
+
console.error(`Bitbucket API error (${response.status}):`, errorText.substring(0, 500));
|
|
157303
|
+
return {
|
|
157304
|
+
llmContent: `Error: API call failed with status ${response.status}: ${errorText.substring(0, 200)}`,
|
|
157305
|
+
returnDisplay: `API error (${response.status})`
|
|
157306
|
+
};
|
|
157307
|
+
}
|
|
157308
|
+
const responseData = await response.json();
|
|
157309
|
+
let resultText = `# Inline comment added to Pull Request: ${project_key}/${repo_slug}#${pr_id}
|
|
157310
|
+
|
|
157311
|
+
`;
|
|
157312
|
+
resultText += `**File**: ${file_path}
|
|
157313
|
+
`;
|
|
157314
|
+
resultText += `**Line**: ${line}
|
|
157315
|
+
`;
|
|
157316
|
+
resultText += `**Line Type**: ${line_type || "ADDED"}
|
|
157317
|
+
`;
|
|
157318
|
+
resultText += `**File Type**: ${file_type || "TO"}
|
|
157319
|
+
`;
|
|
157320
|
+
resultText += `**Comment ID**: ${responseData.id || "Unknown"}
|
|
157321
|
+
`;
|
|
157322
|
+
resultText += `**Text**: ${comment_text}
|
|
157323
|
+
`;
|
|
157324
|
+
return {
|
|
157325
|
+
llmContent: resultText,
|
|
157326
|
+
returnDisplay: `Added inline comment to Bitbucket PR #${pr_id} at ${file_path}:${line}`
|
|
157327
|
+
};
|
|
157328
|
+
} catch (error) {
|
|
157329
|
+
const errorMessage = `Error adding inline comment to Bitbucket PR ${project_key}/${repo_slug}#${pr_id}: ${getErrorMessage(error)}`;
|
|
157330
|
+
console.error(errorMessage, error);
|
|
157331
|
+
return {
|
|
157332
|
+
llmContent: `Error: ${errorMessage}`,
|
|
157333
|
+
returnDisplay: `Error: ${errorMessage}`
|
|
157334
|
+
};
|
|
157335
|
+
}
|
|
157336
|
+
}
|
|
157337
|
+
};
|
|
157338
|
+
|
|
156391
157339
|
// packages/core/dist/src/utils/getFolderStructure.js
|
|
156392
157340
|
var fs16 = __toESM(require("fs/promises"), 1);
|
|
156393
157341
|
var path17 = __toESM(require("path"), 1);
|
|
@@ -156751,7 +157699,7 @@ var import_node_fs5 = __toESM(require("node:fs"), 1);
|
|
|
156751
157699
|
var import_node_process7 = __toESM(require("node:process"), 1);
|
|
156752
157700
|
function getCoreSystemPrompt(userMemory) {
|
|
156753
157701
|
let systemMdEnabled = false;
|
|
156754
|
-
let systemMdPath = import_node_path6.default.join(
|
|
157702
|
+
let systemMdPath = import_node_path6.default.join(MPDAI_CONFIG_DIR, "system.md");
|
|
156755
157703
|
const systemMdVar = import_node_process7.default.env.GEMINI_SYSTEM_MD?.toLowerCase();
|
|
156756
157704
|
if (systemMdVar && !["0", "false"].includes(systemMdVar)) {
|
|
156757
157705
|
systemMdEnabled = true;
|
|
@@ -157056,7 +158004,7 @@ The structure MUST be as follows:
|
|
|
157056
158004
|
}
|
|
157057
158005
|
|
|
157058
158006
|
// packages/core/dist/src/utils/nextSpeakerChecker.js
|
|
157059
|
-
var
|
|
158007
|
+
var import_genai23 = require("@google/genai");
|
|
157060
158008
|
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
158009
|
**Decision Rules (apply in order):**
|
|
157062
158010
|
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 +158031,14 @@ Respond *only* in JSON format according to the following schema. Do not include
|
|
|
157083
158031
|
\`\`\`
|
|
157084
158032
|
`;
|
|
157085
158033
|
var RESPONSE_SCHEMA = {
|
|
157086
|
-
type:
|
|
158034
|
+
type: import_genai23.Type.OBJECT,
|
|
157087
158035
|
properties: {
|
|
157088
158036
|
reasoning: {
|
|
157089
|
-
type:
|
|
158037
|
+
type: import_genai23.Type.STRING,
|
|
157090
158038
|
description: "Brief explanation justifying the 'next_speaker' choice based *strictly* on the applicable rule and the content/structure of the preceding turn."
|
|
157091
158039
|
},
|
|
157092
158040
|
next_speaker: {
|
|
157093
|
-
type:
|
|
158041
|
+
type: import_genai23.Type.STRING,
|
|
157094
158042
|
enum: ["user", "model"],
|
|
157095
158043
|
description: "Who should speak next based *only* on the preceding turn and the decision rules"
|
|
157096
158044
|
}
|
|
@@ -157178,7 +158126,7 @@ function checkForIncompleteToolCalls(history) {
|
|
|
157178
158126
|
}
|
|
157179
158127
|
|
|
157180
158128
|
// packages/core/dist/src/core/geminiChat.js
|
|
157181
|
-
var
|
|
158129
|
+
var import_genai24 = require("@google/genai");
|
|
157182
158130
|
|
|
157183
158131
|
// packages/core/dist/src/utils/retry.js
|
|
157184
158132
|
init_contentGenerator();
|
|
@@ -157555,7 +158503,7 @@ var fs19 = __toESM(require("fs"), 1);
|
|
|
157555
158503
|
var path20 = __toESM(require("path"), 1);
|
|
157556
158504
|
var import_crypto7 = require("crypto");
|
|
157557
158505
|
var homeDir = os6.homedir() ?? "";
|
|
157558
|
-
var geminiDir = path20.join(homeDir,
|
|
158506
|
+
var geminiDir = path20.join(homeDir, MPDAI_DIR2);
|
|
157559
158507
|
var installationIdFile = path20.join(geminiDir, "installation_id");
|
|
157560
158508
|
function ensureGeminiDirExists() {
|
|
157561
158509
|
if (!fs19.existsSync(geminiDir)) {
|
|
@@ -158405,7 +159353,7 @@ var GeminiChat = class {
|
|
|
158405
159353
|
*/
|
|
158406
159354
|
async sendMessage(params) {
|
|
158407
159355
|
await this.sendPromise;
|
|
158408
|
-
const userContent = (0,
|
|
159356
|
+
const userContent = (0, import_genai24.createUserContent)(params.message);
|
|
158409
159357
|
const requestContents = this.getHistory(true).concat(userContent);
|
|
158410
159358
|
this._logApiRequest(requestContents, this.config.getModel());
|
|
158411
159359
|
const startTime = Date.now();
|
|
@@ -158477,7 +159425,7 @@ var GeminiChat = class {
|
|
|
158477
159425
|
*/
|
|
158478
159426
|
async sendMessageStream(params) {
|
|
158479
159427
|
await this.sendPromise;
|
|
158480
|
-
const userContent = (0,
|
|
159428
|
+
const userContent = (0, import_genai24.createUserContent)(params.message);
|
|
158481
159429
|
const requestContents = this.getHistory(true).concat(userContent);
|
|
158482
159430
|
this._logApiRequest(requestContents, this.config.getModel());
|
|
158483
159431
|
const startTime = Date.now();
|
|
@@ -159114,7 +160062,7 @@ var GitIgnoreParser = class {
|
|
|
159114
160062
|
|
|
159115
160063
|
// packages/core/dist/src/services/fileDiscoveryService.js
|
|
159116
160064
|
var path22 = __toESM(require("path"), 1);
|
|
159117
|
-
var GEMINI_IGNORE_FILE_NAME = ".
|
|
160065
|
+
var GEMINI_IGNORE_FILE_NAME = ".mpdaiignore";
|
|
159118
160066
|
var FileDiscoveryService = class {
|
|
159119
160067
|
gitIgnoreFilter = null;
|
|
159120
160068
|
geminiIgnoreFilter = null;
|
|
@@ -159185,7 +160133,7 @@ var FileDiscoveryService = class {
|
|
|
159185
160133
|
return false;
|
|
159186
160134
|
}
|
|
159187
160135
|
/**
|
|
159188
|
-
* Returns loaded patterns from .
|
|
160136
|
+
* Returns loaded patterns from .mpdaiignore
|
|
159189
160137
|
*/
|
|
159190
160138
|
getGeminiIgnorePatterns() {
|
|
159191
160139
|
return this.geminiIgnoreFilter?.getPatterns() ?? [];
|
|
@@ -163728,7 +164676,7 @@ var GitService = class {
|
|
|
163728
164676
|
}
|
|
163729
164677
|
getHistoryDir() {
|
|
163730
164678
|
const hash = getProjectHash(this.projectRoot);
|
|
163731
|
-
return path23.join(os7.homedir(),
|
|
164679
|
+
return path23.join(os7.homedir(), MPDAI_DIR2, "history", hash);
|
|
163732
164680
|
}
|
|
163733
164681
|
async initialize() {
|
|
163734
164682
|
if (!isGitRepository(this.projectRoot)) {
|
|
@@ -164006,7 +164954,7 @@ async function getGeminiMdFilePathsInternal(currentWorkingDirectory, userHomePat
|
|
|
164006
164954
|
for (const geminiMdFilename of geminiMdFilenames) {
|
|
164007
164955
|
const resolvedCwd = path26.resolve(currentWorkingDirectory);
|
|
164008
164956
|
const resolvedHome = path26.resolve(userHomePath);
|
|
164009
|
-
const globalMemoryPath = path26.join(resolvedHome,
|
|
164957
|
+
const globalMemoryPath = path26.join(resolvedHome, MPDAI_CONFIG_DIR, geminiMdFilename);
|
|
164010
164958
|
if (debugMode)
|
|
164011
164959
|
logger3.debug(`Searching for ${geminiMdFilename} starting from CWD: ${resolvedCwd}`);
|
|
164012
164960
|
if (debugMode)
|
|
@@ -164030,7 +164978,7 @@ async function getGeminiMdFilePathsInternal(currentWorkingDirectory, userHomePat
|
|
|
164030
164978
|
if (debugMode) {
|
|
164031
164979
|
logger3.debug(`Checking for ${geminiMdFilename} in (upward scan): ${currentDir}`);
|
|
164032
164980
|
}
|
|
164033
|
-
if (currentDir === path26.join(resolvedHome,
|
|
164981
|
+
if (currentDir === path26.join(resolvedHome, MPDAI_CONFIG_DIR)) {
|
|
164034
164982
|
if (debugMode) {
|
|
164035
164983
|
logger3.debug(`Upward scan reached global config dir path, stopping upward search here: ${currentDir}`);
|
|
164036
164984
|
}
|
|
@@ -164374,7 +165322,7 @@ var Config = class {
|
|
|
164374
165322
|
return this.geminiClient;
|
|
164375
165323
|
}
|
|
164376
165324
|
getGeminiDir() {
|
|
164377
|
-
return path27.join(this.targetDir,
|
|
165325
|
+
return path27.join(this.targetDir, MPDAI_CONFIG_DIR);
|
|
164378
165326
|
}
|
|
164379
165327
|
getProjectTempDir() {
|
|
164380
165328
|
return getProjectTempDir(this.getProjectRoot());
|
|
@@ -164428,6 +165376,72 @@ var Config = class {
|
|
|
164428
165376
|
this.setGeminiMdFileCount(fileCount);
|
|
164429
165377
|
return { memoryContent, fileCount };
|
|
164430
165378
|
}
|
|
165379
|
+
/**
|
|
165380
|
+
* Get Confluence Advanced Access Token from keys.json
|
|
165381
|
+
* @returns The Personal Access Token or null if not found
|
|
165382
|
+
*/
|
|
165383
|
+
getConfluenceToken() {
|
|
165384
|
+
try {
|
|
165385
|
+
const keysJsonPath = (0, import_node_path7.join)((0, import_node_os3.homedir)(), ".mpdai", "keys.json");
|
|
165386
|
+
if (!(0, import_node_fs6.existsSync)(keysJsonPath)) {
|
|
165387
|
+
return null;
|
|
165388
|
+
}
|
|
165389
|
+
const content = (0, import_node_fs6.readFileSync)(keysJsonPath, "utf-8");
|
|
165390
|
+
const keys = JSON.parse(content);
|
|
165391
|
+
const confluenceKey = keys.find((key) => key.name === "confluence");
|
|
165392
|
+
if (confluenceKey && confluenceKey.value1) {
|
|
165393
|
+
return confluenceKey.value1;
|
|
165394
|
+
}
|
|
165395
|
+
return null;
|
|
165396
|
+
} catch (error) {
|
|
165397
|
+
console.error("Failed to read Confluence token from keys.json:", error);
|
|
165398
|
+
return null;
|
|
165399
|
+
}
|
|
165400
|
+
}
|
|
165401
|
+
/**
|
|
165402
|
+
* Get Jira Personal Access Token from keys.json
|
|
165403
|
+
* @returns The Personal Access Token or null if not found
|
|
165404
|
+
*/
|
|
165405
|
+
getJiraToken() {
|
|
165406
|
+
try {
|
|
165407
|
+
const keysJsonPath = (0, import_node_path7.join)((0, import_node_os3.homedir)(), ".mpdai", "keys.json");
|
|
165408
|
+
if (!(0, import_node_fs6.existsSync)(keysJsonPath)) {
|
|
165409
|
+
return null;
|
|
165410
|
+
}
|
|
165411
|
+
const content = (0, import_node_fs6.readFileSync)(keysJsonPath, "utf-8");
|
|
165412
|
+
const keys = JSON.parse(content);
|
|
165413
|
+
const jiraKey = keys.find((key) => key.name === "jira");
|
|
165414
|
+
if (jiraKey && jiraKey.value1) {
|
|
165415
|
+
return jiraKey.value1;
|
|
165416
|
+
}
|
|
165417
|
+
return null;
|
|
165418
|
+
} catch (error) {
|
|
165419
|
+
console.error("Failed to read Jira token from keys.json:", error);
|
|
165420
|
+
return null;
|
|
165421
|
+
}
|
|
165422
|
+
}
|
|
165423
|
+
/**
|
|
165424
|
+
* Get Bitbucket Personal Access Token from keys.json
|
|
165425
|
+
* @returns The Personal Access Token or null if not found
|
|
165426
|
+
*/
|
|
165427
|
+
getBitbucketToken() {
|
|
165428
|
+
try {
|
|
165429
|
+
const keysJsonPath = (0, import_node_path7.join)((0, import_node_os3.homedir)(), ".mpdai", "keys.json");
|
|
165430
|
+
if (!(0, import_node_fs6.existsSync)(keysJsonPath)) {
|
|
165431
|
+
return null;
|
|
165432
|
+
}
|
|
165433
|
+
const content = (0, import_node_fs6.readFileSync)(keysJsonPath, "utf-8");
|
|
165434
|
+
const keys = JSON.parse(content);
|
|
165435
|
+
const bitbucketKey = keys.find((key) => key.name === "bitbucket");
|
|
165436
|
+
if (bitbucketKey && bitbucketKey.value1) {
|
|
165437
|
+
return bitbucketKey.value1;
|
|
165438
|
+
}
|
|
165439
|
+
return null;
|
|
165440
|
+
} catch (error) {
|
|
165441
|
+
console.error("Failed to read Bitbucket token from keys.json:", error);
|
|
165442
|
+
return null;
|
|
165443
|
+
}
|
|
165444
|
+
}
|
|
164431
165445
|
async createToolRegistry() {
|
|
164432
165446
|
const registry = new ToolRegistry(this);
|
|
164433
165447
|
const targetDir = this.getTargetDir();
|
|
@@ -164460,9 +165474,24 @@ var Config = class {
|
|
|
164460
165474
|
registerCoreTool(EditTool, this);
|
|
164461
165475
|
registerCoreTool(WriteFileTool, this);
|
|
164462
165476
|
}
|
|
164463
|
-
|
|
165477
|
+
const useMpdaiTool = import_node_process8.default.env.USE_MPDAI_TOOL !== "false";
|
|
165478
|
+
if (useMpdaiTool) {
|
|
164464
165479
|
registerCoreTool(WebFetchTool, this);
|
|
164465
165480
|
registerCoreTool(WebSearchTool, this);
|
|
165481
|
+
const confluenceToken = this.getConfluenceToken();
|
|
165482
|
+
if (confluenceToken) {
|
|
165483
|
+
registerCoreTool(ConfluenceGetPageTool, this);
|
|
165484
|
+
}
|
|
165485
|
+
const jiraToken = this.getJiraToken();
|
|
165486
|
+
if (jiraToken) {
|
|
165487
|
+
registerCoreTool(JiraGetIssueTool, this);
|
|
165488
|
+
}
|
|
165489
|
+
const bitbucketToken = this.getBitbucketToken();
|
|
165490
|
+
if (bitbucketToken) {
|
|
165491
|
+
registerCoreTool(BitbucketGetPrDiffTool, this);
|
|
165492
|
+
registerCoreTool(BitbucketAddPrCommentTool, this);
|
|
165493
|
+
registerCoreTool(BitbucketAddPrInlineCommentTool, this);
|
|
165494
|
+
}
|
|
164466
165495
|
}
|
|
164467
165496
|
await registry.discoverTools();
|
|
164468
165497
|
return registry;
|
|
@@ -165054,7 +166083,7 @@ init_models();
|
|
|
165054
166083
|
var fs26 = __toESM(require("fs"), 1);
|
|
165055
166084
|
var path29 = __toESM(require("path"), 1);
|
|
165056
166085
|
var os9 = __toESM(require("os"), 1);
|
|
165057
|
-
var EXTENSIONS_DIRECTORY_NAME = path29.join(".
|
|
166086
|
+
var EXTENSIONS_DIRECTORY_NAME = path29.join(".mpdai", "extensions");
|
|
165058
166087
|
var EXTENSIONS_CONFIG_FILENAME = "gemini-extension.json";
|
|
165059
166088
|
function loadExtensions(workspaceDir) {
|
|
165060
166089
|
const allExtensions = [
|
|
@@ -165164,25 +166193,25 @@ function filterActiveExtensions(extensions, enabledExtensionNames) {
|
|
|
165164
166193
|
}
|
|
165165
166194
|
|
|
165166
166195
|
// node_modules/read-package-up/index.js
|
|
165167
|
-
var
|
|
166196
|
+
var import_node_path10 = __toESM(require("node:path"), 1);
|
|
165168
166197
|
|
|
165169
166198
|
// node_modules/find-up-simple/index.js
|
|
165170
166199
|
var import_node_process9 = __toESM(require("node:process"), 1);
|
|
165171
166200
|
var import_promises5 = __toESM(require("node:fs/promises"), 1);
|
|
165172
166201
|
var import_node_url4 = require("node:url");
|
|
165173
|
-
var
|
|
166202
|
+
var import_node_path8 = __toESM(require("node:path"), 1);
|
|
165174
166203
|
var toPath = (urlOrPath) => urlOrPath instanceof URL ? (0, import_node_url4.fileURLToPath)(urlOrPath) : urlOrPath;
|
|
165175
166204
|
async function findUp(name2, {
|
|
165176
166205
|
cwd = import_node_process9.default.cwd(),
|
|
165177
166206
|
type = "file",
|
|
165178
166207
|
stopAt
|
|
165179
166208
|
} = {}) {
|
|
165180
|
-
let directory =
|
|
165181
|
-
const { root } =
|
|
165182
|
-
stopAt =
|
|
165183
|
-
const isAbsoluteName =
|
|
166209
|
+
let directory = import_node_path8.default.resolve(toPath(cwd) ?? "");
|
|
166210
|
+
const { root } = import_node_path8.default.parse(directory);
|
|
166211
|
+
stopAt = import_node_path8.default.resolve(directory, toPath(stopAt ?? root));
|
|
166212
|
+
const isAbsoluteName = import_node_path8.default.isAbsolute(name2);
|
|
165184
166213
|
while (directory) {
|
|
165185
|
-
const filePath = isAbsoluteName ? name2 :
|
|
166214
|
+
const filePath = isAbsoluteName ? name2 : import_node_path8.default.join(directory, name2);
|
|
165186
166215
|
try {
|
|
165187
166216
|
const stats = await import_promises5.default.stat(filePath);
|
|
165188
166217
|
if (type === "file" && stats.isFile() || type === "directory" && stats.isDirectory()) {
|
|
@@ -165193,13 +166222,13 @@ async function findUp(name2, {
|
|
|
165193
166222
|
if (directory === stopAt || directory === root) {
|
|
165194
166223
|
break;
|
|
165195
166224
|
}
|
|
165196
|
-
directory =
|
|
166225
|
+
directory = import_node_path8.default.dirname(directory);
|
|
165197
166226
|
}
|
|
165198
166227
|
}
|
|
165199
166228
|
|
|
165200
166229
|
// node_modules/read-pkg/index.js
|
|
165201
166230
|
var import_promises6 = __toESM(require("node:fs/promises"), 1);
|
|
165202
|
-
var
|
|
166231
|
+
var import_node_path9 = __toESM(require("node:path"), 1);
|
|
165203
166232
|
|
|
165204
166233
|
// node_modules/parse-json/index.js
|
|
165205
166234
|
var import_code_frame = __toESM(require_lib4(), 1);
|
|
@@ -165328,7 +166357,7 @@ function toPath2(urlOrPath) {
|
|
|
165328
166357
|
}
|
|
165329
166358
|
|
|
165330
166359
|
// node_modules/read-pkg/index.js
|
|
165331
|
-
var getPackagePath = (cwd) =>
|
|
166360
|
+
var getPackagePath = (cwd) => import_node_path9.default.resolve(toPath2(cwd) ?? ".", "package.json");
|
|
165332
166361
|
var _readPackage = (file, normalize5) => {
|
|
165333
166362
|
const json = typeof file === "string" ? parseJson(file) : file;
|
|
165334
166363
|
if (normalize5) {
|
|
@@ -165348,7 +166377,7 @@ async function readPackageUp(options) {
|
|
|
165348
166377
|
return;
|
|
165349
166378
|
}
|
|
165350
166379
|
return {
|
|
165351
|
-
packageJson: await readPackage({ ...options, cwd:
|
|
166380
|
+
packageJson: await readPackage({ ...options, cwd: import_node_path10.default.dirname(filePath) }),
|
|
165352
166381
|
path: filePath
|
|
165353
166382
|
};
|
|
165354
166383
|
}
|
|
@@ -166182,7 +167211,7 @@ var DefaultDark = new Theme(
|
|
|
166182
167211
|
);
|
|
166183
167212
|
|
|
166184
167213
|
// packages/cli/src/config/settings.ts
|
|
166185
|
-
var SETTINGS_DIRECTORY_NAME = ".
|
|
167214
|
+
var SETTINGS_DIRECTORY_NAME = ".mpdai";
|
|
166186
167215
|
var USER_SETTINGS_DIR = path34.join((0, import_os7.homedir)(), SETTINGS_DIRECTORY_NAME);
|
|
166187
167216
|
var USER_SETTINGS_PATH = path34.join(USER_SETTINGS_DIR, "settings.json");
|
|
166188
167217
|
var LoadedSettings = class {
|
|
@@ -166256,7 +167285,7 @@ function resolveEnvVarsInObject(obj) {
|
|
|
166256
167285
|
function findEnvFile(startDir) {
|
|
166257
167286
|
let currentDir = path34.resolve(startDir);
|
|
166258
167287
|
while (true) {
|
|
166259
|
-
const geminiEnvPath = path34.join(currentDir,
|
|
167288
|
+
const geminiEnvPath = path34.join(currentDir, MPDAI_CONFIG_DIR, ".env");
|
|
166260
167289
|
if (fs27.existsSync(geminiEnvPath)) {
|
|
166261
167290
|
return geminiEnvPath;
|
|
166262
167291
|
}
|
|
@@ -166266,7 +167295,7 @@ function findEnvFile(startDir) {
|
|
|
166266
167295
|
}
|
|
166267
167296
|
const parentDir = path34.dirname(currentDir);
|
|
166268
167297
|
if (parentDir === currentDir || !parentDir) {
|
|
166269
|
-
const homeGeminiEnvPath = path34.join((0, import_os7.homedir)(),
|
|
167298
|
+
const homeGeminiEnvPath = path34.join((0, import_os7.homedir)(), MPDAI_CONFIG_DIR, ".env");
|
|
166270
167299
|
if (fs27.existsSync(homeGeminiEnvPath)) {
|
|
166271
167300
|
return homeGeminiEnvPath;
|
|
166272
167301
|
}
|