@qwen-code/qwen-code 0.1.5-nightly.20251106.decb04ef → 0.1.5
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/cli.js +827 -942
- package/package.json +2 -2
package/cli.js
CHANGED
|
@@ -1550,11 +1550,11 @@ var require_signals = __commonJS({
|
|
|
1550
1550
|
var require_signal_exit = __commonJS({
|
|
1551
1551
|
"node_modules/ink/node_modules/signal-exit/index.js"(exports2, module2) {
|
|
1552
1552
|
init_esbuild_shims();
|
|
1553
|
-
var
|
|
1554
|
-
var processOk = /* @__PURE__ */ __name(function(
|
|
1555
|
-
return
|
|
1553
|
+
var process50 = globalThis.process;
|
|
1554
|
+
var processOk = /* @__PURE__ */ __name(function(process51) {
|
|
1555
|
+
return process51 && typeof process51 === "object" && typeof process51.removeListener === "function" && typeof process51.emit === "function" && typeof process51.reallyExit === "function" && typeof process51.listeners === "function" && typeof process51.kill === "function" && typeof process51.pid === "number" && typeof process51.on === "function";
|
|
1556
1556
|
}, "processOk");
|
|
1557
|
-
if (!processOk(
|
|
1557
|
+
if (!processOk(process50)) {
|
|
1558
1558
|
module2.exports = function() {
|
|
1559
1559
|
return function() {
|
|
1560
1560
|
};
|
|
@@ -1562,15 +1562,15 @@ var require_signal_exit = __commonJS({
|
|
|
1562
1562
|
} else {
|
|
1563
1563
|
assert3 = __require("assert");
|
|
1564
1564
|
signals = require_signals();
|
|
1565
|
-
isWin = /^win/i.test(
|
|
1565
|
+
isWin = /^win/i.test(process50.platform);
|
|
1566
1566
|
EE3 = __require("events");
|
|
1567
1567
|
if (typeof EE3 !== "function") {
|
|
1568
1568
|
EE3 = EE3.EventEmitter;
|
|
1569
1569
|
}
|
|
1570
|
-
if (
|
|
1571
|
-
emitter =
|
|
1570
|
+
if (process50.__signal_exit_emitter__) {
|
|
1571
|
+
emitter = process50.__signal_exit_emitter__;
|
|
1572
1572
|
} else {
|
|
1573
|
-
emitter =
|
|
1573
|
+
emitter = process50.__signal_exit_emitter__ = new EE3();
|
|
1574
1574
|
emitter.count = 0;
|
|
1575
1575
|
emitter.emitted = {};
|
|
1576
1576
|
}
|
|
@@ -1607,12 +1607,12 @@ var require_signal_exit = __commonJS({
|
|
|
1607
1607
|
loaded = false;
|
|
1608
1608
|
signals.forEach(function(sig) {
|
|
1609
1609
|
try {
|
|
1610
|
-
|
|
1610
|
+
process50.removeListener(sig, sigListeners[sig]);
|
|
1611
1611
|
} catch (er) {
|
|
1612
1612
|
}
|
|
1613
1613
|
});
|
|
1614
|
-
|
|
1615
|
-
|
|
1614
|
+
process50.emit = originalProcessEmit;
|
|
1615
|
+
process50.reallyExit = originalProcessReallyExit;
|
|
1616
1616
|
emitter.count -= 1;
|
|
1617
1617
|
}, "unload");
|
|
1618
1618
|
module2.exports.unload = unload;
|
|
@@ -1629,7 +1629,7 @@ var require_signal_exit = __commonJS({
|
|
|
1629
1629
|
if (!processOk(globalThis.process)) {
|
|
1630
1630
|
return;
|
|
1631
1631
|
}
|
|
1632
|
-
var listeners =
|
|
1632
|
+
var listeners = process50.listeners(sig);
|
|
1633
1633
|
if (listeners.length === emitter.count) {
|
|
1634
1634
|
unload();
|
|
1635
1635
|
emit("exit", null, sig);
|
|
@@ -1637,7 +1637,7 @@ var require_signal_exit = __commonJS({
|
|
|
1637
1637
|
if (isWin && sig === "SIGHUP") {
|
|
1638
1638
|
sig = "SIGINT";
|
|
1639
1639
|
}
|
|
1640
|
-
|
|
1640
|
+
process50.kill(process50.pid, sig);
|
|
1641
1641
|
}
|
|
1642
1642
|
}, "listener");
|
|
1643
1643
|
});
|
|
@@ -1653,36 +1653,36 @@ var require_signal_exit = __commonJS({
|
|
|
1653
1653
|
emitter.count += 1;
|
|
1654
1654
|
signals = signals.filter(function(sig) {
|
|
1655
1655
|
try {
|
|
1656
|
-
|
|
1656
|
+
process50.on(sig, sigListeners[sig]);
|
|
1657
1657
|
return true;
|
|
1658
1658
|
} catch (er) {
|
|
1659
1659
|
return false;
|
|
1660
1660
|
}
|
|
1661
1661
|
});
|
|
1662
|
-
|
|
1663
|
-
|
|
1662
|
+
process50.emit = processEmit;
|
|
1663
|
+
process50.reallyExit = processReallyExit;
|
|
1664
1664
|
}, "load");
|
|
1665
1665
|
module2.exports.load = load;
|
|
1666
|
-
originalProcessReallyExit =
|
|
1666
|
+
originalProcessReallyExit = process50.reallyExit;
|
|
1667
1667
|
processReallyExit = /* @__PURE__ */ __name(function processReallyExit2(code2) {
|
|
1668
1668
|
if (!processOk(globalThis.process)) {
|
|
1669
1669
|
return;
|
|
1670
1670
|
}
|
|
1671
|
-
|
|
1671
|
+
process50.exitCode = code2 || /* istanbul ignore next */
|
|
1672
1672
|
0;
|
|
1673
|
-
emit("exit",
|
|
1674
|
-
emit("afterexit",
|
|
1675
|
-
originalProcessReallyExit.call(
|
|
1673
|
+
emit("exit", process50.exitCode, null);
|
|
1674
|
+
emit("afterexit", process50.exitCode, null);
|
|
1675
|
+
originalProcessReallyExit.call(process50, process50.exitCode);
|
|
1676
1676
|
}, "processReallyExit");
|
|
1677
|
-
originalProcessEmit =
|
|
1677
|
+
originalProcessEmit = process50.emit;
|
|
1678
1678
|
processEmit = /* @__PURE__ */ __name(function processEmit2(ev, arg) {
|
|
1679
1679
|
if (ev === "exit" && processOk(globalThis.process)) {
|
|
1680
1680
|
if (arg !== void 0) {
|
|
1681
|
-
|
|
1681
|
+
process50.exitCode = arg;
|
|
1682
1682
|
}
|
|
1683
1683
|
var ret = originalProcessEmit.apply(this, arguments);
|
|
1684
|
-
emit("exit",
|
|
1685
|
-
emit("afterexit",
|
|
1684
|
+
emit("exit", process50.exitCode, null);
|
|
1685
|
+
emit("afterexit", process50.exitCode, null);
|
|
1686
1686
|
return ret;
|
|
1687
1687
|
} else {
|
|
1688
1688
|
return originalProcessEmit.apply(this, arguments);
|
|
@@ -28118,12 +28118,12 @@ var require_backend = __commonJS({
|
|
|
28118
28118
|
/***/
|
|
28119
28119
|
(module3, __unused_webpack_exports, __webpack_require__2) => {
|
|
28120
28120
|
"use strict";
|
|
28121
|
-
var
|
|
28121
|
+
var process50 = __webpack_require__2(169);
|
|
28122
28122
|
module3.exports = LRUCache2;
|
|
28123
28123
|
var Map2 = __webpack_require__2(307);
|
|
28124
28124
|
var util4 = __webpack_require__2(82);
|
|
28125
28125
|
var Yallist2 = __webpack_require__2(695);
|
|
28126
|
-
var hasSymbol = typeof Symbol === "function" &&
|
|
28126
|
+
var hasSymbol = typeof Symbol === "function" && process50.env._nodeLRUCacheForceNoSymbol !== "1";
|
|
28127
28127
|
var makeSymbol;
|
|
28128
28128
|
if (hasSymbol) {
|
|
28129
28129
|
makeSymbol = /* @__PURE__ */ __name(function makeSymbol2(key) {
|
|
@@ -28522,7 +28522,7 @@ var require_backend = __commonJS({
|
|
|
28522
28522
|
169: (
|
|
28523
28523
|
/***/
|
|
28524
28524
|
(module3) => {
|
|
28525
|
-
var
|
|
28525
|
+
var process50 = module3.exports = {};
|
|
28526
28526
|
var cachedSetTimeout;
|
|
28527
28527
|
var cachedClearTimeout;
|
|
28528
28528
|
function defaultSetTimout() {
|
|
@@ -28633,7 +28633,7 @@ var require_backend = __commonJS({
|
|
|
28633
28633
|
runClearTimeout(timeout2);
|
|
28634
28634
|
}
|
|
28635
28635
|
__name(drainQueue, "drainQueue");
|
|
28636
|
-
|
|
28636
|
+
process50.nextTick = function(fun) {
|
|
28637
28637
|
var args = new Array(arguments.length - 1);
|
|
28638
28638
|
if (arguments.length > 1) {
|
|
28639
28639
|
for (var i = 1; i < arguments.length; i++) {
|
|
@@ -28653,37 +28653,37 @@ var require_backend = __commonJS({
|
|
|
28653
28653
|
Item.prototype.run = function() {
|
|
28654
28654
|
this.fun.apply(null, this.array);
|
|
28655
28655
|
};
|
|
28656
|
-
|
|
28657
|
-
|
|
28658
|
-
|
|
28659
|
-
|
|
28660
|
-
|
|
28661
|
-
|
|
28656
|
+
process50.title = "browser";
|
|
28657
|
+
process50.browser = true;
|
|
28658
|
+
process50.env = {};
|
|
28659
|
+
process50.argv = [];
|
|
28660
|
+
process50.version = "";
|
|
28661
|
+
process50.versions = {};
|
|
28662
28662
|
function noop6() {
|
|
28663
28663
|
}
|
|
28664
28664
|
__name(noop6, "noop");
|
|
28665
|
-
|
|
28666
|
-
|
|
28667
|
-
|
|
28668
|
-
|
|
28669
|
-
|
|
28670
|
-
|
|
28671
|
-
|
|
28672
|
-
|
|
28673
|
-
|
|
28674
|
-
|
|
28665
|
+
process50.on = noop6;
|
|
28666
|
+
process50.addListener = noop6;
|
|
28667
|
+
process50.once = noop6;
|
|
28668
|
+
process50.off = noop6;
|
|
28669
|
+
process50.removeListener = noop6;
|
|
28670
|
+
process50.removeAllListeners = noop6;
|
|
28671
|
+
process50.emit = noop6;
|
|
28672
|
+
process50.prependListener = noop6;
|
|
28673
|
+
process50.prependOnceListener = noop6;
|
|
28674
|
+
process50.listeners = function(name3) {
|
|
28675
28675
|
return [];
|
|
28676
28676
|
};
|
|
28677
|
-
|
|
28677
|
+
process50.binding = function(name3) {
|
|
28678
28678
|
throw new Error("process.binding is not supported");
|
|
28679
28679
|
};
|
|
28680
|
-
|
|
28680
|
+
process50.cwd = function() {
|
|
28681
28681
|
return "/";
|
|
28682
28682
|
};
|
|
28683
|
-
|
|
28683
|
+
process50.chdir = function(dir) {
|
|
28684
28684
|
throw new Error("process.chdir is not supported");
|
|
28685
28685
|
};
|
|
28686
|
-
|
|
28686
|
+
process50.umask = function() {
|
|
28687
28687
|
return 0;
|
|
28688
28688
|
};
|
|
28689
28689
|
}
|
|
@@ -28692,9 +28692,9 @@ var require_backend = __commonJS({
|
|
|
28692
28692
|
307: (
|
|
28693
28693
|
/***/
|
|
28694
28694
|
(module3, __unused_webpack_exports, __webpack_require__2) => {
|
|
28695
|
-
var
|
|
28696
|
-
if (
|
|
28697
|
-
if (typeof Map === "function" && !
|
|
28695
|
+
var process50 = __webpack_require__2(169);
|
|
28696
|
+
if (process50.env.npm_package_name === "pseudomap" && process50.env.npm_lifecycle_script === "test") process50.env.TEST_PSEUDOMAP = "true";
|
|
28697
|
+
if (typeof Map === "function" && !process50.env.TEST_PSEUDOMAP) {
|
|
28698
28698
|
module3.exports = Map;
|
|
28699
28699
|
} else {
|
|
28700
28700
|
module3.exports = __webpack_require__2(761);
|
|
@@ -28996,7 +28996,7 @@ var require_backend = __commonJS({
|
|
|
28996
28996
|
82: (
|
|
28997
28997
|
/***/
|
|
28998
28998
|
(__unused_webpack_module, exports3, __webpack_require__2) => {
|
|
28999
|
-
var
|
|
28999
|
+
var process50 = __webpack_require__2(169);
|
|
29000
29000
|
function _typeof2(obj) {
|
|
29001
29001
|
"@babel/helpers - typeof";
|
|
29002
29002
|
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
@@ -29056,15 +29056,15 @@ var require_backend = __commonJS({
|
|
|
29056
29056
|
return exports3.deprecate(fn, msg).apply(this, arguments);
|
|
29057
29057
|
};
|
|
29058
29058
|
}
|
|
29059
|
-
if (
|
|
29059
|
+
if (process50.noDeprecation === true) {
|
|
29060
29060
|
return fn;
|
|
29061
29061
|
}
|
|
29062
29062
|
var warned2 = false;
|
|
29063
29063
|
function deprecated() {
|
|
29064
29064
|
if (!warned2) {
|
|
29065
|
-
if (
|
|
29065
|
+
if (process50.throwDeprecation) {
|
|
29066
29066
|
throw new Error(msg);
|
|
29067
|
-
} else if (
|
|
29067
|
+
} else if (process50.traceDeprecation) {
|
|
29068
29068
|
console.trace(msg);
|
|
29069
29069
|
} else {
|
|
29070
29070
|
console.error(msg);
|
|
@@ -29079,11 +29079,11 @@ var require_backend = __commonJS({
|
|
|
29079
29079
|
var debugs = {};
|
|
29080
29080
|
var debugEnviron;
|
|
29081
29081
|
exports3.debuglog = function(set) {
|
|
29082
|
-
if (isUndefined2(debugEnviron)) debugEnviron =
|
|
29082
|
+
if (isUndefined2(debugEnviron)) debugEnviron = process50.env.NODE_DEBUG || "";
|
|
29083
29083
|
set = set.toUpperCase();
|
|
29084
29084
|
if (!debugs[set]) {
|
|
29085
29085
|
if (new RegExp("\\b" + set + "\\b", "i").test(debugEnviron)) {
|
|
29086
|
-
var pid =
|
|
29086
|
+
var pid = process50.pid;
|
|
29087
29087
|
debugs[set] = function() {
|
|
29088
29088
|
var msg = exports3.format.apply(exports3, arguments);
|
|
29089
29089
|
console.error("%s %d: %s", set, pid, msg);
|
|
@@ -31031,7 +31031,7 @@ var require_backend = __commonJS({
|
|
|
31031
31031
|
var isArray2 = Array.isArray;
|
|
31032
31032
|
const src_isArray = isArray2;
|
|
31033
31033
|
;
|
|
31034
|
-
var
|
|
31034
|
+
var process50 = __webpack_require__(169);
|
|
31035
31035
|
function utils_typeof(obj) {
|
|
31036
31036
|
"@babel/helpers - typeof";
|
|
31037
31037
|
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
@@ -31332,7 +31332,7 @@ var require_backend = __commonJS({
|
|
|
31332
31332
|
}
|
|
31333
31333
|
__name(getShowInlineWarningsAndErrors, "getShowInlineWarningsAndErrors");
|
|
31334
31334
|
function getDefaultOpenInEditorURL() {
|
|
31335
|
-
return typeof
|
|
31335
|
+
return typeof process50.env.EDITOR_URL === "string" ? process50.env.EDITOR_URL : "";
|
|
31336
31336
|
}
|
|
31337
31337
|
__name(getDefaultOpenInEditorURL, "getDefaultOpenInEditorURL");
|
|
31338
31338
|
function getOpenInEditorURL() {
|
|
@@ -40442,11 +40442,11 @@ var require_signals2 = __commonJS({
|
|
|
40442
40442
|
var require_signal_exit2 = __commonJS({
|
|
40443
40443
|
"node_modules/restore-cursor/node_modules/signal-exit/index.js"(exports2, module2) {
|
|
40444
40444
|
init_esbuild_shims();
|
|
40445
|
-
var
|
|
40446
|
-
var processOk = /* @__PURE__ */ __name(function(
|
|
40447
|
-
return
|
|
40445
|
+
var process50 = globalThis.process;
|
|
40446
|
+
var processOk = /* @__PURE__ */ __name(function(process51) {
|
|
40447
|
+
return process51 && typeof process51 === "object" && typeof process51.removeListener === "function" && typeof process51.emit === "function" && typeof process51.reallyExit === "function" && typeof process51.listeners === "function" && typeof process51.kill === "function" && typeof process51.pid === "number" && typeof process51.on === "function";
|
|
40448
40448
|
}, "processOk");
|
|
40449
|
-
if (!processOk(
|
|
40449
|
+
if (!processOk(process50)) {
|
|
40450
40450
|
module2.exports = function() {
|
|
40451
40451
|
return function() {
|
|
40452
40452
|
};
|
|
@@ -40454,15 +40454,15 @@ var require_signal_exit2 = __commonJS({
|
|
|
40454
40454
|
} else {
|
|
40455
40455
|
assert3 = __require("assert");
|
|
40456
40456
|
signals = require_signals2();
|
|
40457
|
-
isWin = /^win/i.test(
|
|
40457
|
+
isWin = /^win/i.test(process50.platform);
|
|
40458
40458
|
EE3 = __require("events");
|
|
40459
40459
|
if (typeof EE3 !== "function") {
|
|
40460
40460
|
EE3 = EE3.EventEmitter;
|
|
40461
40461
|
}
|
|
40462
|
-
if (
|
|
40463
|
-
emitter =
|
|
40462
|
+
if (process50.__signal_exit_emitter__) {
|
|
40463
|
+
emitter = process50.__signal_exit_emitter__;
|
|
40464
40464
|
} else {
|
|
40465
|
-
emitter =
|
|
40465
|
+
emitter = process50.__signal_exit_emitter__ = new EE3();
|
|
40466
40466
|
emitter.count = 0;
|
|
40467
40467
|
emitter.emitted = {};
|
|
40468
40468
|
}
|
|
@@ -40499,12 +40499,12 @@ var require_signal_exit2 = __commonJS({
|
|
|
40499
40499
|
loaded = false;
|
|
40500
40500
|
signals.forEach(function(sig) {
|
|
40501
40501
|
try {
|
|
40502
|
-
|
|
40502
|
+
process50.removeListener(sig, sigListeners[sig]);
|
|
40503
40503
|
} catch (er) {
|
|
40504
40504
|
}
|
|
40505
40505
|
});
|
|
40506
|
-
|
|
40507
|
-
|
|
40506
|
+
process50.emit = originalProcessEmit;
|
|
40507
|
+
process50.reallyExit = originalProcessReallyExit;
|
|
40508
40508
|
emitter.count -= 1;
|
|
40509
40509
|
}, "unload");
|
|
40510
40510
|
module2.exports.unload = unload;
|
|
@@ -40521,7 +40521,7 @@ var require_signal_exit2 = __commonJS({
|
|
|
40521
40521
|
if (!processOk(globalThis.process)) {
|
|
40522
40522
|
return;
|
|
40523
40523
|
}
|
|
40524
|
-
var listeners =
|
|
40524
|
+
var listeners = process50.listeners(sig);
|
|
40525
40525
|
if (listeners.length === emitter.count) {
|
|
40526
40526
|
unload();
|
|
40527
40527
|
emit("exit", null, sig);
|
|
@@ -40529,7 +40529,7 @@ var require_signal_exit2 = __commonJS({
|
|
|
40529
40529
|
if (isWin && sig === "SIGHUP") {
|
|
40530
40530
|
sig = "SIGINT";
|
|
40531
40531
|
}
|
|
40532
|
-
|
|
40532
|
+
process50.kill(process50.pid, sig);
|
|
40533
40533
|
}
|
|
40534
40534
|
}, "listener");
|
|
40535
40535
|
});
|
|
@@ -40545,36 +40545,36 @@ var require_signal_exit2 = __commonJS({
|
|
|
40545
40545
|
emitter.count += 1;
|
|
40546
40546
|
signals = signals.filter(function(sig) {
|
|
40547
40547
|
try {
|
|
40548
|
-
|
|
40548
|
+
process50.on(sig, sigListeners[sig]);
|
|
40549
40549
|
return true;
|
|
40550
40550
|
} catch (er) {
|
|
40551
40551
|
return false;
|
|
40552
40552
|
}
|
|
40553
40553
|
});
|
|
40554
|
-
|
|
40555
|
-
|
|
40554
|
+
process50.emit = processEmit;
|
|
40555
|
+
process50.reallyExit = processReallyExit;
|
|
40556
40556
|
}, "load");
|
|
40557
40557
|
module2.exports.load = load;
|
|
40558
|
-
originalProcessReallyExit =
|
|
40558
|
+
originalProcessReallyExit = process50.reallyExit;
|
|
40559
40559
|
processReallyExit = /* @__PURE__ */ __name(function processReallyExit2(code2) {
|
|
40560
40560
|
if (!processOk(globalThis.process)) {
|
|
40561
40561
|
return;
|
|
40562
40562
|
}
|
|
40563
|
-
|
|
40563
|
+
process50.exitCode = code2 || /* istanbul ignore next */
|
|
40564
40564
|
0;
|
|
40565
|
-
emit("exit",
|
|
40566
|
-
emit("afterexit",
|
|
40567
|
-
originalProcessReallyExit.call(
|
|
40565
|
+
emit("exit", process50.exitCode, null);
|
|
40566
|
+
emit("afterexit", process50.exitCode, null);
|
|
40567
|
+
originalProcessReallyExit.call(process50, process50.exitCode);
|
|
40568
40568
|
}, "processReallyExit");
|
|
40569
|
-
originalProcessEmit =
|
|
40569
|
+
originalProcessEmit = process50.emit;
|
|
40570
40570
|
processEmit = /* @__PURE__ */ __name(function processEmit2(ev, arg) {
|
|
40571
40571
|
if (ev === "exit" && processOk(globalThis.process)) {
|
|
40572
40572
|
if (arg !== void 0) {
|
|
40573
|
-
|
|
40573
|
+
process50.exitCode = arg;
|
|
40574
40574
|
}
|
|
40575
40575
|
var ret = originalProcessEmit.apply(this, arguments);
|
|
40576
|
-
emit("exit",
|
|
40577
|
-
emit("afterexit",
|
|
40576
|
+
emit("exit", process50.exitCode, null);
|
|
40577
|
+
emit("afterexit", process50.exitCode, null);
|
|
40578
40578
|
return ret;
|
|
40579
40579
|
} else {
|
|
40580
40580
|
return originalProcessEmit.apply(this, arguments);
|
|
@@ -68070,7 +68070,7 @@ var require_supports_color = __commonJS({
|
|
|
68070
68070
|
"node_modules/supports-color/index.js"(exports2, module2) {
|
|
68071
68071
|
"use strict";
|
|
68072
68072
|
init_esbuild_shims();
|
|
68073
|
-
var
|
|
68073
|
+
var os42 = __require("os");
|
|
68074
68074
|
var hasFlag3 = require_has_flag();
|
|
68075
68075
|
var env7 = process.env;
|
|
68076
68076
|
var forceColor;
|
|
@@ -68109,7 +68109,7 @@ var require_supports_color = __commonJS({
|
|
|
68109
68109
|
}
|
|
68110
68110
|
const min = forceColor ? 1 : 0;
|
|
68111
68111
|
if (process.platform === "win32") {
|
|
68112
|
-
const osRelease =
|
|
68112
|
+
const osRelease = os42.release().split(".");
|
|
68113
68113
|
if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
68114
68114
|
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
68115
68115
|
}
|
|
@@ -71276,7 +71276,7 @@ var require_logging_utils = __commonJS({
|
|
|
71276
71276
|
exports2.setBackend = setBackend;
|
|
71277
71277
|
exports2.log = log;
|
|
71278
71278
|
var node_events_1 = __require("node:events");
|
|
71279
|
-
var
|
|
71279
|
+
var process50 = __importStar(__require("node:process"));
|
|
71280
71280
|
var util4 = __importStar(__require("node:util"));
|
|
71281
71281
|
var colours_1 = require_colours();
|
|
71282
71282
|
var LogSeverity;
|
|
@@ -71333,7 +71333,7 @@ var require_logging_utils = __commonJS({
|
|
|
71333
71333
|
this.cached = /* @__PURE__ */ new Map();
|
|
71334
71334
|
this.filters = [];
|
|
71335
71335
|
this.filtersSet = false;
|
|
71336
|
-
let nodeFlag = (_a6 =
|
|
71336
|
+
let nodeFlag = (_a6 = process50.env[exports2.env.nodeEnables]) !== null && _a6 !== void 0 ? _a6 : "*";
|
|
71337
71337
|
if (nodeFlag === "all") {
|
|
71338
71338
|
nodeFlag = "*";
|
|
71339
71339
|
}
|
|
@@ -71376,7 +71376,7 @@ var require_logging_utils = __commonJS({
|
|
|
71376
71376
|
return (fields, ...args) => {
|
|
71377
71377
|
var _a6;
|
|
71378
71378
|
const nscolour = `${colours_1.Colours.green}${namespace}${colours_1.Colours.reset}`;
|
|
71379
|
-
const pid = `${colours_1.Colours.yellow}${
|
|
71379
|
+
const pid = `${colours_1.Colours.yellow}${process50.pid}${colours_1.Colours.reset}`;
|
|
71380
71380
|
let level;
|
|
71381
71381
|
switch (fields.severity) {
|
|
71382
71382
|
case LogSeverity.ERROR:
|
|
@@ -71428,8 +71428,8 @@ var require_logging_utils = __commonJS({
|
|
|
71428
71428
|
}
|
|
71429
71429
|
setFilters() {
|
|
71430
71430
|
var _a6;
|
|
71431
|
-
const existingFilters = (_a6 =
|
|
71432
|
-
|
|
71431
|
+
const existingFilters = (_a6 = process50.env["NODE_DEBUG"]) !== null && _a6 !== void 0 ? _a6 : "";
|
|
71432
|
+
process50.env["NODE_DEBUG"] = `${existingFilters}${existingFilters ? "," : ""}${this.filters.join(",")}`;
|
|
71433
71433
|
}
|
|
71434
71434
|
};
|
|
71435
71435
|
function getDebugBackend(debugPkg) {
|
|
@@ -71481,7 +71481,7 @@ var require_logging_utils = __commonJS({
|
|
|
71481
71481
|
}
|
|
71482
71482
|
__name(setBackend, "setBackend");
|
|
71483
71483
|
function log(namespace, parent) {
|
|
71484
|
-
const enablesFlag =
|
|
71484
|
+
const enablesFlag = process50.env[exports2.env.nodeEnables];
|
|
71485
71485
|
if (!enablesFlag) {
|
|
71486
71486
|
return exports2.placeholder;
|
|
71487
71487
|
}
|
|
@@ -77186,7 +77186,7 @@ var require_googleauth = __commonJS({
|
|
|
77186
77186
|
var child_process_1 = __require("child_process");
|
|
77187
77187
|
var fs95 = __require("fs");
|
|
77188
77188
|
var gcpMetadata = require_src4();
|
|
77189
|
-
var
|
|
77189
|
+
var os42 = __require("os");
|
|
77190
77190
|
var path108 = __require("path");
|
|
77191
77191
|
var crypto_1 = require_crypto3();
|
|
77192
77192
|
var transporters_1 = require_transporters();
|
|
@@ -77630,7 +77630,7 @@ var require_googleauth = __commonJS({
|
|
|
77630
77630
|
* @api private
|
|
77631
77631
|
*/
|
|
77632
77632
|
_isWindows() {
|
|
77633
|
-
const sys =
|
|
77633
|
+
const sys = os42.platform();
|
|
77634
77634
|
if (sys && sys.length >= 3) {
|
|
77635
77635
|
if (sys.substring(0, 3).toLowerCase() === "win") {
|
|
77636
77636
|
return true;
|
|
@@ -123667,7 +123667,7 @@ var require_service_config = __commonJS({
|
|
|
123667
123667
|
exports2.validateRetryThrottling = validateRetryThrottling;
|
|
123668
123668
|
exports2.validateServiceConfig = validateServiceConfig;
|
|
123669
123669
|
exports2.extractAndSelectServiceConfig = extractAndSelectServiceConfig;
|
|
123670
|
-
var
|
|
123670
|
+
var os42 = __require("os");
|
|
123671
123671
|
var constants_1 = require_constants9();
|
|
123672
123672
|
var DURATION_REGEX = /^\d+(\.\d{1,9})?s$/;
|
|
123673
123673
|
var CLIENT_LANGUAGE_STRING = "node";
|
|
@@ -123974,7 +123974,7 @@ var require_service_config = __commonJS({
|
|
|
123974
123974
|
if (Array.isArray(validatedConfig.clientHostname)) {
|
|
123975
123975
|
let hostnameMatched = false;
|
|
123976
123976
|
for (const hostname3 of validatedConfig.clientHostname) {
|
|
123977
|
-
if (hostname3 ===
|
|
123977
|
+
if (hostname3 === os42.hostname()) {
|
|
123978
123978
|
hostnameMatched = true;
|
|
123979
123979
|
}
|
|
123980
123980
|
}
|
|
@@ -130205,7 +130205,7 @@ var require_root = __commonJS({
|
|
|
130205
130205
|
return null;
|
|
130206
130206
|
}
|
|
130207
130207
|
__name(getBundledFileName, "getBundledFileName");
|
|
130208
|
-
function
|
|
130208
|
+
function process50(filename2, source2) {
|
|
130209
130209
|
try {
|
|
130210
130210
|
if (util4.isString(source2) && source2.charAt(0) === "{")
|
|
130211
130211
|
source2 = JSON.parse(source2);
|
|
@@ -130232,7 +130232,7 @@ var require_root = __commonJS({
|
|
|
130232
130232
|
finish(null, self2);
|
|
130233
130233
|
}
|
|
130234
130234
|
}
|
|
130235
|
-
__name(
|
|
130235
|
+
__name(process50, "process");
|
|
130236
130236
|
function fetch2(filename2, weak) {
|
|
130237
130237
|
filename2 = getBundledFileName(filename2) || filename2;
|
|
130238
130238
|
if (self2.files.indexOf(filename2) > -1) {
|
|
@@ -130241,12 +130241,12 @@ var require_root = __commonJS({
|
|
|
130241
130241
|
self2.files.push(filename2);
|
|
130242
130242
|
if (filename2 in common) {
|
|
130243
130243
|
if (sync2) {
|
|
130244
|
-
|
|
130244
|
+
process50(filename2, common[filename2]);
|
|
130245
130245
|
} else {
|
|
130246
130246
|
++queued;
|
|
130247
130247
|
setTimeout(function() {
|
|
130248
130248
|
--queued;
|
|
130249
|
-
|
|
130249
|
+
process50(filename2, common[filename2]);
|
|
130250
130250
|
});
|
|
130251
130251
|
}
|
|
130252
130252
|
return;
|
|
@@ -130260,7 +130260,7 @@ var require_root = __commonJS({
|
|
|
130260
130260
|
finish(err);
|
|
130261
130261
|
return;
|
|
130262
130262
|
}
|
|
130263
|
-
|
|
130263
|
+
process50(filename2, source2);
|
|
130264
130264
|
} else {
|
|
130265
130265
|
++queued;
|
|
130266
130266
|
self2.fetch(filename2, function(err, source3) {
|
|
@@ -130275,7 +130275,7 @@ var require_root = __commonJS({
|
|
|
130275
130275
|
finish(null, self2);
|
|
130276
130276
|
return;
|
|
130277
130277
|
}
|
|
130278
|
-
|
|
130278
|
+
process50(filename2, source3);
|
|
130279
130279
|
});
|
|
130280
130280
|
}
|
|
130281
130281
|
}
|
|
@@ -137940,7 +137940,7 @@ var require_subchannel_call = __commonJS({
|
|
|
137940
137940
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
137941
137941
|
exports2.Http2SubchannelCall = void 0;
|
|
137942
137942
|
var http22 = __require("http2");
|
|
137943
|
-
var
|
|
137943
|
+
var os42 = __require("os");
|
|
137944
137944
|
var constants_1 = require_constants9();
|
|
137945
137945
|
var metadata_1 = require_metadata3();
|
|
137946
137946
|
var stream_decoder_1 = require_stream_decoder();
|
|
@@ -137948,7 +137948,7 @@ var require_subchannel_call = __commonJS({
|
|
|
137948
137948
|
var constants_2 = require_constants9();
|
|
137949
137949
|
var TRACER_NAME = "subchannel_call";
|
|
137950
137950
|
function getSystemErrorName(errno) {
|
|
137951
|
-
for (const [name3, num] of Object.entries(
|
|
137951
|
+
for (const [name3, num] of Object.entries(os42.constants.errno)) {
|
|
137952
137952
|
if (num === errno) {
|
|
137953
137953
|
return name3;
|
|
137954
137954
|
}
|
|
@@ -157741,13 +157741,13 @@ var require_getMachineId_win = __commonJS({
|
|
|
157741
157741
|
init_esbuild_shims();
|
|
157742
157742
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
157743
157743
|
exports2.getMachineId = void 0;
|
|
157744
|
-
var
|
|
157744
|
+
var process50 = __require("process");
|
|
157745
157745
|
var execAsync_1 = require_execAsync();
|
|
157746
157746
|
var api_1 = (init_esm2(), __toCommonJS(esm_exports2));
|
|
157747
157747
|
async function getMachineId() {
|
|
157748
157748
|
const args = "QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid";
|
|
157749
157749
|
let command2 = "%windir%\\System32\\REG.exe";
|
|
157750
|
-
if (
|
|
157750
|
+
if (process50.arch === "ia32" && "PROCESSOR_ARCHITEW6432" in process50.env) {
|
|
157751
157751
|
command2 = "%windir%\\sysnative\\cmd.exe /c " + command2;
|
|
157752
157752
|
}
|
|
157753
157753
|
try {
|
|
@@ -157790,11 +157790,11 @@ var require_getMachineId = __commonJS({
|
|
|
157790
157790
|
init_esbuild_shims();
|
|
157791
157791
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
157792
157792
|
exports2.getMachineId = void 0;
|
|
157793
|
-
var
|
|
157793
|
+
var process50 = __require("process");
|
|
157794
157794
|
var getMachineIdImpl;
|
|
157795
157795
|
async function getMachineId() {
|
|
157796
157796
|
if (!getMachineIdImpl) {
|
|
157797
|
-
switch (
|
|
157797
|
+
switch (process50.platform) {
|
|
157798
157798
|
case "darwin":
|
|
157799
157799
|
getMachineIdImpl = (await Promise.resolve().then(() => __toESM(require_getMachineId_darwin()))).getMachineId;
|
|
157800
157800
|
break;
|
|
@@ -157916,7 +157916,7 @@ var require_ProcessDetector = __commonJS({
|
|
|
157916
157916
|
exports2.processDetector = void 0;
|
|
157917
157917
|
var api_1 = (init_esm2(), __toCommonJS(esm_exports2));
|
|
157918
157918
|
var semconv_1 = require_semconv2();
|
|
157919
|
-
var
|
|
157919
|
+
var os42 = __require("os");
|
|
157920
157920
|
var ProcessDetector = class {
|
|
157921
157921
|
static {
|
|
157922
157922
|
__name(this, "ProcessDetector");
|
|
@@ -157939,7 +157939,7 @@ var require_ProcessDetector = __commonJS({
|
|
|
157939
157939
|
attributes[semconv_1.ATTR_PROCESS_COMMAND] = process.argv[1];
|
|
157940
157940
|
}
|
|
157941
157941
|
try {
|
|
157942
|
-
const userInfo2 =
|
|
157942
|
+
const userInfo2 = os42.userInfo();
|
|
157943
157943
|
attributes[semconv_1.ATTR_PROCESS_OWNER] = userInfo2.username;
|
|
157944
157944
|
} catch (e2) {
|
|
157945
157945
|
api_1.diag.debug(`error obtaining process owner: ${e2}`);
|
|
@@ -164289,8 +164289,8 @@ var require_homedir = __commonJS({
|
|
|
164289
164289
|
"node_modules/resolve/lib/homedir.js"(exports2, module2) {
|
|
164290
164290
|
"use strict";
|
|
164291
164291
|
init_esbuild_shims();
|
|
164292
|
-
var
|
|
164293
|
-
module2.exports =
|
|
164292
|
+
var os42 = __require("os");
|
|
164293
|
+
module2.exports = os42.homedir || /* @__PURE__ */ __name(function homedir20() {
|
|
164294
164294
|
var home = process.env.HOME;
|
|
164295
164295
|
var user = process.env.LOGNAME || process.env.USER || process.env.LNAME || process.env.USERNAME;
|
|
164296
164296
|
if (process.platform === "win32") {
|
|
@@ -172925,8 +172925,8 @@ var init_uploads = __esm({
|
|
|
172925
172925
|
init_shims();
|
|
172926
172926
|
checkFileSupport = /* @__PURE__ */ __name(() => {
|
|
172927
172927
|
if (typeof File === "undefined") {
|
|
172928
|
-
const { process:
|
|
172929
|
-
const isOldNode = typeof
|
|
172928
|
+
const { process: process50 } = globalThis;
|
|
172929
|
+
const isOldNode = typeof process50?.versions?.node === "string" && parseInt(process50.versions.node.split(".")) < 20;
|
|
172930
172930
|
throw new Error("`File` is not defined as a global, which is required for file uploads." + (isOldNode ? " Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`." : ""));
|
|
172931
172931
|
}
|
|
172932
172932
|
}, "checkFileSupport");
|
|
@@ -182650,7 +182650,7 @@ function createContentGeneratorConfig(config, authType, generationConfig) {
|
|
|
182650
182650
|
};
|
|
182651
182651
|
}
|
|
182652
182652
|
async function createContentGenerator(config, gcConfig, sessionId2) {
|
|
182653
|
-
const version2 = "0.1.5
|
|
182653
|
+
const version2 = "0.1.5";
|
|
182654
182654
|
const userAgent2 = `QwenCode/${version2} (${process.platform}; ${process.arch})`;
|
|
182655
182655
|
const baseHeaders = {
|
|
182656
182656
|
"User-Agent": userAgent2
|
|
@@ -184455,7 +184455,9 @@ var init_tool_names = __esm({
|
|
|
184455
184455
|
TODO_WRITE: "todo_write",
|
|
184456
184456
|
MEMORY: "save_memory",
|
|
184457
184457
|
TASK: "task",
|
|
184458
|
-
EXIT_PLAN_MODE: "exit_plan_mode"
|
|
184458
|
+
EXIT_PLAN_MODE: "exit_plan_mode",
|
|
184459
|
+
WEB_FETCH: "web_fetch",
|
|
184460
|
+
WEB_SEARCH: "web_search"
|
|
184459
184461
|
};
|
|
184460
184462
|
}
|
|
184461
184463
|
});
|
|
@@ -184491,6 +184493,7 @@ var init_gitUtils = __esm({
|
|
|
184491
184493
|
});
|
|
184492
184494
|
|
|
184493
184495
|
// packages/core/dist/src/utils/paths.js
|
|
184496
|
+
import fs19 from "node:fs";
|
|
184494
184497
|
import path15 from "node:path";
|
|
184495
184498
|
import os11 from "node:os";
|
|
184496
184499
|
import * as crypto11 from "node:crypto";
|
|
@@ -184579,11 +184582,51 @@ function isSubpath(parentPath, childPath) {
|
|
|
184579
184582
|
const relative10 = pathModule2.relative(parentPath, childPath);
|
|
184580
184583
|
return !relative10.startsWith(`..${pathModule2.sep}`) && relative10 !== ".." && !pathModule2.isAbsolute(relative10);
|
|
184581
184584
|
}
|
|
184585
|
+
function resolvePath(baseDir = process.cwd(), relativePath) {
|
|
184586
|
+
const homeDir = os11.homedir();
|
|
184587
|
+
if (relativePath === "~") {
|
|
184588
|
+
return homeDir;
|
|
184589
|
+
} else if (relativePath.startsWith("~/")) {
|
|
184590
|
+
return path15.join(homeDir, relativePath.slice(2));
|
|
184591
|
+
} else if (path15.isAbsolute(relativePath)) {
|
|
184592
|
+
return relativePath;
|
|
184593
|
+
} else {
|
|
184594
|
+
return path15.resolve(baseDir, relativePath);
|
|
184595
|
+
}
|
|
184596
|
+
}
|
|
184597
|
+
function validatePath(config, resolvedPath, options2 = {}) {
|
|
184598
|
+
const { allowFiles = false } = options2;
|
|
184599
|
+
const workspaceContext = config.getWorkspaceContext();
|
|
184600
|
+
if (!workspaceContext.isPathWithinWorkspace(resolvedPath)) {
|
|
184601
|
+
throw new Error("Path is not within workspace");
|
|
184602
|
+
}
|
|
184603
|
+
try {
|
|
184604
|
+
const stats = fs19.statSync(resolvedPath);
|
|
184605
|
+
if (!allowFiles && !stats.isDirectory()) {
|
|
184606
|
+
throw new Error(`Path is not a directory: ${resolvedPath}`);
|
|
184607
|
+
}
|
|
184608
|
+
} catch (error) {
|
|
184609
|
+
if (isNodeError(error) && error.code === "ENOENT") {
|
|
184610
|
+
throw new Error(`Path does not exist: ${resolvedPath}`);
|
|
184611
|
+
}
|
|
184612
|
+
throw error;
|
|
184613
|
+
}
|
|
184614
|
+
}
|
|
184615
|
+
function resolveAndValidatePath(config, relativePath, options2 = {}) {
|
|
184616
|
+
const targetDir = config.getTargetDir();
|
|
184617
|
+
if (!relativePath) {
|
|
184618
|
+
return targetDir;
|
|
184619
|
+
}
|
|
184620
|
+
const resolvedPath = resolvePath(targetDir, relativePath);
|
|
184621
|
+
validatePath(config, resolvedPath, options2);
|
|
184622
|
+
return resolvedPath;
|
|
184623
|
+
}
|
|
184582
184624
|
var QWEN_DIR5, SHELL_SPECIAL_CHARS;
|
|
184583
184625
|
var init_paths = __esm({
|
|
184584
184626
|
"packages/core/dist/src/utils/paths.js"() {
|
|
184585
184627
|
"use strict";
|
|
184586
184628
|
init_esbuild_shims();
|
|
184629
|
+
init_errors();
|
|
184587
184630
|
QWEN_DIR5 = ".qwen";
|
|
184588
184631
|
SHELL_SPECIAL_CHARS = /[ \t()[\]{};|*?$`'"#&<>!~]/;
|
|
184589
184632
|
__name(tildeifyPath, "tildeifyPath");
|
|
@@ -184593,11 +184636,14 @@ var init_paths = __esm({
|
|
|
184593
184636
|
__name(unescapePath, "unescapePath");
|
|
184594
184637
|
__name(getProjectHash, "getProjectHash");
|
|
184595
184638
|
__name(isSubpath, "isSubpath");
|
|
184639
|
+
__name(resolvePath, "resolvePath");
|
|
184640
|
+
__name(validatePath, "validatePath");
|
|
184641
|
+
__name(resolveAndValidatePath, "resolveAndValidatePath");
|
|
184596
184642
|
}
|
|
184597
184643
|
});
|
|
184598
184644
|
|
|
184599
184645
|
// packages/core/dist/src/tools/memoryTool.js
|
|
184600
|
-
import * as
|
|
184646
|
+
import * as fs20 from "node:fs/promises";
|
|
184601
184647
|
import * as path16 from "node:path";
|
|
184602
184648
|
function setGeminiMdFilename(newFilename) {
|
|
184603
184649
|
if (Array.isArray(newFilename)) {
|
|
@@ -184640,7 +184686,7 @@ function ensureNewlineSeparation(currentContent) {
|
|
|
184640
184686
|
}
|
|
184641
184687
|
async function readMemoryFileContent(scope = "global") {
|
|
184642
184688
|
try {
|
|
184643
|
-
return await
|
|
184689
|
+
return await fs20.readFile(getMemoryFilePath(scope), "utf-8");
|
|
184644
184690
|
} catch (err) {
|
|
184645
184691
|
const error = err;
|
|
184646
184692
|
if (!(error instanceof Error) || error.code !== "ENOENT")
|
|
@@ -184849,10 +184895,10 @@ Project: ${projectPath} (current project only)`;
|
|
|
184849
184895
|
const memoryFilePath = getMemoryFilePath(scope);
|
|
184850
184896
|
try {
|
|
184851
184897
|
if (modified_by_user && modified_content !== void 0) {
|
|
184852
|
-
await
|
|
184898
|
+
await fs20.mkdir(path16.dirname(memoryFilePath), {
|
|
184853
184899
|
recursive: true
|
|
184854
184900
|
});
|
|
184855
|
-
await
|
|
184901
|
+
await fs20.writeFile(memoryFilePath, modified_content, "utf-8");
|
|
184856
184902
|
const successMessage = `Okay, I've updated the ${scope} memory file with your modifications.`;
|
|
184857
184903
|
return {
|
|
184858
184904
|
llmContent: successMessage,
|
|
@@ -184860,9 +184906,9 @@ Project: ${projectPath} (current project only)`;
|
|
|
184860
184906
|
};
|
|
184861
184907
|
} else {
|
|
184862
184908
|
await MemoryTool.performAddMemoryEntry(fact, memoryFilePath, {
|
|
184863
|
-
readFile:
|
|
184864
|
-
writeFile:
|
|
184865
|
-
mkdir:
|
|
184909
|
+
readFile: fs20.readFile,
|
|
184910
|
+
writeFile: fs20.writeFile,
|
|
184911
|
+
mkdir: fs20.mkdir
|
|
184866
184912
|
});
|
|
184867
184913
|
const successMessage = `Okay, I've remembered that in ${scope} memory: "${fact}"`;
|
|
184868
184914
|
return {
|
|
@@ -184997,7 +185043,7 @@ ${newContent}`;
|
|
|
184997
185043
|
|
|
184998
185044
|
// packages/core/dist/src/core/prompts.js
|
|
184999
185045
|
import path17 from "node:path";
|
|
185000
|
-
import
|
|
185046
|
+
import fs21 from "node:fs";
|
|
185001
185047
|
import os12 from "node:os";
|
|
185002
185048
|
import process18 from "node:process";
|
|
185003
185049
|
function resolvePathFromEnv(envVar) {
|
|
@@ -185057,11 +185103,11 @@ function getCoreSystemPrompt(userMemory, model) {
|
|
|
185057
185103
|
if (!systemMdResolution.isSwitch) {
|
|
185058
185104
|
systemMdPath = systemMdResolution.value;
|
|
185059
185105
|
}
|
|
185060
|
-
if (!
|
|
185106
|
+
if (!fs21.existsSync(systemMdPath)) {
|
|
185061
185107
|
throw new Error(`missing system prompt file '${systemMdPath}'`);
|
|
185062
185108
|
}
|
|
185063
185109
|
}
|
|
185064
|
-
const basePrompt = systemMdEnabled ?
|
|
185110
|
+
const basePrompt = systemMdEnabled ? fs21.readFileSync(systemMdPath, "utf8") : `
|
|
185065
185111
|
You are Qwen Code, an interactive CLI agent developed by Alibaba Group, specializing in software engineering tasks. Your primary goal is to help users safely and efficiently, adhering strictly to the following instructions and utilizing your available tools.
|
|
185066
185112
|
|
|
185067
185113
|
# Core Mandates
|
|
@@ -185241,8 +185287,8 @@ Your core function is efficient and safe assistance. Balance extreme conciseness
|
|
|
185241
185287
|
const writeSystemMdResolution = resolvePathFromEnv(process18.env["QWEN_WRITE_SYSTEM_MD"]);
|
|
185242
185288
|
if (writeSystemMdResolution.value && !writeSystemMdResolution.isDisabled) {
|
|
185243
185289
|
const writePath = writeSystemMdResolution.isSwitch ? systemMdPath : writeSystemMdResolution.value;
|
|
185244
|
-
|
|
185245
|
-
|
|
185290
|
+
fs21.mkdirSync(path17.dirname(writePath), { recursive: true });
|
|
185291
|
+
fs21.writeFileSync(writePath, basePrompt);
|
|
185246
185292
|
}
|
|
185247
185293
|
const memorySuffix = userMemory && userMemory.trim().length > 0 ? `
|
|
185248
185294
|
|
|
@@ -196828,7 +196874,7 @@ ${stderr}`));
|
|
|
196828
196874
|
});
|
|
196829
196875
|
|
|
196830
196876
|
// packages/core/dist/src/tools/shell.js
|
|
196831
|
-
import
|
|
196877
|
+
import fs22 from "node:fs";
|
|
196832
196878
|
import path18 from "node:path";
|
|
196833
196879
|
import os16, { EOL } from "node:os";
|
|
196834
196880
|
import crypto12 from "node:crypto";
|
|
@@ -197006,8 +197052,8 @@ var init_shell = __esm({
|
|
|
197006
197052
|
const result = await resultPromise;
|
|
197007
197053
|
const backgroundPIDs = [];
|
|
197008
197054
|
if (os16.platform() !== "win32") {
|
|
197009
|
-
if (
|
|
197010
|
-
const pgrepLines =
|
|
197055
|
+
if (fs22.existsSync(tempFilePath)) {
|
|
197056
|
+
const pgrepLines = fs22.readFileSync(tempFilePath, "utf8").split(EOL).filter(Boolean);
|
|
197011
197057
|
for (const line of pgrepLines) {
|
|
197012
197058
|
if (!/^\d+$/.test(line)) {
|
|
197013
197059
|
console.error(`pgrep: ${line}`);
|
|
@@ -197085,8 +197131,8 @@ ${result.output}`;
|
|
|
197085
197131
|
...executionError
|
|
197086
197132
|
};
|
|
197087
197133
|
} finally {
|
|
197088
|
-
if (
|
|
197089
|
-
|
|
197134
|
+
if (fs22.existsSync(tempFilePath)) {
|
|
197135
|
+
fs22.unlinkSync(tempFilePath);
|
|
197090
197136
|
}
|
|
197091
197137
|
}
|
|
197092
197138
|
}
|
|
@@ -197191,7 +197237,7 @@ Co-authored-by: ${gitCoAuthorSettings.name} <${gitCoAuthorSettings.email}>`;
|
|
|
197191
197237
|
});
|
|
197192
197238
|
|
|
197193
197239
|
// packages/core/dist/src/core/coreToolScheduler.js
|
|
197194
|
-
import * as
|
|
197240
|
+
import * as fs23 from "node:fs/promises";
|
|
197195
197241
|
import * as path19 from "node:path";
|
|
197196
197242
|
function createFunctionResponsePart(callId, toolName, output) {
|
|
197197
197243
|
return {
|
|
@@ -197271,14 +197317,11 @@ async function truncateAndSaveToFile(content, callId, projectTempDir, threshold,
|
|
|
197271
197317
|
const safeFileName = `${path19.basename(callId)}.output`;
|
|
197272
197318
|
const outputFile = path19.join(projectTempDir, safeFileName);
|
|
197273
197319
|
try {
|
|
197274
|
-
await
|
|
197320
|
+
await fs23.writeFile(outputFile, fileContent);
|
|
197275
197321
|
return {
|
|
197276
197322
|
content: `Tool output was too large and has been truncated.
|
|
197277
197323
|
The full output has been saved to: ${outputFile}
|
|
197278
|
-
To read the complete output, use the ${ReadFileTool.Name} tool with the absolute file path above.
|
|
197279
|
-
- ${ReadFileTool.Name} tool with offset=0, limit=100 to see the first 100 lines
|
|
197280
|
-
- ${ReadFileTool.Name} tool with offset=N to skip N lines from the beginning
|
|
197281
|
-
- ${ReadFileTool.Name} tool with limit=M to read only M lines at a time
|
|
197324
|
+
To read the complete output, use the ${ReadFileTool.Name} tool with the absolute file path above.
|
|
197282
197325
|
The truncated output below shows the beginning and end of the content. The marker '... [CONTENT TRUNCATED] ...' indicates where content was removed.
|
|
197283
197326
|
This allows you to efficiently examine different parts of the output without loading the entire file.
|
|
197284
197327
|
Truncated part of the output:
|
|
@@ -197660,7 +197703,7 @@ var init_coreToolScheduler = __esm({
|
|
|
197660
197703
|
this.setStatusInternal(reqInfo.callId, "error", createErrorResponse(reqInfo, error instanceof Error ? error : new Error(String(error)), ToolErrorType.UNHANDLED_EXCEPTION));
|
|
197661
197704
|
}
|
|
197662
197705
|
}
|
|
197663
|
-
this.attemptExecutionOfScheduledCalls(signal);
|
|
197706
|
+
await this.attemptExecutionOfScheduledCalls(signal);
|
|
197664
197707
|
void this.checkAndNotifyCompletion();
|
|
197665
197708
|
} finally {
|
|
197666
197709
|
this.isScheduling = false;
|
|
@@ -197703,7 +197746,7 @@ var init_coreToolScheduler = __esm({
|
|
|
197703
197746
|
}
|
|
197704
197747
|
this.setStatusInternal(callId, "scheduled");
|
|
197705
197748
|
}
|
|
197706
|
-
this.attemptExecutionOfScheduledCalls(signal);
|
|
197749
|
+
await this.attemptExecutionOfScheduledCalls(signal);
|
|
197707
197750
|
}
|
|
197708
197751
|
/**
|
|
197709
197752
|
* Applies user-provided content changes to a tool call that is awaiting confirmation.
|
|
@@ -197725,13 +197768,13 @@ var init_coreToolScheduler = __esm({
|
|
|
197725
197768
|
fileDiff: updatedDiff
|
|
197726
197769
|
});
|
|
197727
197770
|
}
|
|
197728
|
-
attemptExecutionOfScheduledCalls(signal) {
|
|
197771
|
+
async attemptExecutionOfScheduledCalls(signal) {
|
|
197729
197772
|
const allCallsFinalOrScheduled = this.toolCalls.every((call) => call.status === "scheduled" || call.status === "cancelled" || call.status === "success" || call.status === "error");
|
|
197730
197773
|
if (allCallsFinalOrScheduled) {
|
|
197731
197774
|
const callsToExecute = this.toolCalls.filter((call) => call.status === "scheduled");
|
|
197732
|
-
|
|
197775
|
+
for (const toolCall of callsToExecute) {
|
|
197733
197776
|
if (toolCall.status !== "scheduled")
|
|
197734
|
-
|
|
197777
|
+
continue;
|
|
197735
197778
|
const scheduledCall = toolCall;
|
|
197736
197779
|
const { callId, name: toolName } = scheduledCall.request;
|
|
197737
197780
|
const invocation = scheduledCall.invocation;
|
|
@@ -197754,10 +197797,11 @@ var init_coreToolScheduler = __esm({
|
|
|
197754
197797
|
} else {
|
|
197755
197798
|
promise = invocation.execute(signal, liveOutputCallback, shellExecutionConfig);
|
|
197756
197799
|
}
|
|
197757
|
-
|
|
197800
|
+
try {
|
|
197801
|
+
const toolResult = await promise;
|
|
197758
197802
|
if (signal.aborted) {
|
|
197759
197803
|
this.setStatusInternal(callId, "cancelled", "User cancelled tool execution.");
|
|
197760
|
-
|
|
197804
|
+
continue;
|
|
197761
197805
|
}
|
|
197762
197806
|
if (toolResult.error === void 0) {
|
|
197763
197807
|
let content = toolResult.llmContent;
|
|
@@ -197796,14 +197840,14 @@ var init_coreToolScheduler = __esm({
|
|
|
197796
197840
|
const errorResponse = createErrorResponse(scheduledCall.request, error, toolResult.error.type);
|
|
197797
197841
|
this.setStatusInternal(callId, "error", errorResponse);
|
|
197798
197842
|
}
|
|
197799
|
-
}
|
|
197843
|
+
} catch (executionError) {
|
|
197800
197844
|
if (signal.aborted) {
|
|
197801
197845
|
this.setStatusInternal(callId, "cancelled", "User cancelled tool execution.");
|
|
197802
197846
|
} else {
|
|
197803
197847
|
this.setStatusInternal(callId, "error", createErrorResponse(scheduledCall.request, executionError instanceof Error ? executionError : new Error(String(executionError)), ToolErrorType.UNHANDLED_EXCEPTION));
|
|
197804
197848
|
}
|
|
197805
|
-
}
|
|
197806
|
-
}
|
|
197849
|
+
}
|
|
197850
|
+
}
|
|
197807
197851
|
}
|
|
197808
197852
|
}
|
|
197809
197853
|
async checkAndNotifyCompletion() {
|
|
@@ -197886,7 +197930,7 @@ var init_thoughtUtils = __esm({
|
|
|
197886
197930
|
|
|
197887
197931
|
// packages/core/dist/src/services/chatRecordingService.js
|
|
197888
197932
|
import path20 from "node:path";
|
|
197889
|
-
import
|
|
197933
|
+
import fs24 from "node:fs";
|
|
197890
197934
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
197891
197935
|
var ChatRecordingService;
|
|
197892
197936
|
var init_chatRecordingService = __esm({
|
|
@@ -197928,7 +197972,7 @@ var init_chatRecordingService = __esm({
|
|
|
197928
197972
|
this.cachedLastConvData = null;
|
|
197929
197973
|
} else {
|
|
197930
197974
|
const chatsDir = path20.join(this.config.storage.getProjectTempDir(), "chats");
|
|
197931
|
-
|
|
197975
|
+
fs24.mkdirSync(chatsDir, { recursive: true });
|
|
197932
197976
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().slice(0, 16).replace(/:/g, "-");
|
|
197933
197977
|
const filename = `session-${timestamp}-${this.sessionId.slice(0, 8)}.json`;
|
|
197934
197978
|
this.conversationFile = path20.join(chatsDir, filename);
|
|
@@ -198101,7 +198145,7 @@ var init_chatRecordingService = __esm({
|
|
|
198101
198145
|
*/
|
|
198102
198146
|
readConversation() {
|
|
198103
198147
|
try {
|
|
198104
|
-
this.cachedLastConvData =
|
|
198148
|
+
this.cachedLastConvData = fs24.readFileSync(this.conversationFile, "utf8");
|
|
198105
198149
|
return JSON.parse(this.cachedLastConvData);
|
|
198106
198150
|
} catch (error) {
|
|
198107
198151
|
if (error.code !== "ENOENT") {
|
|
@@ -198130,7 +198174,7 @@ var init_chatRecordingService = __esm({
|
|
|
198130
198174
|
conversation.lastUpdated = (/* @__PURE__ */ new Date()).toISOString();
|
|
198131
198175
|
const newContent = JSON.stringify(conversation, null, 2);
|
|
198132
198176
|
this.cachedLastConvData = newContent;
|
|
198133
|
-
|
|
198177
|
+
fs24.writeFileSync(this.conversationFile, newContent);
|
|
198134
198178
|
}
|
|
198135
198179
|
} catch (error) {
|
|
198136
198180
|
console.error("Error writing conversation file:", error);
|
|
@@ -198153,7 +198197,7 @@ var init_chatRecordingService = __esm({
|
|
|
198153
198197
|
try {
|
|
198154
198198
|
const chatsDir = path20.join(this.config.storage.getProjectTempDir(), "chats");
|
|
198155
198199
|
const sessionPath = path20.join(chatsDir, `${sessionId2}.json`);
|
|
198156
|
-
|
|
198200
|
+
fs24.unlinkSync(sessionPath);
|
|
198157
198201
|
} catch (error) {
|
|
198158
198202
|
console.error("Error deleting session:", error);
|
|
198159
198203
|
throw error;
|
|
@@ -198685,7 +198729,7 @@ This error was probably caused by cyclic schema references in one of the followi
|
|
|
198685
198729
|
const modelResponseParts = [];
|
|
198686
198730
|
let hasToolCall = false;
|
|
198687
198731
|
let hasFinishReason = false;
|
|
198688
|
-
for await (const chunk of
|
|
198732
|
+
for await (const chunk of streamResponse2) {
|
|
198689
198733
|
hasFinishReason = chunk?.candidates?.some((candidate) => candidate.finishReason) ?? false;
|
|
198690
198734
|
if (isValidResponse2(chunk)) {
|
|
198691
198735
|
const content = chunk.candidates?.[0]?.content;
|
|
@@ -198758,55 +198802,6 @@ This error was probably caused by cyclic schema references in one of the followi
|
|
|
198758
198802
|
});
|
|
198759
198803
|
}
|
|
198760
198804
|
}
|
|
198761
|
-
/**
|
|
198762
|
-
* Truncates the chunkStream right before the second function call to a
|
|
198763
|
-
* function that mutates state. This may involve trimming parts from a chunk
|
|
198764
|
-
* as well as omtting some chunks altogether.
|
|
198765
|
-
*
|
|
198766
|
-
* We do this because it improves tool call quality if the model gets
|
|
198767
|
-
* feedback from one mutating function call before it makes the next one.
|
|
198768
|
-
*/
|
|
198769
|
-
async *stopBeforeSecondMutator(chunkStream) {
|
|
198770
|
-
let foundMutatorFunctionCall = false;
|
|
198771
|
-
for await (const chunk of chunkStream) {
|
|
198772
|
-
const candidate = chunk.candidates?.[0];
|
|
198773
|
-
const content = candidate?.content;
|
|
198774
|
-
if (!candidate || !content?.parts) {
|
|
198775
|
-
yield chunk;
|
|
198776
|
-
continue;
|
|
198777
|
-
}
|
|
198778
|
-
const truncatedParts = [];
|
|
198779
|
-
for (const part of content.parts) {
|
|
198780
|
-
if (this.isMutatorFunctionCall(part)) {
|
|
198781
|
-
if (foundMutatorFunctionCall) {
|
|
198782
|
-
const newChunk = new GenerateContentResponse();
|
|
198783
|
-
newChunk.candidates = [
|
|
198784
|
-
{
|
|
198785
|
-
...candidate,
|
|
198786
|
-
content: {
|
|
198787
|
-
...content,
|
|
198788
|
-
parts: truncatedParts
|
|
198789
|
-
},
|
|
198790
|
-
finishReason: FinishReason.STOP
|
|
198791
|
-
}
|
|
198792
|
-
];
|
|
198793
|
-
yield newChunk;
|
|
198794
|
-
return;
|
|
198795
|
-
}
|
|
198796
|
-
foundMutatorFunctionCall = true;
|
|
198797
|
-
}
|
|
198798
|
-
truncatedParts.push(part);
|
|
198799
|
-
}
|
|
198800
|
-
yield chunk;
|
|
198801
|
-
}
|
|
198802
|
-
}
|
|
198803
|
-
isMutatorFunctionCall(part) {
|
|
198804
|
-
if (!part?.functionCall?.name) {
|
|
198805
|
-
return false;
|
|
198806
|
-
}
|
|
198807
|
-
const tool = this.config.getToolRegistry().getTool(part.functionCall.name);
|
|
198808
|
-
return !!tool && MUTATOR_KINDS.includes(tool.kind);
|
|
198809
|
-
}
|
|
198810
198805
|
};
|
|
198811
198806
|
__name(isSchemaDepthError, "isSchemaDepthError");
|
|
198812
198807
|
__name(isInvalidArgumentError, "isInvalidArgumentError");
|
|
@@ -199002,7 +198997,7 @@ var init_constants3 = __esm({
|
|
|
199002
198997
|
});
|
|
199003
198998
|
|
|
199004
198999
|
// packages/core/dist/src/utils/getFolderStructure.js
|
|
199005
|
-
import * as
|
|
199000
|
+
import * as fs25 from "node:fs/promises";
|
|
199006
199001
|
import * as path21 from "node:path";
|
|
199007
199002
|
async function readFullStructure(rootPath, options2) {
|
|
199008
199003
|
const rootName = path21.basename(rootPath);
|
|
@@ -199030,7 +199025,7 @@ async function readFullStructure(rootPath, options2) {
|
|
|
199030
199025
|
}
|
|
199031
199026
|
let entries;
|
|
199032
199027
|
try {
|
|
199033
|
-
const rawEntries = await
|
|
199028
|
+
const rawEntries = await fs25.readdir(currentPath, { withFileTypes: true });
|
|
199034
199029
|
entries = rawEntries.sort((a, b) => a.name.localeCompare(b.name));
|
|
199035
199030
|
} catch (error) {
|
|
199036
199031
|
if (isNodeError(error) && (error.code === "EACCES" || error.code === "ENOENT")) {
|
|
@@ -199267,6 +199262,9 @@ ${result.llmContent}`
|
|
|
199267
199262
|
return initialParts;
|
|
199268
199263
|
}
|
|
199269
199264
|
async function getInitialChatHistory(config, extraHistory) {
|
|
199265
|
+
if (config.getSkipStartupContext()) {
|
|
199266
|
+
return extraHistory ? [...extraHistory] : [];
|
|
199267
|
+
}
|
|
199270
199268
|
const envParts = await getEnvironmentContext(config);
|
|
199271
199269
|
const envContextString = envParts.map((part) => part.text || "").join("\n\n");
|
|
199272
199270
|
return [
|
|
@@ -199340,7 +199338,8 @@ var init_chatCompressionService = __esm({
|
|
|
199340
199338
|
}
|
|
199341
199339
|
async compress(chat, promptId, force, model, config, hasFailedCompressionAttempt) {
|
|
199342
199340
|
const curatedHistory = chat.getHistory(true);
|
|
199343
|
-
|
|
199341
|
+
const threshold = config.getChatCompression()?.contextPercentageThreshold ?? COMPRESSION_TOKEN_THRESHOLD;
|
|
199342
|
+
if (curatedHistory.length === 0 || threshold <= 0 || hasFailedCompressionAttempt && !force) {
|
|
199344
199343
|
return {
|
|
199345
199344
|
newHistory: null,
|
|
199346
199345
|
info: {
|
|
@@ -199351,9 +199350,7 @@ var init_chatCompressionService = __esm({
|
|
|
199351
199350
|
};
|
|
199352
199351
|
}
|
|
199353
199352
|
const originalTokenCount = uiTelemetryService.getLastPromptTokenCount();
|
|
199354
|
-
const contextPercentageThreshold = config.getChatCompression()?.contextPercentageThreshold;
|
|
199355
199353
|
if (!force) {
|
|
199356
|
-
const threshold = contextPercentageThreshold ?? COMPRESSION_TOKEN_THRESHOLD;
|
|
199357
199354
|
if (originalTokenCount < threshold * tokenLimit(model)) {
|
|
199358
199355
|
return {
|
|
199359
199356
|
newHistory: null,
|
|
@@ -206285,7 +206282,7 @@ var require_ignore = __commonJS({
|
|
|
206285
206282
|
});
|
|
206286
206283
|
|
|
206287
206284
|
// packages/core/dist/src/utils/gitIgnoreParser.js
|
|
206288
|
-
import * as
|
|
206285
|
+
import * as fs26 from "node:fs";
|
|
206289
206286
|
import * as path22 from "node:path";
|
|
206290
206287
|
var import_ignore, GitIgnoreParser;
|
|
206291
206288
|
var init_gitIgnoreParser = __esm({
|
|
@@ -206306,7 +206303,7 @@ var init_gitIgnoreParser = __esm({
|
|
|
206306
206303
|
loadPatternsForFile(patternsFilePath) {
|
|
206307
206304
|
let content;
|
|
206308
206305
|
try {
|
|
206309
|
-
content =
|
|
206306
|
+
content = fs26.readFileSync(patternsFilePath, "utf-8");
|
|
206310
206307
|
} catch (_error) {
|
|
206311
206308
|
return [];
|
|
206312
206309
|
}
|
|
@@ -206366,7 +206363,7 @@ var init_gitIgnoreParser = __esm({
|
|
|
206366
206363
|
ig.add(".git");
|
|
206367
206364
|
if (this.globalPatterns === void 0) {
|
|
206368
206365
|
const excludeFile = path22.join(this.projectRoot, ".git", "info", "exclude");
|
|
206369
|
-
this.globalPatterns =
|
|
206366
|
+
this.globalPatterns = fs26.existsSync(excludeFile) ? this.loadPatternsForFile(excludeFile) : [];
|
|
206370
206367
|
}
|
|
206371
206368
|
ig.add(this.globalPatterns);
|
|
206372
206369
|
const pathParts = relativePath.split(path22.sep);
|
|
@@ -206391,7 +206388,7 @@ var init_gitIgnoreParser = __esm({
|
|
|
206391
206388
|
}
|
|
206392
206389
|
} else {
|
|
206393
206390
|
const gitignorePath = path22.join(dir, ".gitignore");
|
|
206394
|
-
if (
|
|
206391
|
+
if (fs26.existsSync(gitignorePath)) {
|
|
206395
206392
|
const patterns = this.loadPatternsForFile(gitignorePath);
|
|
206396
206393
|
this.cache.set(dir, patterns);
|
|
206397
206394
|
ig.add(patterns);
|
|
@@ -206410,7 +206407,7 @@ var init_gitIgnoreParser = __esm({
|
|
|
206410
206407
|
});
|
|
206411
206408
|
|
|
206412
206409
|
// packages/core/dist/src/utils/qwenIgnoreParser.js
|
|
206413
|
-
import * as
|
|
206410
|
+
import * as fs27 from "node:fs";
|
|
206414
206411
|
import * as path23 from "node:path";
|
|
206415
206412
|
var import_ignore2, QwenIgnoreParser;
|
|
206416
206413
|
var init_qwenIgnoreParser = __esm({
|
|
@@ -206433,7 +206430,7 @@ var init_qwenIgnoreParser = __esm({
|
|
|
206433
206430
|
const patternsFilePath = path23.join(this.projectRoot, ".qwenignore");
|
|
206434
206431
|
let content;
|
|
206435
206432
|
try {
|
|
206436
|
-
content =
|
|
206433
|
+
content = fs27.readFileSync(patternsFilePath, "utf-8");
|
|
206437
206434
|
} catch (_error) {
|
|
206438
206435
|
return;
|
|
206439
206436
|
}
|
|
@@ -212038,7 +212035,7 @@ var init_esm8 = __esm({
|
|
|
212038
212035
|
const dirs = /* @__PURE__ */ new Set();
|
|
212039
212036
|
const queue = [entry];
|
|
212040
212037
|
let processing = 0;
|
|
212041
|
-
const
|
|
212038
|
+
const process50 = /* @__PURE__ */ __name(() => {
|
|
212042
212039
|
let paused = false;
|
|
212043
212040
|
while (!paused) {
|
|
212044
212041
|
const dir = queue.shift();
|
|
@@ -212079,9 +212076,9 @@ var init_esm8 = __esm({
|
|
|
212079
212076
|
}
|
|
212080
212077
|
}
|
|
212081
212078
|
if (paused && !results.flowing) {
|
|
212082
|
-
results.once("drain",
|
|
212079
|
+
results.once("drain", process50);
|
|
212083
212080
|
} else if (!sync2) {
|
|
212084
|
-
|
|
212081
|
+
process50();
|
|
212085
212082
|
}
|
|
212086
212083
|
}, "onReaddir");
|
|
212087
212084
|
let sync2 = true;
|
|
@@ -212089,7 +212086,7 @@ var init_esm8 = __esm({
|
|
|
212089
212086
|
sync2 = false;
|
|
212090
212087
|
}
|
|
212091
212088
|
}, "process");
|
|
212092
|
-
|
|
212089
|
+
process50();
|
|
212093
212090
|
return results;
|
|
212094
212091
|
}
|
|
212095
212092
|
streamSync(entry = this.cwd, opts = {}) {
|
|
@@ -212107,7 +212104,7 @@ var init_esm8 = __esm({
|
|
|
212107
212104
|
}
|
|
212108
212105
|
const queue = [entry];
|
|
212109
212106
|
let processing = 0;
|
|
212110
|
-
const
|
|
212107
|
+
const process50 = /* @__PURE__ */ __name(() => {
|
|
212111
212108
|
let paused = false;
|
|
212112
212109
|
while (!paused) {
|
|
212113
212110
|
const dir = queue.shift();
|
|
@@ -212141,9 +212138,9 @@ var init_esm8 = __esm({
|
|
|
212141
212138
|
}
|
|
212142
212139
|
}
|
|
212143
212140
|
if (paused && !results.flowing)
|
|
212144
|
-
results.once("drain",
|
|
212141
|
+
results.once("drain", process50);
|
|
212145
212142
|
}, "process");
|
|
212146
|
-
|
|
212143
|
+
process50();
|
|
212147
212144
|
return results;
|
|
212148
212145
|
}
|
|
212149
212146
|
chdir(path108 = this.cwd) {
|
|
@@ -213392,7 +213389,7 @@ var init_esm9 = __esm({
|
|
|
213392
213389
|
});
|
|
213393
213390
|
|
|
213394
213391
|
// packages/core/dist/src/services/fileSystemService.js
|
|
213395
|
-
import
|
|
213392
|
+
import fs28 from "node:fs/promises";
|
|
213396
213393
|
import * as path26 from "node:path";
|
|
213397
213394
|
var StandardFileSystemService;
|
|
213398
213395
|
var init_fileSystemService = __esm({
|
|
@@ -213405,10 +213402,10 @@ var init_fileSystemService = __esm({
|
|
|
213405
213402
|
__name(this, "StandardFileSystemService");
|
|
213406
213403
|
}
|
|
213407
213404
|
async readTextFile(filePath) {
|
|
213408
|
-
return
|
|
213405
|
+
return fs28.readFile(filePath, "utf-8");
|
|
213409
213406
|
}
|
|
213410
213407
|
async writeTextFile(filePath, content) {
|
|
213411
|
-
await
|
|
213408
|
+
await fs28.writeFile(filePath, content, "utf-8");
|
|
213412
213409
|
}
|
|
213413
213410
|
findFiles(fileName, searchPaths) {
|
|
213414
213411
|
return searchPaths.flatMap((searchPath) => {
|
|
@@ -218238,7 +218235,7 @@ var init_esm10 = __esm({
|
|
|
218238
218235
|
});
|
|
218239
218236
|
|
|
218240
218237
|
// packages/core/dist/src/services/gitService.js
|
|
218241
|
-
import * as
|
|
218238
|
+
import * as fs29 from "node:fs/promises";
|
|
218242
218239
|
import * as path27 from "node:path";
|
|
218243
218240
|
var GitService;
|
|
218244
218241
|
var init_gitService = __esm({
|
|
@@ -218287,9 +218284,9 @@ var init_gitService = __esm({
|
|
|
218287
218284
|
async setupShadowGitRepository() {
|
|
218288
218285
|
const repoDir = this.getHistoryDir();
|
|
218289
218286
|
const gitConfigPath = path27.join(repoDir, ".gitconfig");
|
|
218290
|
-
await
|
|
218287
|
+
await fs29.mkdir(repoDir, { recursive: true });
|
|
218291
218288
|
const gitConfigContent = "[user]\n name = Qwen Code\n email = qwen-code@qwen.ai\n[commit]\n gpgsign = false\n";
|
|
218292
|
-
await
|
|
218289
|
+
await fs29.writeFile(gitConfigPath, gitConfigContent);
|
|
218293
218290
|
const repo = simpleGit(repoDir);
|
|
218294
218291
|
const isRepoDefined = await repo.checkIsRepo(CheckRepoActions.IS_REPO_ROOT);
|
|
218295
218292
|
if (!isRepoDefined) {
|
|
@@ -218302,13 +218299,13 @@ var init_gitService = __esm({
|
|
|
218302
218299
|
const shadowGitIgnorePath = path27.join(repoDir, ".gitignore");
|
|
218303
218300
|
let userGitIgnoreContent = "";
|
|
218304
218301
|
try {
|
|
218305
|
-
userGitIgnoreContent = await
|
|
218302
|
+
userGitIgnoreContent = await fs29.readFile(userGitIgnorePath, "utf-8");
|
|
218306
218303
|
} catch (error) {
|
|
218307
218304
|
if (isNodeError(error) && error.code !== "ENOENT") {
|
|
218308
218305
|
throw error;
|
|
218309
218306
|
}
|
|
218310
218307
|
}
|
|
218311
|
-
await
|
|
218308
|
+
await fs29.writeFile(shadowGitIgnorePath, userGitIgnoreContent);
|
|
218312
218309
|
}
|
|
218313
218310
|
get shadowGitRepository() {
|
|
218314
218311
|
const repoDir = this.getHistoryDir();
|
|
@@ -218989,7 +218986,7 @@ var init_ignorePatterns = __esm({
|
|
|
218989
218986
|
});
|
|
218990
218987
|
|
|
218991
218988
|
// packages/core/dist/src/utils/fileUtils.js
|
|
218992
|
-
import
|
|
218989
|
+
import fs30 from "node:fs";
|
|
218993
218990
|
import fsPromises from "node:fs/promises";
|
|
218994
218991
|
import path29 from "node:path";
|
|
218995
218992
|
function detectBOM(buf) {
|
|
@@ -219039,7 +219036,7 @@ function decodeUTF32(buf, littleEndian) {
|
|
|
219039
219036
|
return out;
|
|
219040
219037
|
}
|
|
219041
219038
|
async function readFileWithEncoding(filePath) {
|
|
219042
|
-
const full = await
|
|
219039
|
+
const full = await fs30.promises.readFile(filePath);
|
|
219043
219040
|
if (full.length === 0)
|
|
219044
219041
|
return "";
|
|
219045
219042
|
const bom = detectBOM(full);
|
|
@@ -219075,7 +219072,7 @@ function isWithinRoot(pathToCheck, rootDirectory) {
|
|
|
219075
219072
|
async function isBinaryFile(filePath) {
|
|
219076
219073
|
let fh = null;
|
|
219077
219074
|
try {
|
|
219078
|
-
fh = await
|
|
219075
|
+
fh = await fs30.promises.open(filePath, "r");
|
|
219079
219076
|
const stats = await fh.stat();
|
|
219080
219077
|
const fileSize = stats.size;
|
|
219081
219078
|
if (fileSize === 0)
|
|
@@ -219141,9 +219138,10 @@ async function detectFileType(filePath) {
|
|
|
219141
219138
|
}
|
|
219142
219139
|
return "text";
|
|
219143
219140
|
}
|
|
219144
|
-
async function processSingleFileContent(filePath,
|
|
219141
|
+
async function processSingleFileContent(filePath, config, offset, limit2) {
|
|
219142
|
+
const rootDirectory = config.getTargetDir();
|
|
219145
219143
|
try {
|
|
219146
|
-
if (!
|
|
219144
|
+
if (!fs30.existsSync(filePath)) {
|
|
219147
219145
|
return {
|
|
219148
219146
|
llmContent: "Could not read file because no file was found at the specified path.",
|
|
219149
219147
|
returnDisplay: "File not found.",
|
|
@@ -219151,7 +219149,7 @@ async function processSingleFileContent(filePath, rootDirectory, fileSystemServi
|
|
|
219151
219149
|
errorType: ToolErrorType.FILE_NOT_FOUND
|
|
219152
219150
|
};
|
|
219153
219151
|
}
|
|
219154
|
-
const stats = await
|
|
219152
|
+
const stats = await fs30.promises.stat(filePath);
|
|
219155
219153
|
if (stats.isDirectory()) {
|
|
219156
219154
|
return {
|
|
219157
219155
|
llmContent: "Could not read file because the provided path is a directory, not a file.",
|
|
@@ -219194,46 +219192,63 @@ async function processSingleFileContent(filePath, rootDirectory, fileSystemServi
|
|
|
219194
219192
|
}
|
|
219195
219193
|
case "text": {
|
|
219196
219194
|
const content = await readFileWithEncoding(filePath);
|
|
219197
|
-
const lines = content.split("\n");
|
|
219195
|
+
const lines = content.split("\n").map((line) => line.trimEnd());
|
|
219198
219196
|
const originalLineCount = lines.length;
|
|
219199
219197
|
const startLine = offset || 0;
|
|
219200
|
-
const
|
|
219198
|
+
const configLineLimit = config.getTruncateToolOutputLines();
|
|
219199
|
+
const configCharLimit = config.getTruncateToolOutputThreshold();
|
|
219200
|
+
const effectiveLimit = limit2 === void 0 ? configLineLimit : limit2;
|
|
219201
219201
|
const endLine = Math.min(startLine + effectiveLimit, originalLineCount);
|
|
219202
219202
|
const actualStartLine = Math.min(startLine, originalLineCount);
|
|
219203
219203
|
const selectedLines = lines.slice(actualStartLine, endLine);
|
|
219204
|
-
let
|
|
219205
|
-
|
|
219206
|
-
|
|
219207
|
-
|
|
219208
|
-
|
|
219204
|
+
let llmContent = "";
|
|
219205
|
+
let contentLengthTruncated = false;
|
|
219206
|
+
let linesIncluded = 0;
|
|
219207
|
+
if (Number.isFinite(configCharLimit)) {
|
|
219208
|
+
const formattedLines = [];
|
|
219209
|
+
let currentLength = 0;
|
|
219210
|
+
for (const line of selectedLines) {
|
|
219211
|
+
const sep7 = linesIncluded > 0 ? 1 : 0;
|
|
219212
|
+
linesIncluded++;
|
|
219213
|
+
const projectedLength = currentLength + line.length + sep7;
|
|
219214
|
+
if (projectedLength <= configCharLimit) {
|
|
219215
|
+
formattedLines.push(line);
|
|
219216
|
+
currentLength = projectedLength;
|
|
219217
|
+
} else {
|
|
219218
|
+
const remaining = Math.max(configCharLimit - currentLength - sep7, 10);
|
|
219219
|
+
formattedLines.push(line.substring(0, remaining) + "... [truncated]");
|
|
219220
|
+
contentLengthTruncated = true;
|
|
219221
|
+
break;
|
|
219222
|
+
}
|
|
219209
219223
|
}
|
|
219210
|
-
|
|
219211
|
-
}
|
|
219212
|
-
|
|
219213
|
-
|
|
219214
|
-
|
|
219224
|
+
llmContent = formattedLines.join("\n");
|
|
219225
|
+
} else {
|
|
219226
|
+
llmContent = selectedLines.join("\n");
|
|
219227
|
+
linesIncluded = selectedLines.length;
|
|
219228
|
+
}
|
|
219229
|
+
const actualEndLine = contentLengthTruncated ? actualStartLine + linesIncluded : endLine;
|
|
219230
|
+
const contentRangeTruncated = startLine > 0 || actualEndLine < originalLineCount;
|
|
219231
|
+
const isTruncated = contentRangeTruncated || contentLengthTruncated;
|
|
219215
219232
|
let returnDisplay = "";
|
|
219216
|
-
if (
|
|
219217
|
-
returnDisplay = `Read lines ${actualStartLine + 1}-${
|
|
219218
|
-
if (
|
|
219219
|
-
returnDisplay += " (
|
|
219233
|
+
if (isTruncated) {
|
|
219234
|
+
returnDisplay = `Read lines ${actualStartLine + 1}-${actualEndLine} of ${originalLineCount} from ${relativePathForDisplay}`;
|
|
219235
|
+
if (contentLengthTruncated) {
|
|
219236
|
+
returnDisplay += " (truncated)";
|
|
219220
219237
|
}
|
|
219221
|
-
} else if (linesWereTruncatedInLength) {
|
|
219222
|
-
returnDisplay = `Read all ${originalLineCount} lines from ${relativePathForDisplay} (some lines were shortened)`;
|
|
219223
219238
|
}
|
|
219224
219239
|
return {
|
|
219225
219240
|
llmContent,
|
|
219226
219241
|
returnDisplay,
|
|
219227
219242
|
isTruncated,
|
|
219228
219243
|
originalLineCount,
|
|
219229
|
-
linesShown: [actualStartLine + 1,
|
|
219244
|
+
linesShown: [actualStartLine + 1, actualEndLine]
|
|
219230
219245
|
};
|
|
219231
219246
|
}
|
|
219232
219247
|
case "image":
|
|
219233
219248
|
case "pdf":
|
|
219234
219249
|
case "audio":
|
|
219235
219250
|
case "video": {
|
|
219236
|
-
const contentBuffer = await
|
|
219251
|
+
const contentBuffer = await fs30.promises.readFile(filePath);
|
|
219237
219252
|
const base64Data = contentBuffer.toString("base64");
|
|
219238
219253
|
return {
|
|
219239
219254
|
llmContent: {
|
|
@@ -219267,13 +219282,13 @@ async function processSingleFileContent(filePath, rootDirectory, fileSystemServi
|
|
|
219267
219282
|
}
|
|
219268
219283
|
async function fileExists(filePath) {
|
|
219269
219284
|
try {
|
|
219270
|
-
await fsPromises.access(filePath,
|
|
219285
|
+
await fsPromises.access(filePath, fs30.constants.F_OK);
|
|
219271
219286
|
return true;
|
|
219272
219287
|
} catch (_) {
|
|
219273
219288
|
return false;
|
|
219274
219289
|
}
|
|
219275
219290
|
}
|
|
219276
|
-
var
|
|
219291
|
+
var DEFAULT_ENCODING;
|
|
219277
219292
|
var init_fileUtils = __esm({
|
|
219278
219293
|
"packages/core/dist/src/utils/fileUtils.js"() {
|
|
219279
219294
|
"use strict";
|
|
@@ -219281,8 +219296,6 @@ var init_fileUtils = __esm({
|
|
|
219281
219296
|
init_index_lite();
|
|
219282
219297
|
init_tool_error();
|
|
219283
219298
|
init_ignorePatterns();
|
|
219284
|
-
DEFAULT_MAX_LINES_TEXT_FILE = 2e3;
|
|
219285
|
-
MAX_LINE_LENGTH_TEXT_FILE = 2e3;
|
|
219286
219299
|
DEFAULT_ENCODING = "utf-8";
|
|
219287
219300
|
__name(detectBOM, "detectBOM");
|
|
219288
219301
|
__name(decodeUTF16BE, "decodeUTF16BE");
|
|
@@ -219451,7 +219464,7 @@ var init_read_file = __esm({
|
|
|
219451
219464
|
return [{ path: this.params.absolute_path, line: this.params.offset }];
|
|
219452
219465
|
}
|
|
219453
219466
|
async execute() {
|
|
219454
|
-
const result = await processSingleFileContent(this.params.absolute_path, this.config
|
|
219467
|
+
const result = await processSingleFileContent(this.params.absolute_path, this.config, this.params.offset, this.params.limit);
|
|
219455
219468
|
if (result.error) {
|
|
219456
219469
|
return {
|
|
219457
219470
|
llmContent: result.llmContent,
|
|
@@ -219466,13 +219479,10 @@ var init_read_file = __esm({
|
|
|
219466
219479
|
if (result.isTruncated) {
|
|
219467
219480
|
const [start, end] = result.linesShown;
|
|
219468
219481
|
const total = result.originalLineCount;
|
|
219469
|
-
|
|
219470
|
-
|
|
219471
|
-
|
|
219472
|
-
Status: Showing lines ${start}-${end} of ${total} total lines.
|
|
219473
|
-
Action: To read more of the file, you can use the 'offset' and 'limit' parameters in a subsequent 'read_file' call. For example, to read the next section of the file, use offset: ${nextOffset}.
|
|
219482
|
+
llmContent = `Showing lines ${start}-${end} of ${total} total lines.
|
|
219483
|
+
|
|
219484
|
+
---
|
|
219474
219485
|
|
|
219475
|
-
--- FILE CONTENT (truncated) ---
|
|
219476
219486
|
${result.llmContent}`;
|
|
219477
219487
|
} else {
|
|
219478
219488
|
llmContent = result.llmContent || "";
|
|
@@ -219584,7 +219594,7 @@ function verifyVSCode(ide, ideProcessInfo) {
|
|
|
219584
219594
|
if (ide.name !== IDE_DEFINITIONS.vscode.name) {
|
|
219585
219595
|
return ide;
|
|
219586
219596
|
}
|
|
219587
|
-
if (ideProcessInfo.command.toLowerCase().includes("code")) {
|
|
219597
|
+
if (ideProcessInfo.command && ideProcessInfo.command.toLowerCase().includes("code")) {
|
|
219588
219598
|
return IDE_DEFINITIONS.vscode;
|
|
219589
219599
|
}
|
|
219590
219600
|
return IDE_DEFINITIONS.vscodefork;
|
|
@@ -229412,18 +229422,18 @@ var init_stdio2 = __esm({
|
|
|
229412
229422
|
});
|
|
229413
229423
|
|
|
229414
229424
|
// packages/core/dist/src/ide/ide-client.js
|
|
229415
|
-
import * as
|
|
229425
|
+
import * as fs31 from "node:fs";
|
|
229416
229426
|
import * as os18 from "node:os";
|
|
229417
229427
|
import * as path33 from "node:path";
|
|
229418
229428
|
function getRealPath(path108) {
|
|
229419
229429
|
try {
|
|
229420
|
-
return
|
|
229430
|
+
return fs31.realpathSync(path108);
|
|
229421
229431
|
} catch (_e) {
|
|
229422
229432
|
return path108;
|
|
229423
229433
|
}
|
|
229424
229434
|
}
|
|
229425
229435
|
function getIdeServerHost() {
|
|
229426
|
-
const isInContainer =
|
|
229436
|
+
const isInContainer = fs31.existsSync("/.dockerenv") || fs31.existsSync("/run/.containerenv");
|
|
229427
229437
|
return isInContainer ? "host.docker.internal" : "127.0.0.1";
|
|
229428
229438
|
}
|
|
229429
229439
|
var import_undici, logger, IDEConnectionStatus, IdeClient;
|
|
@@ -229814,14 +229824,14 @@ var init_ide_client = __esm({
|
|
|
229814
229824
|
}
|
|
229815
229825
|
try {
|
|
229816
229826
|
const portFile = path33.join(os18.tmpdir(), `qwen-code-ide-server-${this.ideProcessInfo.pid}.json`);
|
|
229817
|
-
const portFileContents = await
|
|
229827
|
+
const portFileContents = await fs31.promises.readFile(portFile, "utf8");
|
|
229818
229828
|
return JSON.parse(portFileContents);
|
|
229819
229829
|
} catch (_) {
|
|
229820
229830
|
}
|
|
229821
229831
|
const portFileDir = path33.join(os18.tmpdir(), "gemini", "ide");
|
|
229822
229832
|
let portFiles;
|
|
229823
229833
|
try {
|
|
229824
|
-
portFiles = await
|
|
229834
|
+
portFiles = await fs31.promises.readdir(portFileDir);
|
|
229825
229835
|
} catch (e2) {
|
|
229826
229836
|
logger.debug("Failed to read IDE connection directory:", e2);
|
|
229827
229837
|
return void 0;
|
|
@@ -229836,7 +229846,7 @@ var init_ide_client = __esm({
|
|
|
229836
229846
|
}
|
|
229837
229847
|
let fileContents;
|
|
229838
229848
|
try {
|
|
229839
|
-
fileContents = await Promise.all(matchingFiles.map((file) =>
|
|
229849
|
+
fileContents = await Promise.all(matchingFiles.map((file) => fs31.promises.readFile(path33.join(portFileDir, file), "utf8")));
|
|
229840
229850
|
} catch (e2) {
|
|
229841
229851
|
logger.debug("Failed to read IDE connection config file(s):", e2);
|
|
229842
229852
|
return void 0;
|
|
@@ -230015,7 +230025,7 @@ ${errorMessage}`, true);
|
|
|
230015
230025
|
});
|
|
230016
230026
|
|
|
230017
230027
|
// packages/core/dist/src/tools/edit.js
|
|
230018
|
-
import * as
|
|
230028
|
+
import * as fs32 from "node:fs";
|
|
230019
230029
|
import * as path34 from "node:path";
|
|
230020
230030
|
function applyReplacement(currentContent, oldString, newString, isNewFile) {
|
|
230021
230031
|
if (isNewFile) {
|
|
@@ -230313,8 +230323,8 @@ var init_edit = __esm({
|
|
|
230313
230323
|
*/
|
|
230314
230324
|
ensureParentDirectoriesExist(filePath) {
|
|
230315
230325
|
const dirName = path34.dirname(filePath);
|
|
230316
|
-
if (!
|
|
230317
|
-
|
|
230326
|
+
if (!fs32.existsSync(dirName)) {
|
|
230327
|
+
fs32.mkdirSync(dirName, { recursive: true });
|
|
230318
230328
|
}
|
|
230319
230329
|
}
|
|
230320
230330
|
};
|
|
@@ -230552,7 +230562,7 @@ Eg.
|
|
|
230552
230562
|
});
|
|
230553
230563
|
|
|
230554
230564
|
// packages/core/dist/src/tools/glob.js
|
|
230555
|
-
import
|
|
230565
|
+
import fs33 from "node:fs";
|
|
230556
230566
|
import path35 from "node:path";
|
|
230557
230567
|
function sortFileEntries(entries, nowTimestamp, recencyThresholdMs) {
|
|
230558
230568
|
const sortedEntries = [...entries];
|
|
@@ -230573,7 +230583,7 @@ function sortFileEntries(entries, nowTimestamp, recencyThresholdMs) {
|
|
|
230573
230583
|
});
|
|
230574
230584
|
return sortedEntries;
|
|
230575
230585
|
}
|
|
230576
|
-
var GlobToolInvocation, GlobTool;
|
|
230586
|
+
var MAX_FILE_COUNT, GlobToolInvocation, GlobTool;
|
|
230577
230587
|
var init_glob2 = __esm({
|
|
230578
230588
|
"packages/core/dist/src/tools/glob.js"() {
|
|
230579
230589
|
"use strict";
|
|
@@ -230585,116 +230595,79 @@ var init_glob2 = __esm({
|
|
|
230585
230595
|
init_config3();
|
|
230586
230596
|
init_constants3();
|
|
230587
230597
|
init_tool_error();
|
|
230598
|
+
init_errors();
|
|
230599
|
+
MAX_FILE_COUNT = 100;
|
|
230588
230600
|
__name(sortFileEntries, "sortFileEntries");
|
|
230589
230601
|
GlobToolInvocation = class extends BaseToolInvocation {
|
|
230590
230602
|
static {
|
|
230591
230603
|
__name(this, "GlobToolInvocation");
|
|
230592
230604
|
}
|
|
230593
230605
|
config;
|
|
230606
|
+
fileService;
|
|
230594
230607
|
constructor(config, params) {
|
|
230595
230608
|
super(params);
|
|
230596
230609
|
this.config = config;
|
|
230610
|
+
this.fileService = config.getFileService();
|
|
230597
230611
|
}
|
|
230598
230612
|
getDescription() {
|
|
230599
230613
|
let description = `'${this.params.pattern}'`;
|
|
230600
230614
|
if (this.params.path) {
|
|
230601
|
-
|
|
230602
|
-
const relativePath = makeRelative(searchDir, this.config.getTargetDir());
|
|
230603
|
-
description += ` within ${shortenPath(relativePath)}`;
|
|
230615
|
+
description += ` in path '${this.params.path}'`;
|
|
230604
230616
|
}
|
|
230605
230617
|
return description;
|
|
230606
230618
|
}
|
|
230607
230619
|
async execute(signal) {
|
|
230608
230620
|
try {
|
|
230609
|
-
const
|
|
230610
|
-
const
|
|
230611
|
-
let
|
|
230612
|
-
|
|
230613
|
-
|
|
230614
|
-
|
|
230615
|
-
|
|
230616
|
-
|
|
230617
|
-
|
|
230618
|
-
|
|
230619
|
-
|
|
230620
|
-
|
|
230621
|
-
|
|
230622
|
-
|
|
230623
|
-
|
|
230624
|
-
|
|
230625
|
-
searchDirectories = [searchDirAbsolute];
|
|
230626
|
-
} else {
|
|
230627
|
-
searchDirectories = workspaceDirectories;
|
|
230628
|
-
}
|
|
230629
|
-
const fileDiscovery = this.config.getFileService();
|
|
230630
|
-
const allEntries = [];
|
|
230631
|
-
for (const searchDir of searchDirectories) {
|
|
230632
|
-
let pattern = this.params.pattern;
|
|
230633
|
-
const fullPath = path35.join(searchDir, pattern);
|
|
230634
|
-
if (fs32.existsSync(fullPath)) {
|
|
230635
|
-
pattern = escape3(pattern);
|
|
230636
|
-
}
|
|
230637
|
-
const entries = await glob(pattern, {
|
|
230638
|
-
cwd: searchDir,
|
|
230639
|
-
withFileTypes: true,
|
|
230640
|
-
nodir: true,
|
|
230641
|
-
stat: true,
|
|
230642
|
-
nocase: !this.params.case_sensitive,
|
|
230643
|
-
dot: true,
|
|
230644
|
-
ignore: this.config.getFileExclusions().getGlobExcludes(),
|
|
230645
|
-
follow: false,
|
|
230646
|
-
signal
|
|
230647
|
-
});
|
|
230648
|
-
allEntries.push(...entries);
|
|
230649
|
-
}
|
|
230650
|
-
const relativePaths = allEntries.map((p) => path35.relative(this.config.getTargetDir(), p.fullpath()));
|
|
230651
|
-
const { filteredPaths, gitIgnoredCount, qwenIgnoredCount } = fileDiscovery.filterFilesWithReport(relativePaths, {
|
|
230652
|
-
respectGitIgnore: this.params?.respect_git_ignore ?? this.config.getFileFilteringOptions().respectGitIgnore ?? DEFAULT_FILE_FILTERING_OPTIONS.respectGitIgnore,
|
|
230653
|
-
respectQwenIgnore: this.params?.respect_qwen_ignore ?? this.config.getFileFilteringOptions().respectQwenIgnore ?? DEFAULT_FILE_FILTERING_OPTIONS.respectQwenIgnore
|
|
230621
|
+
const searchDirAbs = resolveAndValidatePath(this.config, this.params.path);
|
|
230622
|
+
const searchLocationDescription = this.params.path ? `within ${searchDirAbs}` : `in the workspace directory`;
|
|
230623
|
+
let pattern = this.params.pattern;
|
|
230624
|
+
const fullPath = path35.join(searchDirAbs, pattern);
|
|
230625
|
+
if (fs33.existsSync(fullPath)) {
|
|
230626
|
+
pattern = escape3(pattern);
|
|
230627
|
+
}
|
|
230628
|
+
const allEntries = await glob(pattern, {
|
|
230629
|
+
cwd: searchDirAbs,
|
|
230630
|
+
withFileTypes: true,
|
|
230631
|
+
nodir: true,
|
|
230632
|
+
stat: true,
|
|
230633
|
+
nocase: true,
|
|
230634
|
+
dot: true,
|
|
230635
|
+
follow: false,
|
|
230636
|
+
signal
|
|
230654
230637
|
});
|
|
230638
|
+
const relativePaths = allEntries.map((p) => path35.relative(this.config.getTargetDir(), p.fullpath()));
|
|
230639
|
+
const { filteredPaths } = this.fileService.filterFilesWithReport(relativePaths, this.getFileFilteringOptions());
|
|
230655
230640
|
const filteredAbsolutePaths = new Set(filteredPaths.map((p) => path35.resolve(this.config.getTargetDir(), p)));
|
|
230656
230641
|
const filteredEntries = allEntries.filter((entry) => filteredAbsolutePaths.has(entry.fullpath()));
|
|
230657
230642
|
if (!filteredEntries || filteredEntries.length === 0) {
|
|
230658
|
-
let message = `No files found matching pattern "${this.params.pattern}"`;
|
|
230659
|
-
if (searchDirectories.length === 1) {
|
|
230660
|
-
message += ` within ${searchDirectories[0]}`;
|
|
230661
|
-
} else {
|
|
230662
|
-
message += ` within ${searchDirectories.length} workspace directories`;
|
|
230663
|
-
}
|
|
230664
|
-
if (gitIgnoredCount > 0) {
|
|
230665
|
-
message += ` (${gitIgnoredCount} files were git-ignored)`;
|
|
230666
|
-
}
|
|
230667
|
-
if (qwenIgnoredCount > 0) {
|
|
230668
|
-
message += ` (${qwenIgnoredCount} files were qwen-ignored)`;
|
|
230669
|
-
}
|
|
230670
230643
|
return {
|
|
230671
|
-
llmContent:
|
|
230644
|
+
llmContent: `No files found matching pattern "${this.params.pattern}" ${searchLocationDescription}`,
|
|
230672
230645
|
returnDisplay: `No files found`
|
|
230673
230646
|
};
|
|
230674
230647
|
}
|
|
230675
230648
|
const oneDayInMs = 24 * 60 * 60 * 1e3;
|
|
230676
230649
|
const nowTimestamp = (/* @__PURE__ */ new Date()).getTime();
|
|
230677
230650
|
const sortedEntries = sortFileEntries(filteredEntries, nowTimestamp, oneDayInMs);
|
|
230678
|
-
const
|
|
230651
|
+
const totalFileCount = sortedEntries.length;
|
|
230652
|
+
const fileLimit = Math.min(MAX_FILE_COUNT, this.config.getTruncateToolOutputLines());
|
|
230653
|
+
const truncated = totalFileCount > fileLimit;
|
|
230654
|
+
const entriesToShow = truncated ? sortedEntries.slice(0, fileLimit) : sortedEntries;
|
|
230655
|
+
const sortedAbsolutePaths = entriesToShow.map((entry) => entry.fullpath());
|
|
230679
230656
|
const fileListDescription = sortedAbsolutePaths.join("\n");
|
|
230680
|
-
|
|
230681
|
-
let resultMessage = `Found ${fileCount} file(s) matching "${this.params.pattern}"`;
|
|
230682
|
-
if (searchDirectories.length === 1) {
|
|
230683
|
-
resultMessage += ` within ${searchDirectories[0]}`;
|
|
230684
|
-
} else {
|
|
230685
|
-
resultMessage += ` across ${searchDirectories.length} workspace directories`;
|
|
230686
|
-
}
|
|
230687
|
-
if (gitIgnoredCount > 0) {
|
|
230688
|
-
resultMessage += ` (${gitIgnoredCount} additional files were git-ignored)`;
|
|
230689
|
-
}
|
|
230690
|
-
if (qwenIgnoredCount > 0) {
|
|
230691
|
-
resultMessage += ` (${qwenIgnoredCount} additional files were qwen-ignored)`;
|
|
230692
|
-
}
|
|
230657
|
+
let resultMessage = `Found ${totalFileCount} file(s) matching "${this.params.pattern}" ${searchLocationDescription}`;
|
|
230693
230658
|
resultMessage += `, sorted by modification time (newest first):
|
|
230659
|
+
---
|
|
230694
230660
|
${fileListDescription}`;
|
|
230661
|
+
if (truncated) {
|
|
230662
|
+
const omittedFiles = totalFileCount - fileLimit;
|
|
230663
|
+
const fileTerm = omittedFiles === 1 ? "file" : "files";
|
|
230664
|
+
resultMessage += `
|
|
230665
|
+
---
|
|
230666
|
+
[${omittedFiles} ${fileTerm} truncated] ...`;
|
|
230667
|
+
}
|
|
230695
230668
|
return {
|
|
230696
230669
|
llmContent: resultMessage,
|
|
230697
|
-
returnDisplay: `Found ${
|
|
230670
|
+
returnDisplay: `Found ${totalFileCount} matching file(s)${truncated ? " (truncated)" : ""}`
|
|
230698
230671
|
};
|
|
230699
230672
|
} catch (error) {
|
|
230700
230673
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -230702,7 +230675,7 @@ ${fileListDescription}`;
|
|
|
230702
230675
|
const rawError = `Error during glob search operation: ${errorMessage}`;
|
|
230703
230676
|
return {
|
|
230704
230677
|
llmContent: rawError,
|
|
230705
|
-
returnDisplay: `Error: An unexpected error occurred
|
|
230678
|
+
returnDisplay: `Error: ${errorMessage || "An unexpected error occurred."}`,
|
|
230706
230679
|
error: {
|
|
230707
230680
|
message: rawError,
|
|
230708
230681
|
type: ToolErrorType.GLOB_EXECUTION_ERROR
|
|
@@ -230710,6 +230683,13 @@ ${fileListDescription}`;
|
|
|
230710
230683
|
};
|
|
230711
230684
|
}
|
|
230712
230685
|
}
|
|
230686
|
+
getFileFilteringOptions() {
|
|
230687
|
+
const options2 = this.config.getFileFilteringOptions?.();
|
|
230688
|
+
return {
|
|
230689
|
+
respectGitIgnore: options2?.respectGitIgnore ?? DEFAULT_FILE_FILTERING_OPTIONS.respectGitIgnore,
|
|
230690
|
+
respectQwenIgnore: options2?.respectQwenIgnore ?? DEFAULT_FILE_FILTERING_OPTIONS.respectQwenIgnore
|
|
230691
|
+
};
|
|
230692
|
+
}
|
|
230713
230693
|
};
|
|
230714
230694
|
GlobTool = class _GlobTool extends BaseDeclarativeTool {
|
|
230715
230695
|
static {
|
|
@@ -230718,27 +230698,15 @@ ${fileListDescription}`;
|
|
|
230718
230698
|
config;
|
|
230719
230699
|
static Name = ToolNames.GLOB;
|
|
230720
230700
|
constructor(config) {
|
|
230721
|
-
super(_GlobTool.Name, "FindFiles",
|
|
230701
|
+
super(_GlobTool.Name, "FindFiles", 'Fast file pattern matching tool that works with any codebase size\n- Supports glob patterns like "**/*.js" or "src/**/*.ts"\n- Returns matching file paths sorted by modification time\n- Use this tool when you need to find files by name patterns\n- When you are doing an open ended search that may require multiple rounds of globbing and grepping, use the Agent tool instead\n- You have the capability to call multiple tools in a single response. It is always better to speculatively perform multiple searches as a batch that are potentially useful.', Kind.Search, {
|
|
230722
230702
|
properties: {
|
|
230723
230703
|
pattern: {
|
|
230724
|
-
description: "The glob pattern to match against
|
|
230704
|
+
description: "The glob pattern to match files against",
|
|
230725
230705
|
type: "string"
|
|
230726
230706
|
},
|
|
230727
230707
|
path: {
|
|
230728
|
-
description:
|
|
230708
|
+
description: 'The directory to search in. If not specified, the current working directory will be used. IMPORTANT: Omit this field to use the default directory. DO NOT enter "undefined" or "null" - simply omit it for the default behavior. Must be a valid directory path if provided.',
|
|
230729
230709
|
type: "string"
|
|
230730
|
-
},
|
|
230731
|
-
case_sensitive: {
|
|
230732
|
-
description: "Optional: Whether the search should be case-sensitive. Defaults to false.",
|
|
230733
|
-
type: "boolean"
|
|
230734
|
-
},
|
|
230735
|
-
respect_git_ignore: {
|
|
230736
|
-
description: "Optional: Whether to respect .gitignore patterns when finding files. Only available in git repositories. Defaults to true.",
|
|
230737
|
-
type: "boolean"
|
|
230738
|
-
},
|
|
230739
|
-
respect_qwen_ignore: {
|
|
230740
|
-
description: "Optional: Whether to respect .qwenignore patterns when finding files. Defaults to true.",
|
|
230741
|
-
type: "boolean"
|
|
230742
230710
|
}
|
|
230743
230711
|
},
|
|
230744
230712
|
required: ["pattern"],
|
|
@@ -230750,26 +230718,16 @@ ${fileListDescription}`;
|
|
|
230750
230718
|
* Validates the parameters for the tool.
|
|
230751
230719
|
*/
|
|
230752
230720
|
validateToolParamValues(params) {
|
|
230753
|
-
const searchDirAbsolute = path35.resolve(this.config.getTargetDir(), params.path || ".");
|
|
230754
|
-
const workspaceContext = this.config.getWorkspaceContext();
|
|
230755
|
-
if (!workspaceContext.isPathWithinWorkspace(searchDirAbsolute)) {
|
|
230756
|
-
const directories = workspaceContext.getDirectories();
|
|
230757
|
-
return `Search path ("${searchDirAbsolute}") resolves outside the allowed workspace directories: ${directories.join(", ")}`;
|
|
230758
|
-
}
|
|
230759
|
-
const targetDir = searchDirAbsolute || this.config.getTargetDir();
|
|
230760
|
-
try {
|
|
230761
|
-
if (!fs32.existsSync(targetDir)) {
|
|
230762
|
-
return `Search path does not exist ${targetDir}`;
|
|
230763
|
-
}
|
|
230764
|
-
if (!fs32.statSync(targetDir).isDirectory()) {
|
|
230765
|
-
return `Search path is not a directory: ${targetDir}`;
|
|
230766
|
-
}
|
|
230767
|
-
} catch (e2) {
|
|
230768
|
-
return `Error accessing search path: ${e2}`;
|
|
230769
|
-
}
|
|
230770
230721
|
if (!params.pattern || typeof params.pattern !== "string" || params.pattern.trim() === "") {
|
|
230771
230722
|
return "The 'pattern' parameter cannot be empty.";
|
|
230772
230723
|
}
|
|
230724
|
+
if (params.path) {
|
|
230725
|
+
try {
|
|
230726
|
+
resolveAndValidatePath(this.config, params.path);
|
|
230727
|
+
} catch (error) {
|
|
230728
|
+
return getErrorMessage(error);
|
|
230729
|
+
}
|
|
230730
|
+
}
|
|
230773
230731
|
return null;
|
|
230774
230732
|
}
|
|
230775
230733
|
createInvocation(params) {
|
|
@@ -230780,7 +230738,6 @@ ${fileListDescription}`;
|
|
|
230780
230738
|
});
|
|
230781
230739
|
|
|
230782
230740
|
// packages/core/dist/src/tools/grep.js
|
|
230783
|
-
import fs33 from "node:fs";
|
|
230784
230741
|
import fsPromises2 from "node:fs/promises";
|
|
230785
230742
|
import path36 from "node:path";
|
|
230786
230743
|
import { EOL as EOL2 } from "node:os";
|
|
@@ -230808,89 +230765,36 @@ var init_grep2 = __esm({
|
|
|
230808
230765
|
this.config = config;
|
|
230809
230766
|
this.fileExclusions = config.getFileExclusions();
|
|
230810
230767
|
}
|
|
230811
|
-
/**
|
|
230812
|
-
* Checks if a path is within the root directory and resolves it.
|
|
230813
|
-
* @param relativePath Path relative to the root directory (or undefined for root).
|
|
230814
|
-
* @returns The absolute path if valid and exists, or null if no path specified (to search all directories).
|
|
230815
|
-
* @throws {Error} If path is outside root, doesn't exist, or isn't a directory.
|
|
230816
|
-
*/
|
|
230817
|
-
resolveAndValidatePath(relativePath) {
|
|
230818
|
-
if (!relativePath) {
|
|
230819
|
-
return null;
|
|
230820
|
-
}
|
|
230821
|
-
const targetPath = path36.resolve(this.config.getTargetDir(), relativePath);
|
|
230822
|
-
const workspaceContext = this.config.getWorkspaceContext();
|
|
230823
|
-
if (!workspaceContext.isPathWithinWorkspace(targetPath)) {
|
|
230824
|
-
const directories = workspaceContext.getDirectories();
|
|
230825
|
-
throw new Error(`Path validation failed: Attempted path "${relativePath}" resolves outside the allowed workspace directories: ${directories.join(", ")}`);
|
|
230826
|
-
}
|
|
230827
|
-
try {
|
|
230828
|
-
const stats = fs33.statSync(targetPath);
|
|
230829
|
-
if (!stats.isDirectory()) {
|
|
230830
|
-
throw new Error(`Path is not a directory: ${targetPath}`);
|
|
230831
|
-
}
|
|
230832
|
-
} catch (error) {
|
|
230833
|
-
if (isNodeError(error) && error.code !== "ENOENT") {
|
|
230834
|
-
throw new Error(`Path does not exist: ${targetPath}`);
|
|
230835
|
-
}
|
|
230836
|
-
throw new Error(`Failed to access path stats for ${targetPath}: ${error}`);
|
|
230837
|
-
}
|
|
230838
|
-
return targetPath;
|
|
230839
|
-
}
|
|
230840
230768
|
async execute(signal) {
|
|
230841
230769
|
try {
|
|
230842
|
-
const
|
|
230843
|
-
const searchDirAbs = this.resolveAndValidatePath(this.params.path);
|
|
230770
|
+
const searchDirAbs = resolveAndValidatePath(this.config, this.params.path);
|
|
230844
230771
|
const searchDirDisplay = this.params.path || ".";
|
|
230845
|
-
|
|
230846
|
-
|
|
230847
|
-
|
|
230848
|
-
|
|
230849
|
-
|
|
230850
|
-
}
|
|
230851
|
-
|
|
230852
|
-
const
|
|
230853
|
-
|
|
230854
|
-
|
|
230855
|
-
for (const searchDir of searchDirectories) {
|
|
230856
|
-
const matches = await this.performGrepSearch({
|
|
230857
|
-
pattern: this.params.pattern,
|
|
230858
|
-
path: searchDir,
|
|
230859
|
-
include: this.params.include,
|
|
230860
|
-
signal
|
|
230861
|
-
});
|
|
230862
|
-
totalMatchesFound += matches.length;
|
|
230863
|
-
if (searchDirectories.length > 1) {
|
|
230864
|
-
const dirName = path36.basename(searchDir);
|
|
230865
|
-
matches.forEach((match2) => {
|
|
230866
|
-
match2.filePath = path36.join(dirName, match2.filePath);
|
|
230867
|
-
});
|
|
230868
|
-
}
|
|
230869
|
-
const remainingSlots = maxResults - allMatches.length;
|
|
230870
|
-
if (remainingSlots <= 0) {
|
|
230871
|
-
searchTruncated = true;
|
|
230872
|
-
break;
|
|
230873
|
-
}
|
|
230874
|
-
if (matches.length > remainingSlots) {
|
|
230875
|
-
allMatches = allMatches.concat(matches.slice(0, remainingSlots));
|
|
230876
|
-
searchTruncated = true;
|
|
230877
|
-
break;
|
|
230878
|
-
} else {
|
|
230879
|
-
allMatches = allMatches.concat(matches);
|
|
230880
|
-
}
|
|
230881
|
-
}
|
|
230882
|
-
let searchLocationDescription;
|
|
230883
|
-
if (searchDirAbs === null) {
|
|
230884
|
-
const numDirs = workspaceContext.getDirectories().length;
|
|
230885
|
-
searchLocationDescription = numDirs > 1 ? `across ${numDirs} workspace directories` : `in the workspace directory`;
|
|
230886
|
-
} else {
|
|
230887
|
-
searchLocationDescription = `in path "${searchDirDisplay}"`;
|
|
230888
|
-
}
|
|
230889
|
-
if (allMatches.length === 0) {
|
|
230890
|
-
const noMatchMsg = `No matches found for pattern "${this.params.pattern}" ${searchLocationDescription}${this.params.include ? ` (filter: "${this.params.include}")` : ""}.`;
|
|
230772
|
+
const rawMatches = await this.performGrepSearch({
|
|
230773
|
+
pattern: this.params.pattern,
|
|
230774
|
+
path: searchDirAbs,
|
|
230775
|
+
glob: this.params.glob,
|
|
230776
|
+
signal
|
|
230777
|
+
});
|
|
230778
|
+
const searchLocationDescription = this.params.path ? `in path "${searchDirDisplay}"` : `in the workspace directory`;
|
|
230779
|
+
const filterDescription = this.params.glob ? ` (filter: "${this.params.glob}")` : "";
|
|
230780
|
+
if (rawMatches.length === 0) {
|
|
230781
|
+
const noMatchMsg = `No matches found for pattern "${this.params.pattern}" ${searchLocationDescription}${filterDescription}.`;
|
|
230891
230782
|
return { llmContent: noMatchMsg, returnDisplay: `No matches found` };
|
|
230892
230783
|
}
|
|
230893
|
-
const
|
|
230784
|
+
const charLimit = this.config.getTruncateToolOutputThreshold();
|
|
230785
|
+
const lineLimit = Math.min(this.config.getTruncateToolOutputLines(), this.params.limit ?? Number.POSITIVE_INFINITY);
|
|
230786
|
+
let truncatedByLineLimit = false;
|
|
230787
|
+
let matchesToInclude = rawMatches;
|
|
230788
|
+
if (rawMatches.length > lineLimit) {
|
|
230789
|
+
matchesToInclude = rawMatches.slice(0, lineLimit);
|
|
230790
|
+
truncatedByLineLimit = true;
|
|
230791
|
+
}
|
|
230792
|
+
const totalMatches = rawMatches.length;
|
|
230793
|
+
const matchTerm = totalMatches === 1 ? "match" : "matches";
|
|
230794
|
+
const header = `Found ${totalMatches} ${matchTerm} for pattern "${this.params.pattern}" ${searchLocationDescription}${filterDescription}:
|
|
230795
|
+
---
|
|
230796
|
+
`;
|
|
230797
|
+
const matchesByFile = matchesToInclude.reduce((acc, match2) => {
|
|
230894
230798
|
const fileKey = match2.filePath;
|
|
230895
230799
|
if (!acc[fileKey]) {
|
|
230896
230800
|
acc[fileKey] = [];
|
|
@@ -230899,40 +230803,36 @@ var init_grep2 = __esm({
|
|
|
230899
230803
|
acc[fileKey].sort((a, b) => a.lineNumber - b.lineNumber);
|
|
230900
230804
|
return acc;
|
|
230901
230805
|
}, {});
|
|
230902
|
-
|
|
230903
|
-
const matchTerm = matchCount === 1 ? "match" : "matches";
|
|
230904
|
-
let headerText = `Found ${matchCount} ${matchTerm} for pattern "${this.params.pattern}" ${searchLocationDescription}${this.params.include ? ` (filter: "${this.params.include}")` : ""}`;
|
|
230905
|
-
if (searchTruncated) {
|
|
230906
|
-
headerText += ` (showing first ${matchCount} of ${totalMatchesFound}+ total matches)`;
|
|
230907
|
-
}
|
|
230908
|
-
let llmContent = `${headerText}:
|
|
230909
|
-
---
|
|
230910
|
-
`;
|
|
230806
|
+
let grepOutput = "";
|
|
230911
230807
|
for (const filePath in matchesByFile) {
|
|
230912
|
-
|
|
230808
|
+
grepOutput += `File: ${filePath}
|
|
230913
230809
|
`;
|
|
230914
230810
|
matchesByFile[filePath].forEach((match2) => {
|
|
230915
230811
|
const trimmedLine = match2.line.trim();
|
|
230916
|
-
|
|
230812
|
+
grepOutput += `L${match2.lineNumber}: ${trimmedLine}
|
|
230917
230813
|
`;
|
|
230918
230814
|
});
|
|
230919
|
-
|
|
230815
|
+
grepOutput += "---\n";
|
|
230920
230816
|
}
|
|
230921
|
-
|
|
230922
|
-
|
|
230923
|
-
|
|
230924
|
-
|
|
230925
|
-
- Add file filters with the 'include' parameter (e.g., "*.js", "src/**")
|
|
230926
|
-
- Specify a narrower 'path' to search in a subdirectory
|
|
230927
|
-
- Increase 'maxResults' parameter if you need more matches (current: ${maxResults})`;
|
|
230817
|
+
let truncatedByCharLimit = false;
|
|
230818
|
+
if (Number.isFinite(charLimit) && grepOutput.length > charLimit) {
|
|
230819
|
+
grepOutput = grepOutput.slice(0, charLimit) + "...";
|
|
230820
|
+
truncatedByCharLimit = true;
|
|
230928
230821
|
}
|
|
230929
|
-
|
|
230930
|
-
|
|
230931
|
-
|
|
230822
|
+
const finalLines = grepOutput.split("\n").filter((line) => line.trim() && !line.startsWith("File:") && !line.startsWith("---"));
|
|
230823
|
+
const includedLines = finalLines.length;
|
|
230824
|
+
let llmContent = header + grepOutput;
|
|
230825
|
+
if (truncatedByLineLimit || truncatedByCharLimit) {
|
|
230826
|
+
const omittedMatches = totalMatches - includedLines;
|
|
230827
|
+
llmContent += ` [${omittedMatches} ${omittedMatches === 1 ? "line" : "lines"} truncated] ...`;
|
|
230828
|
+
}
|
|
230829
|
+
let displayMessage = `Found ${totalMatches} ${matchTerm}`;
|
|
230830
|
+
if (truncatedByLineLimit || truncatedByCharLimit) {
|
|
230831
|
+
displayMessage += ` (truncated)`;
|
|
230932
230832
|
}
|
|
230933
230833
|
return {
|
|
230934
230834
|
llmContent: llmContent.trim(),
|
|
230935
|
-
returnDisplay:
|
|
230835
|
+
returnDisplay: displayMessage
|
|
230936
230836
|
};
|
|
230937
230837
|
} catch (error) {
|
|
230938
230838
|
console.error(`Error during GrepLogic execution: ${error}`);
|
|
@@ -231011,34 +230911,19 @@ WARNING: Results truncated to prevent context overflow. To see more results:
|
|
|
231011
230911
|
* @returns A string describing the grep
|
|
231012
230912
|
*/
|
|
231013
230913
|
getDescription() {
|
|
231014
|
-
let description = `'${this.params.pattern}'`;
|
|
231015
|
-
if (this.params.
|
|
231016
|
-
description += `
|
|
231017
|
-
}
|
|
231018
|
-
if (this.params.path) {
|
|
231019
|
-
const resolvedPath = path36.resolve(this.config.getTargetDir(), this.params.path);
|
|
231020
|
-
if (resolvedPath === this.config.getTargetDir() || this.params.path === ".") {
|
|
231021
|
-
description += ` within ./`;
|
|
231022
|
-
} else {
|
|
231023
|
-
const relativePath = makeRelative(resolvedPath, this.config.getTargetDir());
|
|
231024
|
-
description += ` within ${shortenPath(relativePath)}`;
|
|
231025
|
-
}
|
|
231026
|
-
} else {
|
|
231027
|
-
const workspaceContext = this.config.getWorkspaceContext();
|
|
231028
|
-
const directories = workspaceContext.getDirectories();
|
|
231029
|
-
if (directories.length > 1) {
|
|
231030
|
-
description += ` across all workspace directories`;
|
|
231031
|
-
}
|
|
230914
|
+
let description = `'${this.params.pattern}' in path '${this.params.path || "./"}'`;
|
|
230915
|
+
if (this.params.glob) {
|
|
230916
|
+
description += ` (filter: '${this.params.glob}')`;
|
|
231032
230917
|
}
|
|
231033
230918
|
return description;
|
|
231034
230919
|
}
|
|
231035
230920
|
/**
|
|
231036
230921
|
* Performs the actual search using the prioritized strategies.
|
|
231037
|
-
* @param options Search options including pattern, absolute path, and
|
|
230922
|
+
* @param options Search options including pattern, absolute path, and glob filter.
|
|
231038
230923
|
* @returns A promise resolving to an array of match objects.
|
|
231039
230924
|
*/
|
|
231040
230925
|
async performGrepSearch(options2) {
|
|
231041
|
-
const { pattern, path: absolutePath,
|
|
230926
|
+
const { pattern, path: absolutePath, glob: glob2 } = options2;
|
|
231042
230927
|
let strategyUsed = "none";
|
|
231043
230928
|
try {
|
|
231044
230929
|
const isGit = isGitRepository(absolutePath);
|
|
@@ -231053,8 +230938,8 @@ WARNING: Results truncated to prevent context overflow. To see more results:
|
|
|
231053
230938
|
"--ignore-case",
|
|
231054
230939
|
pattern
|
|
231055
230940
|
];
|
|
231056
|
-
if (
|
|
231057
|
-
gitArgs.push("--",
|
|
230941
|
+
if (glob2) {
|
|
230942
|
+
gitArgs.push("--", glob2);
|
|
231058
230943
|
}
|
|
231059
230944
|
try {
|
|
231060
230945
|
const output = await new Promise((resolve24, reject) => {
|
|
@@ -231104,8 +230989,8 @@ WARNING: Results truncated to prevent context overflow. To see more results:
|
|
|
231104
230989
|
return null;
|
|
231105
230990
|
}).filter((dir) => !!dir);
|
|
231106
230991
|
commonExcludes.forEach((dir) => grepArgs.push(`--exclude-dir=${dir}`));
|
|
231107
|
-
if (
|
|
231108
|
-
grepArgs.push(`--include=${
|
|
230992
|
+
if (glob2) {
|
|
230993
|
+
grepArgs.push(`--include=${glob2}`);
|
|
231109
230994
|
}
|
|
231110
230995
|
grepArgs.push(pattern);
|
|
231111
230996
|
grepArgs.push(".");
|
|
@@ -231164,7 +231049,7 @@ WARNING: Results truncated to prevent context overflow. To see more results:
|
|
|
231164
231049
|
}
|
|
231165
231050
|
console.debug("GrepLogic: Falling back to JavaScript grep implementation.");
|
|
231166
231051
|
strategyUsed = "javascript fallback";
|
|
231167
|
-
const globPattern =
|
|
231052
|
+
const globPattern = glob2 ? glob2 : "**/*";
|
|
231168
231053
|
const ignorePatterns = this.fileExclusions.getGlobExcludes();
|
|
231169
231054
|
const filesIterator = globStream(globPattern, {
|
|
231170
231055
|
cwd: absolutePath,
|
|
@@ -231210,25 +231095,23 @@ WARNING: Results truncated to prevent context overflow. To see more results:
|
|
|
231210
231095
|
config;
|
|
231211
231096
|
static Name = ToolNames.GREP;
|
|
231212
231097
|
constructor(config) {
|
|
231213
|
-
super(_GrepTool.Name, "
|
|
231098
|
+
super(_GrepTool.Name, "Grep", 'A powerful search tool for finding patterns in files\n\n Usage:\n - ALWAYS use Grep for search tasks. NEVER invoke `grep` or `rg` as a Bash command. The Grep tool has been optimized for correct permissions and access.\n - Supports full regex syntax (e.g., "log.*Error", "function\\s+\\w+")\n - Filter files with glob parameter (e.g., "*.js", "**/*.tsx")\n - Case-insensitive by default\n - Use Task tool for open-ended searches requiring multiple rounds\n', Kind.Search, {
|
|
231214
231099
|
properties: {
|
|
231215
231100
|
pattern: {
|
|
231216
|
-
|
|
231217
|
-
|
|
231101
|
+
type: "string",
|
|
231102
|
+
description: "The regular expression pattern to search for in file contents"
|
|
231218
231103
|
},
|
|
231219
|
-
|
|
231220
|
-
|
|
231221
|
-
|
|
231104
|
+
glob: {
|
|
231105
|
+
type: "string",
|
|
231106
|
+
description: 'Glob pattern to filter files (e.g. "*.js", "*.{ts,tsx}")'
|
|
231222
231107
|
},
|
|
231223
|
-
|
|
231224
|
-
|
|
231225
|
-
|
|
231108
|
+
path: {
|
|
231109
|
+
type: "string",
|
|
231110
|
+
description: "File or directory to search in. Defaults to current working directory."
|
|
231226
231111
|
},
|
|
231227
|
-
|
|
231228
|
-
description: "Optional: Maximum number of matches to return to prevent context overflow (default: 20, max: 100). Use lower values for broad searches, higher for specific searches.",
|
|
231112
|
+
limit: {
|
|
231229
231113
|
type: "number",
|
|
231230
|
-
|
|
231231
|
-
maximum: 100
|
|
231114
|
+
description: "Limit output to first N matching lines. Optional - shows all matches if not specified."
|
|
231232
231115
|
}
|
|
231233
231116
|
},
|
|
231234
231117
|
required: ["pattern"],
|
|
@@ -231236,35 +231119,6 @@ WARNING: Results truncated to prevent context overflow. To see more results:
|
|
|
231236
231119
|
});
|
|
231237
231120
|
this.config = config;
|
|
231238
231121
|
}
|
|
231239
|
-
/**
|
|
231240
|
-
* Checks if a path is within the root directory and resolves it.
|
|
231241
|
-
* @param relativePath Path relative to the root directory (or undefined for root).
|
|
231242
|
-
* @returns The absolute path if valid and exists, or null if no path specified (to search all directories).
|
|
231243
|
-
* @throws {Error} If path is outside root, doesn't exist, or isn't a directory.
|
|
231244
|
-
*/
|
|
231245
|
-
resolveAndValidatePath(relativePath) {
|
|
231246
|
-
if (!relativePath) {
|
|
231247
|
-
return null;
|
|
231248
|
-
}
|
|
231249
|
-
const targetPath = path36.resolve(this.config.getTargetDir(), relativePath);
|
|
231250
|
-
const workspaceContext = this.config.getWorkspaceContext();
|
|
231251
|
-
if (!workspaceContext.isPathWithinWorkspace(targetPath)) {
|
|
231252
|
-
const directories = workspaceContext.getDirectories();
|
|
231253
|
-
throw new Error(`Path validation failed: Attempted path "${relativePath}" resolves outside the allowed workspace directories: ${directories.join(", ")}`);
|
|
231254
|
-
}
|
|
231255
|
-
try {
|
|
231256
|
-
const stats = fs33.statSync(targetPath);
|
|
231257
|
-
if (!stats.isDirectory()) {
|
|
231258
|
-
throw new Error(`Path is not a directory: ${targetPath}`);
|
|
231259
|
-
}
|
|
231260
|
-
} catch (error) {
|
|
231261
|
-
if (isNodeError(error) && error.code !== "ENOENT") {
|
|
231262
|
-
throw new Error(`Path does not exist: ${targetPath}`);
|
|
231263
|
-
}
|
|
231264
|
-
throw new Error(`Failed to access path stats for ${targetPath}: ${error}`);
|
|
231265
|
-
}
|
|
231266
|
-
return targetPath;
|
|
231267
|
-
}
|
|
231268
231122
|
/**
|
|
231269
231123
|
* Validates the parameters for the tool
|
|
231270
231124
|
* @param params Parameters to validate
|
|
@@ -231274,16 +231128,11 @@ WARNING: Results truncated to prevent context overflow. To see more results:
|
|
|
231274
231128
|
try {
|
|
231275
231129
|
new RegExp(params.pattern);
|
|
231276
231130
|
} catch (error) {
|
|
231277
|
-
return `Invalid regular expression pattern
|
|
231278
|
-
}
|
|
231279
|
-
if (params.maxResults !== void 0) {
|
|
231280
|
-
if (!Number.isInteger(params.maxResults) || params.maxResults < 1 || params.maxResults > 100) {
|
|
231281
|
-
return `maxResults must be an integer between 1 and 100, got: ${params.maxResults}`;
|
|
231282
|
-
}
|
|
231131
|
+
return `Invalid regular expression pattern: ${params.pattern}. Error: ${getErrorMessage(error)}`;
|
|
231283
231132
|
}
|
|
231284
231133
|
if (params.path) {
|
|
231285
231134
|
try {
|
|
231286
|
-
this.
|
|
231135
|
+
resolveAndValidatePath(this.config, params.path);
|
|
231287
231136
|
} catch (error) {
|
|
231288
231137
|
return getErrorMessage(error);
|
|
231289
231138
|
}
|
|
@@ -231642,7 +231491,8 @@ ${getErrorMessage(error)}
|
|
|
231642
231491
|
};
|
|
231643
231492
|
}
|
|
231644
231493
|
const sortedFiles = Array.from(filesToConsider).sort();
|
|
231645
|
-
const
|
|
231494
|
+
const truncateToolOutputLines = this.config.getTruncateToolOutputLines();
|
|
231495
|
+
const file_line_limit = Number.isFinite(truncateToolOutputLines) ? Math.floor(truncateToolOutputLines / Math.max(1, sortedFiles.length)) : void 0;
|
|
231646
231496
|
const fileProcessingPromises = sortedFiles.map(async (filePath) => {
|
|
231647
231497
|
try {
|
|
231648
231498
|
const relativePathForDisplay = path38.relative(this.config.getTargetDir(), filePath).replace(/\\/g, "/");
|
|
@@ -231660,7 +231510,7 @@ ${getErrorMessage(error)}
|
|
|
231660
231510
|
};
|
|
231661
231511
|
}
|
|
231662
231512
|
}
|
|
231663
|
-
const fileReadResult = await processSingleFileContent(filePath, this.config
|
|
231513
|
+
const fileReadResult = await processSingleFileContent(filePath, this.config, 0, file_line_limit);
|
|
231664
231514
|
if (fileReadResult.error) {
|
|
231665
231515
|
return {
|
|
231666
231516
|
success: false,
|
|
@@ -231700,11 +231550,14 @@ ${getErrorMessage(error)}
|
|
|
231700
231550
|
const separator = DEFAULT_OUTPUT_SEPARATOR_FORMAT.replace("{filePath}", filePath);
|
|
231701
231551
|
let fileContentForLlm = "";
|
|
231702
231552
|
if (fileReadResult.isTruncated) {
|
|
231703
|
-
|
|
231704
|
-
|
|
231705
|
-
|
|
231553
|
+
const [start, end] = fileReadResult.linesShown;
|
|
231554
|
+
const total = fileReadResult.originalLineCount;
|
|
231555
|
+
fileContentForLlm = `Showing lines ${start}-${end} of ${total} total lines.
|
|
231556
|
+
---
|
|
231557
|
+
${fileReadResult.llmContent}`;
|
|
231558
|
+
} else {
|
|
231559
|
+
fileContentForLlm = fileReadResult.llmContent;
|
|
231706
231560
|
}
|
|
231707
|
-
fileContentForLlm += fileReadResult.llmContent;
|
|
231708
231561
|
contentParts.push(`${separator}
|
|
231709
231562
|
|
|
231710
231563
|
${fileContentForLlm}
|
|
@@ -231944,7 +231797,7 @@ import fs36 from "node:fs";
|
|
|
231944
231797
|
import path40 from "node:path";
|
|
231945
231798
|
import { EOL as EOL3 } from "node:os";
|
|
231946
231799
|
import { spawn as spawn6 } from "node:child_process";
|
|
231947
|
-
var
|
|
231800
|
+
var GrepToolInvocation2, RipGrepTool;
|
|
231948
231801
|
var init_ripGrep = __esm({
|
|
231949
231802
|
"packages/core/dist/src/tools/ripGrep.js"() {
|
|
231950
231803
|
"use strict";
|
|
@@ -231956,7 +231809,6 @@ var init_ripGrep = __esm({
|
|
|
231956
231809
|
init_ripgrepUtils();
|
|
231957
231810
|
init_schemaValidator();
|
|
231958
231811
|
init_constants3();
|
|
231959
|
-
MAX_LLM_CONTENT_LENGTH = 2e4;
|
|
231960
231812
|
GrepToolInvocation2 = class extends BaseToolInvocation {
|
|
231961
231813
|
static {
|
|
231962
231814
|
__name(this, "GrepToolInvocation");
|
|
@@ -231966,39 +231818,9 @@ var init_ripGrep = __esm({
|
|
|
231966
231818
|
super(params);
|
|
231967
231819
|
this.config = config;
|
|
231968
231820
|
}
|
|
231969
|
-
/**
|
|
231970
|
-
* Checks if a path is within the root directory and resolves it.
|
|
231971
|
-
* @param relativePath Path relative to the root directory (or undefined for root).
|
|
231972
|
-
* @returns The absolute path to search within.
|
|
231973
|
-
* @throws {Error} If path is outside root, doesn't exist, or isn't a directory.
|
|
231974
|
-
*/
|
|
231975
|
-
resolveAndValidatePath(relativePath) {
|
|
231976
|
-
const targetDir = this.config.getTargetDir();
|
|
231977
|
-
const targetPath = relativePath ? path40.resolve(targetDir, relativePath) : targetDir;
|
|
231978
|
-
const workspaceContext = this.config.getWorkspaceContext();
|
|
231979
|
-
if (!workspaceContext.isPathWithinWorkspace(targetPath)) {
|
|
231980
|
-
const directories = workspaceContext.getDirectories();
|
|
231981
|
-
throw new Error(`Path validation failed: Attempted path "${relativePath}" resolves outside the allowed workspace directories: ${directories.join(", ")}`);
|
|
231982
|
-
}
|
|
231983
|
-
return this.ensureDirectory(targetPath);
|
|
231984
|
-
}
|
|
231985
|
-
ensureDirectory(targetPath) {
|
|
231986
|
-
try {
|
|
231987
|
-
const stats = fs36.statSync(targetPath);
|
|
231988
|
-
if (!stats.isDirectory()) {
|
|
231989
|
-
throw new Error(`Path is not a directory: ${targetPath}`);
|
|
231990
|
-
}
|
|
231991
|
-
} catch (error) {
|
|
231992
|
-
if (isNodeError(error) && error.code !== "ENOENT") {
|
|
231993
|
-
throw new Error(`Path does not exist: ${targetPath}`);
|
|
231994
|
-
}
|
|
231995
|
-
throw new Error(`Failed to access path stats for ${targetPath}: ${error}`);
|
|
231996
|
-
}
|
|
231997
|
-
return targetPath;
|
|
231998
|
-
}
|
|
231999
231821
|
async execute(signal) {
|
|
232000
231822
|
try {
|
|
232001
|
-
const searchDirAbs =
|
|
231823
|
+
const searchDirAbs = resolveAndValidatePath(this.config, this.params.path, { allowFiles: true });
|
|
232002
231824
|
const searchDirDisplay = this.params.path || ".";
|
|
232003
231825
|
const rawOutput = await this.performRipgrepSearch({
|
|
232004
231826
|
pattern: this.params.pattern,
|
|
@@ -232018,26 +231840,45 @@ var init_ripGrep = __esm({
|
|
|
232018
231840
|
const header = `Found ${totalMatches} ${matchTerm} for pattern "${this.params.pattern}" ${searchLocationDescription}${filterDescription}:
|
|
232019
231841
|
---
|
|
232020
231842
|
`;
|
|
232021
|
-
const
|
|
232022
|
-
const
|
|
231843
|
+
const charLimit = this.config.getTruncateToolOutputThreshold();
|
|
231844
|
+
const lineLimit = Math.min(this.config.getTruncateToolOutputLines(), this.params.limit ?? Number.POSITIVE_INFINITY);
|
|
232023
231845
|
let truncatedByLineLimit = false;
|
|
232024
231846
|
let linesToInclude = allLines;
|
|
232025
|
-
if (
|
|
232026
|
-
linesToInclude = allLines.slice(0,
|
|
231847
|
+
if (allLines.length > lineLimit) {
|
|
231848
|
+
linesToInclude = allLines.slice(0, lineLimit);
|
|
232027
231849
|
truncatedByLineLimit = true;
|
|
232028
231850
|
}
|
|
232029
|
-
let grepOutput =
|
|
231851
|
+
let grepOutput = "";
|
|
232030
231852
|
let truncatedByCharLimit = false;
|
|
232031
|
-
|
|
232032
|
-
|
|
232033
|
-
|
|
231853
|
+
let includedLines = 0;
|
|
231854
|
+
if (Number.isFinite(charLimit)) {
|
|
231855
|
+
const parts = [];
|
|
231856
|
+
let currentLength = 0;
|
|
231857
|
+
for (const line of linesToInclude) {
|
|
231858
|
+
const sep7 = includedLines > 0 ? 1 : 0;
|
|
231859
|
+
includedLines++;
|
|
231860
|
+
const projectedLength = currentLength + line.length + sep7;
|
|
231861
|
+
if (projectedLength <= charLimit) {
|
|
231862
|
+
parts.push(line);
|
|
231863
|
+
currentLength = projectedLength;
|
|
231864
|
+
} else {
|
|
231865
|
+
const remaining = Math.max(charLimit - currentLength - sep7, 10);
|
|
231866
|
+
parts.push(line.slice(0, remaining) + "...");
|
|
231867
|
+
truncatedByCharLimit = true;
|
|
231868
|
+
break;
|
|
231869
|
+
}
|
|
231870
|
+
}
|
|
231871
|
+
grepOutput = parts.join("\n");
|
|
231872
|
+
} else {
|
|
231873
|
+
grepOutput = linesToInclude.join("\n");
|
|
231874
|
+
includedLines = linesToInclude.length;
|
|
232034
231875
|
}
|
|
232035
|
-
const finalLines = grepOutput.split(EOL3).filter((line) => line.trim());
|
|
232036
|
-
const includedLines = finalLines.length;
|
|
232037
231876
|
let llmContent = header + grepOutput;
|
|
232038
231877
|
if (truncatedByLineLimit || truncatedByCharLimit) {
|
|
232039
231878
|
const omittedMatches = totalMatches - includedLines;
|
|
232040
|
-
llmContent += `
|
|
231879
|
+
llmContent += `
|
|
231880
|
+
---
|
|
231881
|
+
[${omittedMatches} ${omittedMatches === 1 ? "line" : "lines"} truncated] ...`;
|
|
232041
231882
|
}
|
|
232042
231883
|
let displayMessage = `Found ${totalMatches} ${matchTerm}`;
|
|
232043
231884
|
if (truncatedByLineLimit || truncatedByCharLimit) {
|
|
@@ -232133,23 +231974,11 @@ var init_ripGrep = __esm({
|
|
|
232133
231974
|
*/
|
|
232134
231975
|
getDescription() {
|
|
232135
231976
|
let description = `'${this.params.pattern}'`;
|
|
232136
|
-
if (this.params.glob) {
|
|
232137
|
-
description += ` in ${this.params.glob}`;
|
|
232138
|
-
}
|
|
232139
231977
|
if (this.params.path) {
|
|
232140
|
-
|
|
232141
|
-
|
|
232142
|
-
|
|
232143
|
-
|
|
232144
|
-
const relativePath = makeRelative(resolvedPath, this.config.getTargetDir());
|
|
232145
|
-
description += ` within ${shortenPath(relativePath)}`;
|
|
232146
|
-
}
|
|
232147
|
-
} else {
|
|
232148
|
-
const workspaceContext = this.config.getWorkspaceContext();
|
|
232149
|
-
const directories = workspaceContext.getDirectories();
|
|
232150
|
-
if (directories.length > 1) {
|
|
232151
|
-
description += ` across all workspace directories`;
|
|
232152
|
-
}
|
|
231978
|
+
description += ` in path '${this.params.path}'`;
|
|
231979
|
+
}
|
|
231980
|
+
if (this.params.glob) {
|
|
231981
|
+
description += ` (filter: '${this.params.glob}')`;
|
|
232153
231982
|
}
|
|
232154
231983
|
return description;
|
|
232155
231984
|
}
|
|
@@ -232185,35 +232014,6 @@ var init_ripGrep = __esm({
|
|
|
232185
232014
|
});
|
|
232186
232015
|
this.config = config;
|
|
232187
232016
|
}
|
|
232188
|
-
/**
|
|
232189
|
-
* Checks if a path is within the root directory and resolves it.
|
|
232190
|
-
* @param relativePath Path relative to the root directory (or undefined for root).
|
|
232191
|
-
* @returns The absolute path to search within.
|
|
232192
|
-
* @throws {Error} If path is outside root, doesn't exist, or isn't a directory.
|
|
232193
|
-
*/
|
|
232194
|
-
resolveAndValidatePath(relativePath) {
|
|
232195
|
-
if (!relativePath) {
|
|
232196
|
-
return this.config.getTargetDir();
|
|
232197
|
-
}
|
|
232198
|
-
const targetPath = path40.resolve(this.config.getTargetDir(), relativePath);
|
|
232199
|
-
const workspaceContext = this.config.getWorkspaceContext();
|
|
232200
|
-
if (!workspaceContext.isPathWithinWorkspace(targetPath)) {
|
|
232201
|
-
const directories = workspaceContext.getDirectories();
|
|
232202
|
-
throw new Error(`Path validation failed: Attempted path "${relativePath}" resolves outside the allowed workspace directories: ${directories.join(", ")}`);
|
|
232203
|
-
}
|
|
232204
|
-
try {
|
|
232205
|
-
const stats = fs36.statSync(targetPath);
|
|
232206
|
-
if (!stats.isDirectory()) {
|
|
232207
|
-
throw new Error(`Path is not a directory: ${targetPath}`);
|
|
232208
|
-
}
|
|
232209
|
-
} catch (error) {
|
|
232210
|
-
if (isNodeError(error) && error.code !== "ENOENT") {
|
|
232211
|
-
throw new Error(`Path does not exist: ${targetPath}`);
|
|
232212
|
-
}
|
|
232213
|
-
throw new Error(`Failed to access path stats for ${targetPath}: ${error}`);
|
|
232214
|
-
}
|
|
232215
|
-
return targetPath;
|
|
232216
|
-
}
|
|
232217
232017
|
/**
|
|
232218
232018
|
* Validates the parameters for the tool
|
|
232219
232019
|
* @param params Parameters to validate
|
|
@@ -232231,7 +232031,7 @@ var init_ripGrep = __esm({
|
|
|
232231
232031
|
}
|
|
232232
232032
|
if (params.path) {
|
|
232233
232033
|
try {
|
|
232234
|
-
this.
|
|
232034
|
+
resolveAndValidatePath(this.config, params.path, { allowFiles: true });
|
|
232235
232035
|
} catch (error) {
|
|
232236
232036
|
return getErrorMessage(error);
|
|
232237
232037
|
}
|
|
@@ -241899,6 +241699,7 @@ var init_web_fetch = __esm({
|
|
|
241899
241699
|
init_tool_error();
|
|
241900
241700
|
init_tools();
|
|
241901
241701
|
init_models();
|
|
241702
|
+
init_tool_names();
|
|
241902
241703
|
URL_FETCH_TIMEOUT_MS = 1e4;
|
|
241903
241704
|
MAX_CONTENT_LENGTH = 1e5;
|
|
241904
241705
|
WebFetchToolInvocation = class extends BaseToolInvocation {
|
|
@@ -242000,7 +241801,7 @@ ${textContent2}
|
|
|
242000
241801
|
__name(this, "WebFetchTool");
|
|
242001
241802
|
}
|
|
242002
241803
|
config;
|
|
242003
|
-
static Name =
|
|
241804
|
+
static Name = ToolNames.WEB_FETCH;
|
|
242004
241805
|
constructor(config) {
|
|
242005
241806
|
super(_WebFetchTool.Name, "WebFetch", `Fetches content from a specified URL and processes it using an AI model
|
|
242006
241807
|
- Takes a URL and a prompt as input
|
|
@@ -242341,6 +242142,7 @@ var init_web_search = __esm({
|
|
|
242341
242142
|
init_tavily_provider();
|
|
242342
242143
|
init_google_provider();
|
|
242343
242144
|
init_dashscope_provider();
|
|
242145
|
+
init_tool_names();
|
|
242344
242146
|
WebSearchToolInvocation = class extends BaseToolInvocation {
|
|
242345
242147
|
static {
|
|
242346
242148
|
__name(this, "WebSearchToolInvocation");
|
|
@@ -242515,7 +242317,7 @@ ${content}`,
|
|
|
242515
242317
|
__name(this, "WebSearchTool");
|
|
242516
242318
|
}
|
|
242517
242319
|
config;
|
|
242518
|
-
static Name =
|
|
242320
|
+
static Name = ToolNames.WEB_SEARCH;
|
|
242519
242321
|
constructor(config) {
|
|
242520
242322
|
super(_WebSearchTool.Name, "WebSearch", "Allows searching the web and using results to inform responses. Provides up-to-date information for current events and recent data beyond the training data cutoff. Returns search results formatted with concise answers and source links. Use this tool when accessing information that may be outdated or beyond the knowledge cutoff.", Kind.Search, {
|
|
242521
242323
|
type: "object",
|
|
@@ -244154,7 +243956,7 @@ var init_config3 = __esm({
|
|
|
244154
243956
|
ApprovalMode2["YOLO"] = "yolo";
|
|
244155
243957
|
})(ApprovalMode || (ApprovalMode = {}));
|
|
244156
243958
|
APPROVAL_MODES = Object.values(ApprovalMode);
|
|
244157
|
-
DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD =
|
|
243959
|
+
DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD = 25e3;
|
|
244158
243960
|
DEFAULT_TRUNCATE_TOOL_OUTPUT_LINES = 1e3;
|
|
244159
243961
|
MCPServerConfig = class {
|
|
244160
243962
|
static {
|
|
@@ -244276,6 +244078,7 @@ var init_config3 = __esm({
|
|
|
244276
244078
|
extensionManagement = true;
|
|
244277
244079
|
enablePromptCompletion = false;
|
|
244278
244080
|
skipLoopDetection;
|
|
244081
|
+
skipStartupContext;
|
|
244279
244082
|
vlmSwitchMode;
|
|
244280
244083
|
initialized = false;
|
|
244281
244084
|
storage;
|
|
@@ -244358,6 +244161,7 @@ var init_config3 = __esm({
|
|
|
244358
244161
|
this.interactive = params.interactive ?? false;
|
|
244359
244162
|
this.trustedFolder = params.trustedFolder;
|
|
244360
244163
|
this.skipLoopDetection = params.skipLoopDetection ?? false;
|
|
244164
|
+
this.skipStartupContext = params.skipStartupContext ?? false;
|
|
244361
244165
|
this.webSearch = params.webSearch;
|
|
244362
244166
|
this.useRipgrep = params.useRipgrep ?? true;
|
|
244363
244167
|
this.useBuiltinRipgrep = params.useBuiltinRipgrep ?? true;
|
|
@@ -244757,6 +244561,9 @@ var init_config3 = __esm({
|
|
|
244757
244561
|
getSkipLoopDetection() {
|
|
244758
244562
|
return this.skipLoopDetection;
|
|
244759
244563
|
}
|
|
244564
|
+
getSkipStartupContext() {
|
|
244565
|
+
return this.skipStartupContext;
|
|
244566
|
+
}
|
|
244760
244567
|
getVlmSwitchMode() {
|
|
244761
244568
|
return this.vlmSwitchMode;
|
|
244762
244569
|
}
|
|
@@ -244764,6 +244571,9 @@ var init_config3 = __esm({
|
|
|
244764
244571
|
return this.enableToolOutputTruncation;
|
|
244765
244572
|
}
|
|
244766
244573
|
getTruncateToolOutputThreshold() {
|
|
244574
|
+
if (!this.enableToolOutputTruncation || this.truncateToolOutputThreshold <= 0) {
|
|
244575
|
+
return Number.POSITIVE_INFINITY;
|
|
244576
|
+
}
|
|
244767
244577
|
return Math.min(
|
|
244768
244578
|
// Estimate remaining context window in characters (1 token ~= 4 chars).
|
|
244769
244579
|
4 * (tokenLimit(this.getModel()) - uiTelemetryService.getLastPromptTokenCount()),
|
|
@@ -244771,6 +244581,9 @@ var init_config3 = __esm({
|
|
|
244771
244581
|
);
|
|
244772
244582
|
}
|
|
244773
244583
|
getTruncateToolOutputLines() {
|
|
244584
|
+
if (!this.enableToolOutputTruncation || this.truncateToolOutputLines <= 0) {
|
|
244585
|
+
return Number.POSITIVE_INFINITY;
|
|
244586
|
+
}
|
|
244774
244587
|
return this.truncateToolOutputLines;
|
|
244775
244588
|
}
|
|
244776
244589
|
getUseSmartEdit() {
|
|
@@ -257088,7 +256901,7 @@ var require_supports_color2 = __commonJS({
|
|
|
257088
256901
|
"node_modules/chalk/node_modules/supports-color/index.js"(exports2, module2) {
|
|
257089
256902
|
"use strict";
|
|
257090
256903
|
init_esbuild_shims();
|
|
257091
|
-
var
|
|
256904
|
+
var os42 = __require("os");
|
|
257092
256905
|
var tty3 = __require("tty");
|
|
257093
256906
|
var hasFlag3 = require_has_flag2();
|
|
257094
256907
|
var { env: env7 } = process;
|
|
@@ -257137,7 +256950,7 @@ var require_supports_color2 = __commonJS({
|
|
|
257137
256950
|
return min;
|
|
257138
256951
|
}
|
|
257139
256952
|
if (process.platform === "win32") {
|
|
257140
|
-
const osRelease =
|
|
256953
|
+
const osRelease = os42.release().split(".");
|
|
257141
256954
|
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
257142
256955
|
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
257143
256956
|
}
|
|
@@ -260024,7 +259837,7 @@ var require_main = __commonJS({
|
|
|
260024
259837
|
init_esbuild_shims();
|
|
260025
259838
|
var fs95 = __require("fs");
|
|
260026
259839
|
var path108 = __require("path");
|
|
260027
|
-
var
|
|
259840
|
+
var os42 = __require("os");
|
|
260028
259841
|
var crypto18 = __require("crypto");
|
|
260029
259842
|
var packageJson4 = require_package5();
|
|
260030
259843
|
var version2 = packageJson4.version;
|
|
@@ -260179,7 +259992,7 @@ var require_main = __commonJS({
|
|
|
260179
259992
|
}
|
|
260180
259993
|
__name(_vaultPath, "_vaultPath");
|
|
260181
259994
|
function _resolveHome(envPath) {
|
|
260182
|
-
return envPath[0] === "~" ? path108.join(
|
|
259995
|
+
return envPath[0] === "~" ? path108.join(os42.homedir(), envPath.slice(1)) : envPath;
|
|
260183
259996
|
}
|
|
260184
259997
|
__name(_resolveHome, "_resolveHome");
|
|
260185
259998
|
function _configVault(options2) {
|
|
@@ -270168,7 +269981,7 @@ var require_supports_color3 = __commonJS({
|
|
|
270168
269981
|
"node_modules/ink-link/node_modules/supports-color/index.js"(exports2, module2) {
|
|
270169
269982
|
"use strict";
|
|
270170
269983
|
init_esbuild_shims();
|
|
270171
|
-
var
|
|
269984
|
+
var os42 = __require("os");
|
|
270172
269985
|
var tty3 = __require("tty");
|
|
270173
269986
|
var hasFlag3 = require_has_flag2();
|
|
270174
269987
|
var { env: env7 } = process;
|
|
@@ -270217,7 +270030,7 @@ var require_supports_color3 = __commonJS({
|
|
|
270217
270030
|
return min;
|
|
270218
270031
|
}
|
|
270219
270032
|
if (process.platform === "win32") {
|
|
270220
|
-
const osRelease =
|
|
270033
|
+
const osRelease = os42.release().split(".");
|
|
270221
270034
|
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
270222
270035
|
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
270223
270036
|
}
|
|
@@ -276352,7 +276165,7 @@ var require_command_exists = __commonJS({
|
|
|
276352
276165
|
"use strict";
|
|
276353
276166
|
init_esbuild_shims();
|
|
276354
276167
|
var exec5 = __require("child_process").exec;
|
|
276355
|
-
var
|
|
276168
|
+
var execSync8 = __require("child_process").execSync;
|
|
276356
276169
|
var fs95 = __require("fs");
|
|
276357
276170
|
var path108 = __require("path");
|
|
276358
276171
|
var access6 = fs95.access;
|
|
@@ -276426,7 +276239,7 @@ var require_command_exists = __commonJS({
|
|
|
276426
276239
|
var commandExistsUnixSync = /* @__PURE__ */ __name(function(commandName, cleanedCommandName) {
|
|
276427
276240
|
if (fileNotExistsSync(commandName)) {
|
|
276428
276241
|
try {
|
|
276429
|
-
var stdout =
|
|
276242
|
+
var stdout = execSync8(
|
|
276430
276243
|
"command -v " + cleanedCommandName + " 2>/dev/null && { echo >&1 " + cleanedCommandName + "; exit 0; }"
|
|
276431
276244
|
);
|
|
276432
276245
|
return !!stdout;
|
|
@@ -276441,7 +276254,7 @@ var require_command_exists = __commonJS({
|
|
|
276441
276254
|
return false;
|
|
276442
276255
|
}
|
|
276443
276256
|
try {
|
|
276444
|
-
var stdout =
|
|
276257
|
+
var stdout = execSync8("where " + cleanedCommandName, { stdio: [] });
|
|
276445
276258
|
return !!stdout;
|
|
276446
276259
|
} catch (error) {
|
|
276447
276260
|
return false;
|
|
@@ -282062,9 +281875,9 @@ var require_defaults3 = __commonJS({
|
|
|
282062
281875
|
"node_modules/@pnpm/npm-conf/lib/defaults.js"(exports2) {
|
|
282063
281876
|
"use strict";
|
|
282064
281877
|
init_esbuild_shims();
|
|
282065
|
-
var
|
|
281878
|
+
var os42 = __require("os");
|
|
282066
281879
|
var path108 = __require("path");
|
|
282067
|
-
var temp =
|
|
281880
|
+
var temp = os42.tmpdir();
|
|
282068
281881
|
var uidOrPid = process.getuid ? process.getuid() : process.pid;
|
|
282069
281882
|
var hasUnicode = /* @__PURE__ */ __name(() => true, "hasUnicode");
|
|
282070
281883
|
var isWindows8 = process.platform === "win32";
|
|
@@ -282075,7 +281888,7 @@ var require_defaults3 = __commonJS({
|
|
|
282075
281888
|
var umask = {
|
|
282076
281889
|
fromString: /* @__PURE__ */ __name(() => process.umask(), "fromString")
|
|
282077
281890
|
};
|
|
282078
|
-
var home =
|
|
281891
|
+
var home = os42.homedir();
|
|
282079
281892
|
if (home) {
|
|
282080
281893
|
process.env.HOME = home;
|
|
282081
281894
|
} else {
|
|
@@ -290936,7 +290749,7 @@ async function readPathFromWorkspace(pathStr, config) {
|
|
|
290936
290749
|
const relativePathForDisplay = path58.relative(absolutePath, filePath);
|
|
290937
290750
|
allParts.push({ text: `--- ${relativePathForDisplay} ---
|
|
290938
290751
|
` });
|
|
290939
|
-
const result = await processSingleFileContent(filePath, config
|
|
290752
|
+
const result = await processSingleFileContent(filePath, config);
|
|
290940
290753
|
allParts.push(result.llmContent);
|
|
290941
290754
|
allParts.push({ text: "\n" });
|
|
290942
290755
|
}
|
|
@@ -290951,7 +290764,7 @@ async function readPathFromWorkspace(pathStr, config) {
|
|
|
290951
290764
|
if (filtered.length === 0) {
|
|
290952
290765
|
return [];
|
|
290953
290766
|
}
|
|
290954
|
-
const result = await processSingleFileContent(absolutePath, config
|
|
290767
|
+
const result = await processSingleFileContent(absolutePath, config);
|
|
290955
290768
|
return [result.llmContent];
|
|
290956
290769
|
}
|
|
290957
290770
|
}
|
|
@@ -316647,66 +316460,111 @@ var WarningMessage = /* @__PURE__ */ __name(({ text }) => {
|
|
|
316647
316460
|
// packages/cli/src/ui/components/AboutBox.tsx
|
|
316648
316461
|
init_esbuild_shims();
|
|
316649
316462
|
|
|
316650
|
-
// packages/cli/src/
|
|
316463
|
+
// packages/cli/src/utils/systemInfoFields.ts
|
|
316651
316464
|
init_esbuild_shims();
|
|
316652
|
-
|
|
316465
|
+
function getSystemInfoFields(info) {
|
|
316466
|
+
const allFields = [
|
|
316467
|
+
{
|
|
316468
|
+
label: "CLI Version",
|
|
316469
|
+
key: "cliVersion"
|
|
316470
|
+
},
|
|
316471
|
+
{
|
|
316472
|
+
label: "Git Commit",
|
|
316473
|
+
key: "gitCommit"
|
|
316474
|
+
},
|
|
316475
|
+
{
|
|
316476
|
+
label: "Model",
|
|
316477
|
+
key: "modelVersion"
|
|
316478
|
+
},
|
|
316479
|
+
{
|
|
316480
|
+
label: "Sandbox",
|
|
316481
|
+
key: "sandboxEnv"
|
|
316482
|
+
},
|
|
316483
|
+
{
|
|
316484
|
+
label: "OS Platform",
|
|
316485
|
+
key: "osPlatform"
|
|
316486
|
+
},
|
|
316487
|
+
{
|
|
316488
|
+
label: "OS Arch",
|
|
316489
|
+
key: "osArch"
|
|
316490
|
+
},
|
|
316491
|
+
{
|
|
316492
|
+
label: "OS Release",
|
|
316493
|
+
key: "osRelease"
|
|
316494
|
+
},
|
|
316495
|
+
{
|
|
316496
|
+
label: "Node.js Version",
|
|
316497
|
+
key: "nodeVersion"
|
|
316498
|
+
},
|
|
316499
|
+
{
|
|
316500
|
+
label: "NPM Version",
|
|
316501
|
+
key: "npmVersion"
|
|
316502
|
+
},
|
|
316503
|
+
{
|
|
316504
|
+
label: "Session ID",
|
|
316505
|
+
key: "sessionId"
|
|
316506
|
+
},
|
|
316507
|
+
{
|
|
316508
|
+
label: "Auth Method",
|
|
316509
|
+
key: "selectedAuthType"
|
|
316510
|
+
},
|
|
316511
|
+
{
|
|
316512
|
+
label: "Base URL",
|
|
316513
|
+
key: "baseUrl"
|
|
316514
|
+
},
|
|
316515
|
+
{
|
|
316516
|
+
label: "Memory Usage",
|
|
316517
|
+
key: "memoryUsage"
|
|
316518
|
+
},
|
|
316519
|
+
{
|
|
316520
|
+
label: "IDE Client",
|
|
316521
|
+
key: "ideClient"
|
|
316522
|
+
}
|
|
316523
|
+
];
|
|
316524
|
+
return allFields.filter((field) => {
|
|
316525
|
+
const value = info[field.key];
|
|
316526
|
+
if (field.key === "baseUrl" || field.key === "gitCommit" || field.key === "ideClient") {
|
|
316527
|
+
return Boolean(value);
|
|
316528
|
+
}
|
|
316529
|
+
return true;
|
|
316530
|
+
});
|
|
316531
|
+
}
|
|
316532
|
+
__name(getSystemInfoFields, "getSystemInfoFields");
|
|
316533
|
+
function getFieldValue(field, info) {
|
|
316534
|
+
const value = info[field.key];
|
|
316535
|
+
if (value === void 0 || value === null) {
|
|
316536
|
+
return "";
|
|
316537
|
+
}
|
|
316538
|
+
if (field.key === "selectedAuthType") {
|
|
316539
|
+
return String(value).startsWith("oauth") ? "OAuth" : String(value);
|
|
316540
|
+
}
|
|
316541
|
+
return String(value);
|
|
316542
|
+
}
|
|
316543
|
+
__name(getFieldValue, "getFieldValue");
|
|
316653
316544
|
|
|
316654
316545
|
// packages/cli/src/ui/components/AboutBox.tsx
|
|
316655
316546
|
var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1);
|
|
316656
|
-
var AboutBox = /* @__PURE__ */ __name(({
|
|
316657
|
-
|
|
316658
|
-
|
|
316659
|
-
|
|
316660
|
-
|
|
316661
|
-
|
|
316662
|
-
|
|
316663
|
-
|
|
316664
|
-
|
|
316665
|
-
|
|
316666
|
-
|
|
316667
|
-
|
|
316668
|
-
|
|
316669
|
-
|
|
316670
|
-
|
|
316671
|
-
|
|
316672
|
-
|
|
316673
|
-
|
|
316674
|
-
|
|
316675
|
-
|
|
316676
|
-
|
|
316677
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Text, { color: theme.text.primary, children: cliVersion }) })
|
|
316678
|
-
] }),
|
|
316679
|
-
GIT_COMMIT_INFO2 && !["N/A"].includes(GIT_COMMIT_INFO2) && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Box_default, { flexDirection: "row", children: [
|
|
316680
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Box_default, { width: "35%", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Text, { bold: true, color: theme.text.link, children: "Git Commit" }) }),
|
|
316681
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Text, { color: theme.text.primary, children: GIT_COMMIT_INFO2 }) })
|
|
316682
|
-
] }),
|
|
316683
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Box_default, { flexDirection: "row", children: [
|
|
316684
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Box_default, { width: "35%", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Text, { bold: true, color: theme.text.link, children: "Model" }) }),
|
|
316685
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Text, { color: theme.text.primary, children: modelVersion }) })
|
|
316686
|
-
] }),
|
|
316687
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Box_default, { flexDirection: "row", children: [
|
|
316688
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Box_default, { width: "35%", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Text, { bold: true, color: theme.text.link, children: "Sandbox" }) }),
|
|
316689
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Text, { color: theme.text.primary, children: sandboxEnv }) })
|
|
316690
|
-
] }),
|
|
316691
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Box_default, { flexDirection: "row", children: [
|
|
316692
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Box_default, { width: "35%", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Text, { bold: true, color: theme.text.link, children: "OS" }) }),
|
|
316693
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Text, { color: theme.text.primary, children: osVersion }) })
|
|
316694
|
-
] }),
|
|
316695
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Box_default, { flexDirection: "row", children: [
|
|
316696
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Box_default, { width: "35%", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Text, { bold: true, color: theme.text.link, children: "Auth Method" }) }),
|
|
316697
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Text, { color: theme.text.primary, children: selectedAuthType.startsWith("oauth") ? "OAuth" : selectedAuthType }) })
|
|
316698
|
-
] }),
|
|
316699
|
-
gcpProject && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Box_default, { flexDirection: "row", children: [
|
|
316700
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Box_default, { width: "35%", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Text, { bold: true, color: theme.text.link, children: "GCP Project" }) }),
|
|
316701
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Text, { color: theme.text.primary, children: gcpProject }) })
|
|
316702
|
-
] }),
|
|
316703
|
-
ideClient && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Box_default, { flexDirection: "row", children: [
|
|
316704
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Box_default, { width: "35%", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Text, { bold: true, color: theme.text.link, children: "IDE Client" }) }),
|
|
316705
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Text, { color: theme.text.primary, children: ideClient }) })
|
|
316706
|
-
] })
|
|
316707
|
-
]
|
|
316708
|
-
}
|
|
316709
|
-
), "AboutBox");
|
|
316547
|
+
var AboutBox = /* @__PURE__ */ __name((props) => {
|
|
316548
|
+
const fields = getSystemInfoFields(props);
|
|
316549
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
316550
|
+
Box_default,
|
|
316551
|
+
{
|
|
316552
|
+
borderStyle: "round",
|
|
316553
|
+
borderColor: theme.border.default,
|
|
316554
|
+
flexDirection: "column",
|
|
316555
|
+
padding: 1,
|
|
316556
|
+
marginY: 1,
|
|
316557
|
+
width: "100%",
|
|
316558
|
+
children: [
|
|
316559
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Box_default, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Text, { bold: true, color: theme.text.accent, children: "About Qwen Code" }) }),
|
|
316560
|
+
fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Box_default, { flexDirection: "row", children: [
|
|
316561
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Box_default, { width: "35%", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Text, { bold: true, color: theme.text.link, children: field.label }) }),
|
|
316562
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Text, { color: theme.text.primary, children: getFieldValue(field, props) }) })
|
|
316563
|
+
] }, field.key))
|
|
316564
|
+
]
|
|
316565
|
+
}
|
|
316566
|
+
);
|
|
316567
|
+
}, "AboutBox");
|
|
316710
316568
|
|
|
316711
316569
|
// packages/cli/src/ui/components/StatsDisplay.tsx
|
|
316712
316570
|
init_esbuild_shims();
|
|
@@ -318024,18 +317882,7 @@ var HistoryItemDisplayComponent = /* @__PURE__ */ __name(({
|
|
|
318024
317882
|
itemForDisplay.type === "info" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(InfoMessage, { text: itemForDisplay.text }),
|
|
318025
317883
|
itemForDisplay.type === "warning" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(WarningMessage, { text: itemForDisplay.text }),
|
|
318026
317884
|
itemForDisplay.type === "error" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ErrorMessage, { text: itemForDisplay.text }),
|
|
318027
|
-
itemForDisplay.type === "about" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
318028
|
-
AboutBox,
|
|
318029
|
-
{
|
|
318030
|
-
cliVersion: itemForDisplay.cliVersion,
|
|
318031
|
-
osVersion: itemForDisplay.osVersion,
|
|
318032
|
-
sandboxEnv: itemForDisplay.sandboxEnv,
|
|
318033
|
-
modelVersion: itemForDisplay.modelVersion,
|
|
318034
|
-
selectedAuthType: itemForDisplay.selectedAuthType,
|
|
318035
|
-
gcpProject: itemForDisplay.gcpProject,
|
|
318036
|
-
ideClient: itemForDisplay.ideClient
|
|
318037
|
-
}
|
|
318038
|
-
),
|
|
317885
|
+
itemForDisplay.type === "about" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(AboutBox, { ...itemForDisplay.systemInfo }),
|
|
318039
317886
|
itemForDisplay.type === "help" && commands && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Help, { commands }),
|
|
318040
317887
|
itemForDisplay.type === "stats" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(StatsDisplay, { duration: itemForDisplay.duration }),
|
|
318041
317888
|
itemForDisplay.type === "model_stats" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ModelStatsDisplay, {}),
|
|
@@ -319176,6 +319023,15 @@ var SETTINGS_SCHEMA = {
|
|
|
319176
319023
|
description: "Disable all loop detection checks (streaming and LLM).",
|
|
319177
319024
|
showInDialog: true
|
|
319178
319025
|
},
|
|
319026
|
+
skipStartupContext: {
|
|
319027
|
+
type: "boolean",
|
|
319028
|
+
label: "Skip Startup Context",
|
|
319029
|
+
category: "Model",
|
|
319030
|
+
requiresRestart: true,
|
|
319031
|
+
default: false,
|
|
319032
|
+
description: "Avoid sending the workspace startup context at the beginning of each session.",
|
|
319033
|
+
showInDialog: true
|
|
319034
|
+
},
|
|
319179
319035
|
enableOpenAILogging: {
|
|
319180
319036
|
type: "boolean",
|
|
319181
319037
|
label: "Enable OpenAI Logging",
|
|
@@ -326305,6 +326161,7 @@ var MIGRATION_MAP = {
|
|
|
326305
326161
|
sessionTokenLimit: "model.sessionTokenLimit",
|
|
326306
326162
|
contentGenerator: "model.generationConfig",
|
|
326307
326163
|
skipLoopDetection: "model.skipLoopDetection",
|
|
326164
|
+
skipStartupContext: "model.skipStartupContext",
|
|
326308
326165
|
enableOpenAILogging: "model.enableOpenAILogging",
|
|
326309
326166
|
tavilyApiKey: "advanced.tavilyApiKey",
|
|
326310
326167
|
vlmSwitchMode: "experimental.vlmSwitchMode",
|
|
@@ -338496,7 +338353,7 @@ import { homedir as homedir16 } from "node:os";
|
|
|
338496
338353
|
init_esbuild_shims();
|
|
338497
338354
|
import * as os26 from "node:os";
|
|
338498
338355
|
import * as path76 from "node:path";
|
|
338499
|
-
function
|
|
338356
|
+
function resolvePath2(p) {
|
|
338500
338357
|
if (!p) {
|
|
338501
338358
|
return "";
|
|
338502
338359
|
}
|
|
@@ -338508,7 +338365,7 @@ function resolvePath(p) {
|
|
|
338508
338365
|
}
|
|
338509
338366
|
return path76.normalize(expandedPath);
|
|
338510
338367
|
}
|
|
338511
|
-
__name(
|
|
338368
|
+
__name(resolvePath2, "resolvePath");
|
|
338512
338369
|
|
|
338513
338370
|
// packages/cli/src/utils/version.ts
|
|
338514
338371
|
init_esbuild_shims();
|
|
@@ -338744,7 +338601,7 @@ __name(getPackageJson, "getPackageJson");
|
|
|
338744
338601
|
// packages/cli/src/utils/version.ts
|
|
338745
338602
|
async function getCliVersion() {
|
|
338746
338603
|
const pkgJson = await getPackageJson();
|
|
338747
|
-
return "0.1.5
|
|
338604
|
+
return "0.1.5";
|
|
338748
338605
|
}
|
|
338749
338606
|
__name(getCliVersion, "getCliVersion");
|
|
338750
338607
|
|
|
@@ -339541,7 +339398,7 @@ async function loadCliConfig(settings, extensions, extensionEnablementManager, s
|
|
|
339541
339398
|
...DEFAULT_MEMORY_FILE_FILTERING_OPTIONS,
|
|
339542
339399
|
...settings.context?.fileFiltering
|
|
339543
339400
|
};
|
|
339544
|
-
const includeDirectories = (settings.context?.includeDirectories || []).map(
|
|
339401
|
+
const includeDirectories = (settings.context?.includeDirectories || []).map(resolvePath2).concat((argv.includeDirectories || []).map(resolvePath2));
|
|
339545
339402
|
const { memoryContent, fileCount } = await loadHierarchicalGeminiMemory(
|
|
339546
339403
|
cwd7,
|
|
339547
339404
|
settings.context?.loadMemoryFromIncludeDirectories ? includeDirectories : [],
|
|
@@ -339707,6 +339564,7 @@ async function loadCliConfig(settings, extensions, extensionEnablementManager, s
|
|
|
339707
339564
|
skipNextSpeakerCheck: settings.model?.skipNextSpeakerCheck,
|
|
339708
339565
|
enablePromptCompletion: settings.general?.enablePromptCompletion ?? false,
|
|
339709
339566
|
skipLoopDetection: settings.model?.skipLoopDetection ?? false,
|
|
339567
|
+
skipStartupContext: settings.model?.skipStartupContext ?? false,
|
|
339710
339568
|
vlmSwitchMode,
|
|
339711
339569
|
truncateToolOutputThreshold: settings.tools?.truncateToolOutputThreshold,
|
|
339712
339570
|
truncateToolOutputLines: settings.tools?.truncateToolOutputLines,
|
|
@@ -339782,7 +339640,7 @@ function mergeExcludeTools(settings, extensions, extraExcludes) {
|
|
|
339782
339640
|
__name(mergeExcludeTools, "mergeExcludeTools");
|
|
339783
339641
|
|
|
339784
339642
|
// packages/cli/src/ui/AppContainer.tsx
|
|
339785
|
-
import
|
|
339643
|
+
import process49 from "node:process";
|
|
339786
339644
|
|
|
339787
339645
|
// packages/cli/src/ui/hooks/useMemoryMonitor.ts
|
|
339788
339646
|
init_esbuild_shims();
|
|
@@ -340261,7 +340119,7 @@ var useModelCommand = /* @__PURE__ */ __name(() => {
|
|
|
340261
340119
|
init_esbuild_shims();
|
|
340262
340120
|
var import_react108 = __toESM(require_react(), 1);
|
|
340263
340121
|
init_node();
|
|
340264
|
-
import
|
|
340122
|
+
import process37 from "node:process";
|
|
340265
340123
|
|
|
340266
340124
|
// packages/cli/src/services/CommandService.ts
|
|
340267
340125
|
init_esbuild_shims();
|
|
@@ -340345,45 +340203,110 @@ init_esbuild_shims();
|
|
|
340345
340203
|
|
|
340346
340204
|
// packages/cli/src/ui/commands/aboutCommand.ts
|
|
340347
340205
|
init_esbuild_shims();
|
|
340206
|
+
|
|
340207
|
+
// packages/cli/src/utils/systemInfo.ts
|
|
340208
|
+
init_esbuild_shims();
|
|
340348
340209
|
import process35 from "node:process";
|
|
340210
|
+
import os28 from "node:os";
|
|
340211
|
+
import { execSync as execSync4 } from "node:child_process";
|
|
340212
|
+
|
|
340213
|
+
// packages/cli/src/generated/git-commit.ts
|
|
340214
|
+
init_esbuild_shims();
|
|
340215
|
+
var GIT_COMMIT_INFO2 = "2b2361f8";
|
|
340216
|
+
|
|
340217
|
+
// packages/cli/src/utils/systemInfo.ts
|
|
340218
|
+
async function getNpmVersion() {
|
|
340219
|
+
try {
|
|
340220
|
+
return execSync4("npm --version", { encoding: "utf-8" }).trim();
|
|
340221
|
+
} catch {
|
|
340222
|
+
return "unknown";
|
|
340223
|
+
}
|
|
340224
|
+
}
|
|
340225
|
+
__name(getNpmVersion, "getNpmVersion");
|
|
340226
|
+
async function getIdeClientName(context2) {
|
|
340227
|
+
if (!context2.services.config?.getIdeMode()) {
|
|
340228
|
+
return "";
|
|
340229
|
+
}
|
|
340230
|
+
try {
|
|
340231
|
+
const ideClient = await IdeClient.getInstance();
|
|
340232
|
+
return ideClient?.getDetectedIdeDisplayName() ?? "";
|
|
340233
|
+
} catch {
|
|
340234
|
+
return "";
|
|
340235
|
+
}
|
|
340236
|
+
}
|
|
340237
|
+
__name(getIdeClientName, "getIdeClientName");
|
|
340238
|
+
function getSandboxEnv(stripPrefix = false) {
|
|
340239
|
+
const sandbox = process35.env["SANDBOX"];
|
|
340240
|
+
if (!sandbox || sandbox === "sandbox-exec") {
|
|
340241
|
+
if (sandbox === "sandbox-exec") {
|
|
340242
|
+
const profile = process35.env["SEATBELT_PROFILE"] || "unknown";
|
|
340243
|
+
return `sandbox-exec (${profile})`;
|
|
340244
|
+
}
|
|
340245
|
+
return "no sandbox";
|
|
340246
|
+
}
|
|
340247
|
+
if (stripPrefix) {
|
|
340248
|
+
return sandbox.replace(/^qwen-(?:code-)?/, "");
|
|
340249
|
+
}
|
|
340250
|
+
return sandbox;
|
|
340251
|
+
}
|
|
340252
|
+
__name(getSandboxEnv, "getSandboxEnv");
|
|
340253
|
+
async function getSystemInfo(context2) {
|
|
340254
|
+
const osPlatform = process35.platform;
|
|
340255
|
+
const osArch = process35.arch;
|
|
340256
|
+
const osRelease = os28.release();
|
|
340257
|
+
const nodeVersion2 = process35.version;
|
|
340258
|
+
const npmVersion = await getNpmVersion();
|
|
340259
|
+
const sandboxEnv = getSandboxEnv();
|
|
340260
|
+
const modelVersion = context2.services.config?.getModel() || "Unknown";
|
|
340261
|
+
const cliVersion = await getCliVersion();
|
|
340262
|
+
const selectedAuthType = context2.services.settings.merged.security?.auth?.selectedType || "";
|
|
340263
|
+
const ideClient = await getIdeClientName(context2);
|
|
340264
|
+
const sessionId2 = context2.services.config?.getSessionId() || "unknown";
|
|
340265
|
+
return {
|
|
340266
|
+
cliVersion,
|
|
340267
|
+
osPlatform,
|
|
340268
|
+
osArch,
|
|
340269
|
+
osRelease,
|
|
340270
|
+
nodeVersion: nodeVersion2,
|
|
340271
|
+
npmVersion,
|
|
340272
|
+
sandboxEnv,
|
|
340273
|
+
modelVersion,
|
|
340274
|
+
selectedAuthType,
|
|
340275
|
+
ideClient,
|
|
340276
|
+
sessionId: sessionId2
|
|
340277
|
+
};
|
|
340278
|
+
}
|
|
340279
|
+
__name(getSystemInfo, "getSystemInfo");
|
|
340280
|
+
async function getExtendedSystemInfo(context2) {
|
|
340281
|
+
const baseInfo = await getSystemInfo(context2);
|
|
340282
|
+
const memoryUsage = formatMemoryUsage2(process35.memoryUsage().rss);
|
|
340283
|
+
const sandboxEnv = getSandboxEnv(true);
|
|
340284
|
+
const baseUrl = baseInfo.selectedAuthType === AuthType2.USE_OPENAI ? context2.services.config?.getContentGeneratorConfig()?.baseUrl : void 0;
|
|
340285
|
+
const gitCommit = GIT_COMMIT_INFO2 && !["N/A"].includes(GIT_COMMIT_INFO2) ? GIT_COMMIT_INFO2 : void 0;
|
|
340286
|
+
return {
|
|
340287
|
+
...baseInfo,
|
|
340288
|
+
sandboxEnv,
|
|
340289
|
+
memoryUsage,
|
|
340290
|
+
baseUrl,
|
|
340291
|
+
gitCommit
|
|
340292
|
+
};
|
|
340293
|
+
}
|
|
340294
|
+
__name(getExtendedSystemInfo, "getExtendedSystemInfo");
|
|
340295
|
+
|
|
340296
|
+
// packages/cli/src/ui/commands/aboutCommand.ts
|
|
340349
340297
|
var aboutCommand = {
|
|
340350
340298
|
name: "about",
|
|
340351
340299
|
description: "show version info",
|
|
340352
340300
|
kind: "built-in" /* BUILT_IN */,
|
|
340353
340301
|
action: /* @__PURE__ */ __name(async (context2) => {
|
|
340354
|
-
const
|
|
340355
|
-
let sandboxEnv = "no sandbox";
|
|
340356
|
-
if (process35.env["SANDBOX"] && process35.env["SANDBOX"] !== "sandbox-exec") {
|
|
340357
|
-
sandboxEnv = process35.env["SANDBOX"];
|
|
340358
|
-
} else if (process35.env["SANDBOX"] === "sandbox-exec") {
|
|
340359
|
-
sandboxEnv = `sandbox-exec (${process35.env["SEATBELT_PROFILE"] || "unknown"})`;
|
|
340360
|
-
}
|
|
340361
|
-
const modelVersion = context2.services.config?.getModel() || "Unknown";
|
|
340362
|
-
const cliVersion = await getCliVersion();
|
|
340363
|
-
const selectedAuthType = context2.services.settings.merged.security?.auth?.selectedType || "";
|
|
340364
|
-
const gcpProject = process35.env["GOOGLE_CLOUD_PROJECT"] || "";
|
|
340365
|
-
const ideClient = await getIdeClientName(context2);
|
|
340302
|
+
const systemInfo = await getExtendedSystemInfo(context2);
|
|
340366
340303
|
const aboutItem = {
|
|
340367
340304
|
type: "about" /* ABOUT */,
|
|
340368
|
-
|
|
340369
|
-
osVersion,
|
|
340370
|
-
sandboxEnv,
|
|
340371
|
-
modelVersion,
|
|
340372
|
-
selectedAuthType,
|
|
340373
|
-
gcpProject,
|
|
340374
|
-
ideClient
|
|
340305
|
+
systemInfo
|
|
340375
340306
|
};
|
|
340376
340307
|
context2.ui.addItem(aboutItem, Date.now());
|
|
340377
340308
|
}, "action")
|
|
340378
340309
|
};
|
|
340379
|
-
async function getIdeClientName(context2) {
|
|
340380
|
-
if (!context2.services.config?.getIdeMode()) {
|
|
340381
|
-
return "";
|
|
340382
|
-
}
|
|
340383
|
-
const ideClient = await IdeClient.getInstance();
|
|
340384
|
-
return ideClient?.getDetectedIdeDisplayName() ?? "";
|
|
340385
|
-
}
|
|
340386
|
-
__name(getIdeClientName, "getIdeClientName");
|
|
340387
340310
|
|
|
340388
340311
|
// packages/cli/src/ui/commands/agentsCommand.ts
|
|
340389
340312
|
init_esbuild_shims();
|
|
@@ -340761,48 +340684,21 @@ var authCommand = {
|
|
|
340761
340684
|
// packages/cli/src/ui/commands/bugCommand.ts
|
|
340762
340685
|
init_esbuild_shims();
|
|
340763
340686
|
init_open();
|
|
340764
|
-
import process36 from "node:process";
|
|
340765
340687
|
var bugCommand = {
|
|
340766
340688
|
name: "bug",
|
|
340767
340689
|
description: "submit a bug report",
|
|
340768
340690
|
kind: "built-in" /* BUILT_IN */,
|
|
340769
340691
|
action: /* @__PURE__ */ __name(async (context2, args) => {
|
|
340770
340692
|
const bugDescription = (args || "").trim();
|
|
340771
|
-
const
|
|
340772
|
-
const
|
|
340773
|
-
let
|
|
340774
|
-
|
|
340775
|
-
|
|
340776
|
-
} else if (process36.env["SANDBOX"] === "sandbox-exec") {
|
|
340777
|
-
sandboxEnv = `sandbox-exec (${process36.env["SEATBELT_PROFILE"] || "unknown"})`;
|
|
340778
|
-
}
|
|
340779
|
-
const modelVersion = config?.getModel() || "Unknown";
|
|
340780
|
-
const cliVersion = await getCliVersion();
|
|
340781
|
-
const memoryUsage = formatMemoryUsage2(process36.memoryUsage().rss);
|
|
340782
|
-
const ideClient = await getIdeClientName2(context2);
|
|
340783
|
-
const selectedAuthType = context2.services.settings.merged.security?.auth?.selectedType || "";
|
|
340784
|
-
const baseUrl = selectedAuthType === AuthType2.USE_OPENAI ? config?.getContentGeneratorConfig()?.baseUrl : void 0;
|
|
340785
|
-
let info = `
|
|
340786
|
-
* **CLI Version:** ${cliVersion}
|
|
340787
|
-
* **Git Commit:** ${GIT_COMMIT_INFO2}
|
|
340788
|
-
* **Session ID:** ${config?.getSessionId() || "unknown"}
|
|
340789
|
-
* **Operating System:** ${osVersion}
|
|
340790
|
-
* **Sandbox Environment:** ${sandboxEnv}
|
|
340791
|
-
* **Auth Type:** ${selectedAuthType}`;
|
|
340792
|
-
if (baseUrl) {
|
|
340793
|
-
info += `
|
|
340794
|
-
* **Base URL:** ${baseUrl}`;
|
|
340795
|
-
}
|
|
340796
|
-
info += `
|
|
340797
|
-
* **Model Version:** ${modelVersion}
|
|
340798
|
-
* **Memory Usage:** ${memoryUsage}
|
|
340799
|
-
`;
|
|
340800
|
-
if (ideClient) {
|
|
340801
|
-
info += `* **IDE Client:** ${ideClient}
|
|
340693
|
+
const systemInfo = await getExtendedSystemInfo(context2);
|
|
340694
|
+
const fields = getSystemInfoFields(systemInfo);
|
|
340695
|
+
let info = "\n";
|
|
340696
|
+
for (const field of fields) {
|
|
340697
|
+
info += `* **${field.label}:** ${getFieldValue(field, systemInfo)}
|
|
340802
340698
|
`;
|
|
340803
340699
|
}
|
|
340804
340700
|
let bugReportUrl = "https://github.com/QwenLM/qwen-code/issues/new?template=bug_report.yml&title={title}&info={info}";
|
|
340805
|
-
const bugCommandSettings = config?.getBugCommand();
|
|
340701
|
+
const bugCommandSettings = context2.services.config?.getBugCommand();
|
|
340806
340702
|
if (bugCommandSettings?.urlTemplate) {
|
|
340807
340703
|
bugReportUrl = bugCommandSettings.urlTemplate;
|
|
340808
340704
|
}
|
|
@@ -340829,14 +340725,6 @@ ${bugReportUrl}`
|
|
|
340829
340725
|
}
|
|
340830
340726
|
}, "action")
|
|
340831
340727
|
};
|
|
340832
|
-
async function getIdeClientName2(context2) {
|
|
340833
|
-
if (!context2.services.config?.getIdeMode()) {
|
|
340834
|
-
return "";
|
|
340835
|
-
}
|
|
340836
|
-
const ideClient = await IdeClient.getInstance();
|
|
340837
|
-
return ideClient.getDetectedIdeDisplayName() ?? "";
|
|
340838
|
-
}
|
|
340839
|
-
__name(getIdeClientName2, "getIdeClientName");
|
|
340840
340728
|
|
|
340841
340729
|
// packages/cli/src/ui/commands/chatCommand.ts
|
|
340842
340730
|
init_esbuild_shims();
|
|
@@ -341310,14 +341198,14 @@ var corgiCommand = {
|
|
|
341310
341198
|
// packages/cli/src/ui/commands/docsCommand.ts
|
|
341311
341199
|
init_esbuild_shims();
|
|
341312
341200
|
init_open();
|
|
341313
|
-
import
|
|
341201
|
+
import process36 from "node:process";
|
|
341314
341202
|
var docsCommand = {
|
|
341315
341203
|
name: "docs",
|
|
341316
341204
|
description: "open full Qwen Code documentation in your browser",
|
|
341317
341205
|
kind: "built-in" /* BUILT_IN */,
|
|
341318
341206
|
action: /* @__PURE__ */ __name(async (context2) => {
|
|
341319
341207
|
const docsUrl = "https://qwenlm.github.io/qwen-code-docs/en";
|
|
341320
|
-
if (
|
|
341208
|
+
if (process36.env["SANDBOX"] && process36.env["SANDBOX"] !== "sandbox-exec") {
|
|
341321
341209
|
context2.ui.addItem(
|
|
341322
341210
|
{
|
|
341323
341211
|
type: "info" /* INFO */,
|
|
@@ -341341,7 +341229,7 @@ ${docsUrl}`
|
|
|
341341
341229
|
|
|
341342
341230
|
// packages/cli/src/ui/commands/directoryCommand.tsx
|
|
341343
341231
|
init_esbuild_shims();
|
|
341344
|
-
import * as
|
|
341232
|
+
import * as os29 from "node:os";
|
|
341345
341233
|
import * as path83 from "node:path";
|
|
341346
341234
|
function expandHomeDir(p) {
|
|
341347
341235
|
if (!p) {
|
|
@@ -341349,9 +341237,9 @@ function expandHomeDir(p) {
|
|
|
341349
341237
|
}
|
|
341350
341238
|
let expandedPath = p;
|
|
341351
341239
|
if (p.toLowerCase().startsWith("%userprofile%")) {
|
|
341352
|
-
expandedPath =
|
|
341240
|
+
expandedPath = os29.homedir() + p.substring("%userprofile%".length);
|
|
341353
341241
|
} else if (p === "~" || p.startsWith("~/")) {
|
|
341354
|
-
expandedPath =
|
|
341242
|
+
expandedPath = os29.homedir() + p.substring(1);
|
|
341355
341243
|
}
|
|
341356
341244
|
return path83.normalize(expandedPath);
|
|
341357
341245
|
}
|
|
@@ -342280,7 +342168,7 @@ var mcpCommand2 = {
|
|
|
342280
342168
|
// packages/cli/src/ui/commands/memoryCommand.ts
|
|
342281
342169
|
init_esbuild_shims();
|
|
342282
342170
|
import path86 from "node:path";
|
|
342283
|
-
import
|
|
342171
|
+
import os30 from "os";
|
|
342284
342172
|
import fs76 from "fs/promises";
|
|
342285
342173
|
var memoryCommand = {
|
|
342286
342174
|
name: "memory",
|
|
@@ -342349,7 +342237,7 @@ ${memoryContent}
|
|
|
342349
342237
|
action: /* @__PURE__ */ __name(async (context2) => {
|
|
342350
342238
|
try {
|
|
342351
342239
|
const globalMemoryPath = path86.join(
|
|
342352
|
-
|
|
342240
|
+
os30.homedir(),
|
|
342353
342241
|
QWEN_DIR5,
|
|
342354
342242
|
"QWEN.md"
|
|
342355
342243
|
);
|
|
@@ -342992,7 +342880,7 @@ init_esbuild_shims();
|
|
|
342992
342880
|
// packages/cli/src/ui/utils/terminalSetup.ts
|
|
342993
342881
|
init_esbuild_shims();
|
|
342994
342882
|
import { promises as fs78 } from "node:fs";
|
|
342995
|
-
import * as
|
|
342883
|
+
import * as os31 from "node:os";
|
|
342996
342884
|
import * as path89 from "node:path";
|
|
342997
342885
|
import { exec as exec3 } from "node:child_process";
|
|
342998
342886
|
import { promisify as promisify7 } from "node:util";
|
|
@@ -343096,7 +342984,7 @@ async function detectTerminal() {
|
|
|
343096
342984
|
if (termProgram === "vscode" || process.env["VSCODE_GIT_IPC_HANDLE"]) {
|
|
343097
342985
|
return "vscode";
|
|
343098
342986
|
}
|
|
343099
|
-
if (
|
|
342987
|
+
if (os31.platform() !== "win32") {
|
|
343100
342988
|
try {
|
|
343101
342989
|
const { stdout } = await execAsync2("ps -o comm= -p $PPID");
|
|
343102
342990
|
const parentName = stdout.trim();
|
|
@@ -343124,10 +343012,10 @@ async function backupFile(filePath) {
|
|
|
343124
343012
|
}
|
|
343125
343013
|
__name(backupFile, "backupFile");
|
|
343126
343014
|
function getVSCodeStyleConfigDir(appName) {
|
|
343127
|
-
const platform14 =
|
|
343015
|
+
const platform14 = os31.platform();
|
|
343128
343016
|
if (platform14 === "darwin") {
|
|
343129
343017
|
return path89.join(
|
|
343130
|
-
|
|
343018
|
+
os31.homedir(),
|
|
343131
343019
|
"Library",
|
|
343132
343020
|
"Application Support",
|
|
343133
343021
|
appName,
|
|
@@ -343139,7 +343027,7 @@ function getVSCodeStyleConfigDir(appName) {
|
|
|
343139
343027
|
}
|
|
343140
343028
|
return path89.join(process.env["APPDATA"], appName, "User");
|
|
343141
343029
|
} else {
|
|
343142
|
-
return path89.join(
|
|
343030
|
+
return path89.join(os31.homedir(), ".config", appName, "User");
|
|
343143
343031
|
}
|
|
343144
343032
|
}
|
|
343145
343033
|
__name(getVSCodeStyleConfigDir, "getVSCodeStyleConfigDir");
|
|
@@ -343395,10 +343283,10 @@ import { Writable } from "node:stream";
|
|
|
343395
343283
|
// packages/cli/src/utils/gitUtils.ts
|
|
343396
343284
|
init_esbuild_shims();
|
|
343397
343285
|
var import_undici4 = __toESM(require_undici(), 1);
|
|
343398
|
-
import { execSync as
|
|
343286
|
+
import { execSync as execSync5 } from "node:child_process";
|
|
343399
343287
|
var isGitHubRepository = /* @__PURE__ */ __name(() => {
|
|
343400
343288
|
try {
|
|
343401
|
-
const remotes = (
|
|
343289
|
+
const remotes = (execSync5("git remote -v", {
|
|
343402
343290
|
encoding: "utf-8"
|
|
343403
343291
|
}) || "").trim();
|
|
343404
343292
|
const pattern = /github\.com/;
|
|
@@ -343409,7 +343297,7 @@ var isGitHubRepository = /* @__PURE__ */ __name(() => {
|
|
|
343409
343297
|
}
|
|
343410
343298
|
}, "isGitHubRepository");
|
|
343411
343299
|
var getGitRepoRoot = /* @__PURE__ */ __name(() => {
|
|
343412
|
-
const gitRepoRoot = (
|
|
343300
|
+
const gitRepoRoot = (execSync5("git rev-parse --show-toplevel", {
|
|
343413
343301
|
encoding: "utf-8"
|
|
343414
343302
|
}) || "").trim();
|
|
343415
343303
|
if (!gitRepoRoot) {
|
|
@@ -343449,7 +343337,7 @@ var getLatestGitHubRelease = /* @__PURE__ */ __name(async (proxy) => {
|
|
|
343449
343337
|
}
|
|
343450
343338
|
}, "getLatestGitHubRelease");
|
|
343451
343339
|
function getGitHubRepoInfo() {
|
|
343452
|
-
const remoteUrl =
|
|
343340
|
+
const remoteUrl = execSync5("git remote get-url origin", {
|
|
343453
343341
|
encoding: "utf-8"
|
|
343454
343342
|
}).trim();
|
|
343455
343343
|
const match2 = remoteUrl.match(
|
|
@@ -344451,7 +344339,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, addItem
|
|
|
344451
344339
|
const logger6 = (0, import_react108.useMemo)(() => {
|
|
344452
344340
|
const l2 = new Logger(
|
|
344453
344341
|
config?.getSessionId() || "",
|
|
344454
|
-
config?.storage ?? new Storage(
|
|
344342
|
+
config?.storage ?? new Storage(process37.cwd())
|
|
344455
344343
|
);
|
|
344456
344344
|
return l2;
|
|
344457
344345
|
}, [config]);
|
|
@@ -344471,13 +344359,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config, settings, addItem
|
|
|
344471
344359
|
if (message.type === "about" /* ABOUT */) {
|
|
344472
344360
|
historyItemContent = {
|
|
344473
344361
|
type: "about",
|
|
344474
|
-
|
|
344475
|
-
osVersion: message.osVersion,
|
|
344476
|
-
sandboxEnv: message.sandboxEnv,
|
|
344477
|
-
modelVersion: message.modelVersion,
|
|
344478
|
-
selectedAuthType: message.selectedAuthType,
|
|
344479
|
-
gcpProject: message.gcpProject,
|
|
344480
|
-
ideClient: message.ideClient
|
|
344362
|
+
systemInfo: message.systemInfo
|
|
344481
344363
|
};
|
|
344482
344364
|
} else if (message.type === "help" /* HELP */) {
|
|
344483
344365
|
historyItemContent = {
|
|
@@ -345035,7 +344917,7 @@ var import_react111 = __toESM(require_react(), 1);
|
|
|
345035
344917
|
init_node();
|
|
345036
344918
|
import crypto17 from "node:crypto";
|
|
345037
344919
|
import path92 from "node:path";
|
|
345038
|
-
import
|
|
344920
|
+
import os32 from "node:os";
|
|
345039
344921
|
import fs81 from "node:fs";
|
|
345040
344922
|
var OUTPUT_UPDATE_INTERVAL_MS2 = 1e3;
|
|
345041
344923
|
var MAX_OUTPUT_LENGTH = 1e4;
|
|
@@ -345072,14 +344954,14 @@ var useShellCommandProcessor = /* @__PURE__ */ __name((addItemToHistory, setPend
|
|
|
345072
344954
|
{ type: "user_shell", text: rawQuery },
|
|
345073
344955
|
userMessageTimestamp
|
|
345074
344956
|
);
|
|
345075
|
-
const isWindows8 =
|
|
344957
|
+
const isWindows8 = os32.platform() === "win32";
|
|
345076
344958
|
const targetDir = config.getTargetDir();
|
|
345077
344959
|
let commandToExecute = rawQuery;
|
|
345078
344960
|
let pwdFilePath;
|
|
345079
344961
|
if (!isWindows8) {
|
|
345080
344962
|
let command2 = rawQuery.trim();
|
|
345081
344963
|
const pwdFileName = `shell_pwd_${crypto17.randomBytes(6).toString("hex")}.tmp`;
|
|
345082
|
-
pwdFilePath = path92.join(
|
|
344964
|
+
pwdFilePath = path92.join(os32.tmpdir(), pwdFileName);
|
|
345083
344965
|
if (!command2.endsWith(";") && !command2.endsWith("&")) {
|
|
345084
344966
|
command2 += ";";
|
|
345085
344967
|
}
|
|
@@ -347930,7 +347812,7 @@ var useLoadingIndicator = /* @__PURE__ */ __name((streamingState, customWittyPhr
|
|
|
347930
347812
|
// packages/cli/src/ui/hooks/useFolderTrust.ts
|
|
347931
347813
|
init_esbuild_shims();
|
|
347932
347814
|
var import_react121 = __toESM(require_react(), 1);
|
|
347933
|
-
import * as
|
|
347815
|
+
import * as process38 from "node:process";
|
|
347934
347816
|
var useFolderTrust = /* @__PURE__ */ __name((settings, onTrustChange) => {
|
|
347935
347817
|
const [isTrusted, setIsTrusted] = (0, import_react121.useState)(void 0);
|
|
347936
347818
|
const [isFolderTrustDialogOpen, setIsFolderTrustDialogOpen] = (0, import_react121.useState)(false);
|
|
@@ -347945,7 +347827,7 @@ var useFolderTrust = /* @__PURE__ */ __name((settings, onTrustChange) => {
|
|
|
347945
347827
|
const handleFolderTrustSelect = (0, import_react121.useCallback)(
|
|
347946
347828
|
(choice2) => {
|
|
347947
347829
|
const trustedFolders = loadTrustedFolders();
|
|
347948
|
-
const cwd7 =
|
|
347830
|
+
const cwd7 = process38.cwd();
|
|
347949
347831
|
let trustLevel;
|
|
347950
347832
|
const wasTrusted = isTrusted ?? true;
|
|
347951
347833
|
switch (choice2) {
|
|
@@ -347991,7 +347873,7 @@ init_esbuild_shims();
|
|
|
347991
347873
|
|
|
347992
347874
|
// node_modules/update-notifier/update-notifier.js
|
|
347993
347875
|
init_esbuild_shims();
|
|
347994
|
-
import
|
|
347876
|
+
import process47 from "node:process";
|
|
347995
347877
|
import { spawn as spawn9 } from "node:child_process";
|
|
347996
347878
|
import { fileURLToPath as fileURLToPath12 } from "node:url";
|
|
347997
347879
|
import path102 from "node:path";
|
|
@@ -348001,13 +347883,13 @@ import { format as format3 } from "node:util";
|
|
|
348001
347883
|
init_esbuild_shims();
|
|
348002
347884
|
var import_graceful_fs = __toESM(require_graceful_fs(), 1);
|
|
348003
347885
|
import path98 from "node:path";
|
|
348004
|
-
import
|
|
347886
|
+
import os35 from "node:os";
|
|
348005
347887
|
|
|
348006
347888
|
// node_modules/xdg-basedir/index.js
|
|
348007
347889
|
init_esbuild_shims();
|
|
348008
|
-
import
|
|
347890
|
+
import os33 from "os";
|
|
348009
347891
|
import path95 from "path";
|
|
348010
|
-
var homeDirectory =
|
|
347892
|
+
var homeDirectory = os33.homedir();
|
|
348011
347893
|
var { env: env5 } = process;
|
|
348012
347894
|
var xdgData = env5.XDG_DATA_HOME || (homeDirectory ? path95.join(homeDirectory, ".local", "share") : void 0);
|
|
348013
347895
|
var xdgConfig = env5.XDG_CONFIG_HOME || (homeDirectory ? path95.join(homeDirectory, ".config") : void 0);
|
|
@@ -348051,8 +347933,8 @@ var attemptifySync = /* @__PURE__ */ __name((fn, onError2) => {
|
|
|
348051
347933
|
|
|
348052
347934
|
// node_modules/stubborn-fs/dist/constants.js
|
|
348053
347935
|
init_esbuild_shims();
|
|
348054
|
-
import
|
|
348055
|
-
var IS_USER_ROOT =
|
|
347936
|
+
import process39 from "node:process";
|
|
347937
|
+
var IS_USER_ROOT = process39.getuid ? !process39.getuid() : false;
|
|
348056
347938
|
var LIMIT_FILES_DESCRIPTORS = 1e4;
|
|
348057
347939
|
var NOOP2 = /* @__PURE__ */ __name(() => void 0, "NOOP");
|
|
348058
347940
|
|
|
@@ -348242,17 +348124,17 @@ var dist_default6 = FS;
|
|
|
348242
348124
|
|
|
348243
348125
|
// node_modules/atomically/dist/constants.js
|
|
348244
348126
|
init_esbuild_shims();
|
|
348245
|
-
import
|
|
348246
|
-
import
|
|
348127
|
+
import os34 from "node:os";
|
|
348128
|
+
import process40 from "node:process";
|
|
348247
348129
|
var DEFAULT_ENCODING2 = "utf8";
|
|
348248
348130
|
var DEFAULT_FILE_MODE = 438;
|
|
348249
348131
|
var DEFAULT_FOLDER_MODE = 511;
|
|
348250
348132
|
var DEFAULT_WRITE_OPTIONS = {};
|
|
348251
|
-
var DEFAULT_USER_UID =
|
|
348252
|
-
var DEFAULT_USER_GID =
|
|
348133
|
+
var DEFAULT_USER_UID = os34.userInfo().uid;
|
|
348134
|
+
var DEFAULT_USER_GID = os34.userInfo().gid;
|
|
348253
348135
|
var DEFAULT_TIMEOUT_SYNC = 1e3;
|
|
348254
|
-
var IS_POSIX = !!
|
|
348255
|
-
var IS_USER_ROOT2 =
|
|
348136
|
+
var IS_POSIX = !!process40.getuid;
|
|
348137
|
+
var IS_USER_ROOT2 = process40.getuid ? !process40.getuid() : false;
|
|
348256
348138
|
var LIMIT_BASENAME_LENGTH = 128;
|
|
348257
348139
|
|
|
348258
348140
|
// node_modules/atomically/dist/utils/lang.js
|
|
@@ -348279,13 +348161,13 @@ init_esbuild_shims();
|
|
|
348279
348161
|
|
|
348280
348162
|
// node_modules/when-exit/dist/node/interceptor.js
|
|
348281
348163
|
init_esbuild_shims();
|
|
348282
|
-
import
|
|
348164
|
+
import process42 from "node:process";
|
|
348283
348165
|
|
|
348284
348166
|
// node_modules/when-exit/dist/node/constants.js
|
|
348285
348167
|
init_esbuild_shims();
|
|
348286
|
-
import
|
|
348287
|
-
var IS_LINUX =
|
|
348288
|
-
var IS_WINDOWS =
|
|
348168
|
+
import process41 from "node:process";
|
|
348169
|
+
var IS_LINUX = process41.platform === "linux";
|
|
348170
|
+
var IS_WINDOWS = process41.platform === "win32";
|
|
348289
348171
|
|
|
348290
348172
|
// node_modules/when-exit/dist/node/signals.js
|
|
348291
348173
|
init_esbuild_shims();
|
|
@@ -348316,17 +348198,17 @@ var Interceptor = class {
|
|
|
348316
348198
|
}
|
|
348317
348199
|
if (signal) {
|
|
348318
348200
|
if (IS_WINDOWS && (signal !== "SIGINT" && signal !== "SIGTERM" && signal !== "SIGKILL")) {
|
|
348319
|
-
|
|
348201
|
+
process42.kill(process42.pid, "SIGTERM");
|
|
348320
348202
|
} else {
|
|
348321
|
-
|
|
348203
|
+
process42.kill(process42.pid, signal);
|
|
348322
348204
|
}
|
|
348323
348205
|
}
|
|
348324
348206
|
};
|
|
348325
348207
|
this.hook = () => {
|
|
348326
|
-
|
|
348208
|
+
process42.once("exit", () => this.exit());
|
|
348327
348209
|
for (const signal of signals_default) {
|
|
348328
348210
|
try {
|
|
348329
|
-
|
|
348211
|
+
process42.once(signal, () => this.exit(signal));
|
|
348330
348212
|
} catch {
|
|
348331
348213
|
}
|
|
348332
348214
|
}
|
|
@@ -348702,7 +348584,7 @@ __name(hasProperty, "hasProperty");
|
|
|
348702
348584
|
// node_modules/configstore/index.js
|
|
348703
348585
|
function getConfigDirectory(id, globalConfigPath) {
|
|
348704
348586
|
const pathPrefix = globalConfigPath ? path98.join(id, "config.json") : path98.join("configstore", `${id}.json`);
|
|
348705
|
-
const configDirectory = xdgConfig ?? import_graceful_fs.default.mkdtempSync(import_graceful_fs.default.realpathSync(
|
|
348587
|
+
const configDirectory = xdgConfig ?? import_graceful_fs.default.mkdtempSync(import_graceful_fs.default.realpathSync(os35.tmpdir()) + path98.sep);
|
|
348706
348588
|
return path98.join(configDirectory, pathPrefix);
|
|
348707
348589
|
}
|
|
348708
348590
|
__name(getConfigDirectory, "getConfigDirectory");
|
|
@@ -348980,17 +348862,17 @@ var ansi_styles_default6 = ansiStyles6;
|
|
|
348980
348862
|
|
|
348981
348863
|
// node_modules/update-notifier/node_modules/chalk/source/vendor/supports-color/index.js
|
|
348982
348864
|
init_esbuild_shims();
|
|
348983
|
-
import
|
|
348984
|
-
import
|
|
348865
|
+
import process43 from "node:process";
|
|
348866
|
+
import os36 from "node:os";
|
|
348985
348867
|
import tty2 from "node:tty";
|
|
348986
|
-
function hasFlag2(flag, argv = globalThis.Deno ? globalThis.Deno.args :
|
|
348868
|
+
function hasFlag2(flag, argv = globalThis.Deno ? globalThis.Deno.args : process43.argv) {
|
|
348987
348869
|
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
348988
348870
|
const position = argv.indexOf(prefix + flag);
|
|
348989
348871
|
const terminatorPosition = argv.indexOf("--");
|
|
348990
348872
|
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
348991
348873
|
}
|
|
348992
348874
|
__name(hasFlag2, "hasFlag");
|
|
348993
|
-
var { env: env6 } =
|
|
348875
|
+
var { env: env6 } = process43;
|
|
348994
348876
|
var flagForceColor2;
|
|
348995
348877
|
if (hasFlag2("no-color") || hasFlag2("no-colors") || hasFlag2("color=false") || hasFlag2("color=never")) {
|
|
348996
348878
|
flagForceColor2 = 0;
|
|
@@ -349048,8 +348930,8 @@ function _supportsColor2(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
|
349048
348930
|
if (env6.TERM === "dumb") {
|
|
349049
348931
|
return min;
|
|
349050
348932
|
}
|
|
349051
|
-
if (
|
|
349052
|
-
const osRelease =
|
|
348933
|
+
if (process43.platform === "win32") {
|
|
348934
|
+
const osRelease = os36.release().split(".");
|
|
349053
348935
|
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
349054
348936
|
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
349055
348937
|
}
|
|
@@ -350026,9 +349908,9 @@ __name(latestVersion, "latestVersion");
|
|
|
350026
349908
|
|
|
350027
349909
|
// node_modules/is-npm/index.js
|
|
350028
349910
|
init_esbuild_shims();
|
|
350029
|
-
import
|
|
350030
|
-
var packageJson3 =
|
|
350031
|
-
var userAgent =
|
|
349911
|
+
import process44 from "node:process";
|
|
349912
|
+
var packageJson3 = process44.env.npm_package_json;
|
|
349913
|
+
var userAgent = process44.env.npm_config_user_agent;
|
|
350032
349914
|
var isNpm6 = Boolean(userAgent && userAgent.startsWith("npm"));
|
|
350033
349915
|
var isNpm7 = Boolean(packageJson3 && packageJson3.endsWith("package.json"));
|
|
350034
349916
|
var isNpm = isNpm6 || isNpm7;
|
|
@@ -350044,49 +349926,49 @@ import { fileURLToPath as fileURLToPath11 } from "node:url";
|
|
|
350044
349926
|
// node_modules/global-directory/index.js
|
|
350045
349927
|
init_esbuild_shims();
|
|
350046
349928
|
var import_ini2 = __toESM(require_ini3(), 1);
|
|
350047
|
-
import
|
|
349929
|
+
import process45 from "node:process";
|
|
350048
349930
|
import path99 from "node:path";
|
|
350049
|
-
import
|
|
349931
|
+
import os37 from "node:os";
|
|
350050
349932
|
import fs86 from "node:fs";
|
|
350051
|
-
var isWindows7 =
|
|
349933
|
+
var isWindows7 = process45.platform === "win32";
|
|
350052
349934
|
var readRc = /* @__PURE__ */ __name((filePath) => {
|
|
350053
349935
|
try {
|
|
350054
349936
|
return import_ini2.default.parse(fs86.readFileSync(filePath, "utf8")).prefix;
|
|
350055
349937
|
} catch {
|
|
350056
349938
|
}
|
|
350057
349939
|
}, "readRc");
|
|
350058
|
-
var getEnvNpmPrefix = /* @__PURE__ */ __name(() => Object.keys(
|
|
349940
|
+
var getEnvNpmPrefix = /* @__PURE__ */ __name(() => Object.keys(process45.env).reduce((prefix, name3) => /^npm_config_prefix$/i.test(name3) ? process45.env[name3] : prefix, void 0), "getEnvNpmPrefix");
|
|
350059
349941
|
var getGlobalNpmrc = /* @__PURE__ */ __name(() => {
|
|
350060
|
-
if (isWindows7 &&
|
|
350061
|
-
return path99.join(
|
|
349942
|
+
if (isWindows7 && process45.env.APPDATA) {
|
|
349943
|
+
return path99.join(process45.env.APPDATA, "/npm/etc/npmrc");
|
|
350062
349944
|
}
|
|
350063
|
-
if (
|
|
350064
|
-
const homebrewPrefix =
|
|
349945
|
+
if (process45.execPath.includes("/Cellar/node")) {
|
|
349946
|
+
const homebrewPrefix = process45.execPath.slice(0, process45.execPath.indexOf("/Cellar/node"));
|
|
350065
349947
|
return path99.join(homebrewPrefix, "/lib/node_modules/npm/npmrc");
|
|
350066
349948
|
}
|
|
350067
|
-
if (
|
|
350068
|
-
const installDir = path99.dirname(path99.dirname(
|
|
349949
|
+
if (process45.execPath.endsWith("/bin/node")) {
|
|
349950
|
+
const installDir = path99.dirname(path99.dirname(process45.execPath));
|
|
350069
349951
|
return path99.join(installDir, "/etc/npmrc");
|
|
350070
349952
|
}
|
|
350071
349953
|
}, "getGlobalNpmrc");
|
|
350072
349954
|
var getDefaultNpmPrefix = /* @__PURE__ */ __name(() => {
|
|
350073
349955
|
if (isWindows7) {
|
|
350074
|
-
const { APPDATA } =
|
|
350075
|
-
return APPDATA ? path99.join(APPDATA, "npm") : path99.dirname(
|
|
349956
|
+
const { APPDATA } = process45.env;
|
|
349957
|
+
return APPDATA ? path99.join(APPDATA, "npm") : path99.dirname(process45.execPath);
|
|
350076
349958
|
}
|
|
350077
|
-
return path99.dirname(path99.dirname(
|
|
349959
|
+
return path99.dirname(path99.dirname(process45.execPath));
|
|
350078
349960
|
}, "getDefaultNpmPrefix");
|
|
350079
349961
|
var getNpmPrefix = /* @__PURE__ */ __name(() => {
|
|
350080
349962
|
const envPrefix = getEnvNpmPrefix();
|
|
350081
349963
|
if (envPrefix) {
|
|
350082
349964
|
return envPrefix;
|
|
350083
349965
|
}
|
|
350084
|
-
const homePrefix = readRc(path99.join(
|
|
349966
|
+
const homePrefix = readRc(path99.join(os37.homedir(), ".npmrc"));
|
|
350085
349967
|
if (homePrefix) {
|
|
350086
349968
|
return homePrefix;
|
|
350087
349969
|
}
|
|
350088
|
-
if (
|
|
350089
|
-
return
|
|
349970
|
+
if (process45.env.PREFIX) {
|
|
349971
|
+
return process45.env.PREFIX;
|
|
350090
349972
|
}
|
|
350091
349973
|
const globalPrefix = readRc(getGlobalNpmrc());
|
|
350092
349974
|
if (globalPrefix) {
|
|
@@ -350096,8 +349978,8 @@ var getNpmPrefix = /* @__PURE__ */ __name(() => {
|
|
|
350096
349978
|
}, "getNpmPrefix");
|
|
350097
349979
|
var npmPrefix = path99.resolve(getNpmPrefix());
|
|
350098
349980
|
var getYarnWindowsDirectory = /* @__PURE__ */ __name(() => {
|
|
350099
|
-
if (isWindows7 &&
|
|
350100
|
-
const dir = path99.join(
|
|
349981
|
+
if (isWindows7 && process45.env.LOCALAPPDATA) {
|
|
349982
|
+
const dir = path99.join(process45.env.LOCALAPPDATA, "Yarn");
|
|
350101
349983
|
if (fs86.existsSync(dir)) {
|
|
350102
349984
|
return dir;
|
|
350103
349985
|
}
|
|
@@ -350105,18 +349987,18 @@ var getYarnWindowsDirectory = /* @__PURE__ */ __name(() => {
|
|
|
350105
349987
|
return false;
|
|
350106
349988
|
}, "getYarnWindowsDirectory");
|
|
350107
349989
|
var getYarnPrefix = /* @__PURE__ */ __name(() => {
|
|
350108
|
-
if (
|
|
350109
|
-
return
|
|
349990
|
+
if (process45.env.PREFIX) {
|
|
349991
|
+
return process45.env.PREFIX;
|
|
350110
349992
|
}
|
|
350111
349993
|
const windowsPrefix = getYarnWindowsDirectory();
|
|
350112
349994
|
if (windowsPrefix) {
|
|
350113
349995
|
return windowsPrefix;
|
|
350114
349996
|
}
|
|
350115
|
-
const configPrefix = path99.join(
|
|
349997
|
+
const configPrefix = path99.join(os37.homedir(), ".config/yarn");
|
|
350116
349998
|
if (fs86.existsSync(configPrefix)) {
|
|
350117
349999
|
return configPrefix;
|
|
350118
350000
|
}
|
|
350119
|
-
const homePrefix = path99.join(
|
|
350001
|
+
const homePrefix = path99.join(os37.homedir(), ".yarn-config");
|
|
350120
350002
|
if (fs86.existsSync(homePrefix)) {
|
|
350121
350003
|
return homePrefix;
|
|
350122
350004
|
}
|
|
@@ -350158,7 +350040,7 @@ var is_installed_globally_default = isInstalledGlobally;
|
|
|
350158
350040
|
|
|
350159
350041
|
// node_modules/update-notifier/node_modules/boxen/index.js
|
|
350160
350042
|
init_esbuild_shims();
|
|
350161
|
-
import
|
|
350043
|
+
import process46 from "node:process";
|
|
350162
350044
|
|
|
350163
350045
|
// node_modules/update-notifier/node_modules/string-width/index.js
|
|
350164
350046
|
init_esbuild_shims();
|
|
@@ -350317,7 +350199,7 @@ var NEWLINE = "\n";
|
|
|
350317
350199
|
var PAD = " ";
|
|
350318
350200
|
var NONE = "none";
|
|
350319
350201
|
var terminalColumns = /* @__PURE__ */ __name(() => {
|
|
350320
|
-
const { env: env7, stdout, stderr } =
|
|
350202
|
+
const { env: env7, stdout, stderr } = process46;
|
|
350321
350203
|
if (stdout?.columns) {
|
|
350322
350204
|
return stdout.columns;
|
|
350323
350205
|
}
|
|
@@ -350500,8 +350382,8 @@ var boxContent = /* @__PURE__ */ __name((content, contentWidth, options2) => {
|
|
|
350500
350382
|
return result;
|
|
350501
350383
|
}, "boxContent");
|
|
350502
350384
|
var sanitizeOptions = /* @__PURE__ */ __name((options2) => {
|
|
350503
|
-
if (options2.fullscreen &&
|
|
350504
|
-
let newDimensions = [
|
|
350385
|
+
if (options2.fullscreen && process46?.stdout) {
|
|
350386
|
+
let newDimensions = [process46.stdout.columns, process46.stdout.rows];
|
|
350505
350387
|
if (typeof options2.fullscreen === "function") {
|
|
350506
350388
|
newDimensions = options2.fullscreen(...newDimensions);
|
|
350507
350389
|
}
|
|
@@ -350676,7 +350558,7 @@ var UpdateNotifier = class {
|
|
|
350676
350558
|
this._packageName = options2.pkg.name;
|
|
350677
350559
|
this.#packageVersion = options2.pkg.version;
|
|
350678
350560
|
this.#updateCheckInterval = typeof options2.updateCheckInterval === "number" ? options2.updateCheckInterval : ONE_DAY;
|
|
350679
|
-
this.#isDisabled = "NO_UPDATE_NOTIFIER" in
|
|
350561
|
+
this.#isDisabled = "NO_UPDATE_NOTIFIER" in process47.env || process47.env.NODE_ENV === "test" || process47.argv.includes("--no-update-notifier") || is_in_ci_default;
|
|
350680
350562
|
this._shouldNotifyInNpmScript = options2.shouldNotifyInNpmScript;
|
|
350681
350563
|
if (!this.#isDisabled) {
|
|
350682
350564
|
try {
|
|
@@ -350688,7 +350570,7 @@ var UpdateNotifier = class {
|
|
|
350688
350570
|
});
|
|
350689
350571
|
} catch {
|
|
350690
350572
|
const message = source_default2.yellow(format3(" %s update check failed ", options2.pkg.name)) + format3("\n Try running with %s or get access ", source_default2.cyan("sudo")) + "\n to the local update config store via \n" + source_default2.cyan(format3(" sudo chown -R $USER:$(id -gn $USER) %s ", xdgConfig));
|
|
350691
|
-
|
|
350573
|
+
process47.on("exit", () => {
|
|
350692
350574
|
console.error(boxen(message, { textAlignment: "center" }));
|
|
350693
350575
|
});
|
|
350694
350576
|
}
|
|
@@ -350706,7 +350588,7 @@ var UpdateNotifier = class {
|
|
|
350706
350588
|
if (Date.now() - this.config.get("lastUpdateCheck") < this.#updateCheckInterval) {
|
|
350707
350589
|
return;
|
|
350708
350590
|
}
|
|
350709
|
-
spawn9(
|
|
350591
|
+
spawn9(process47.execPath, [path102.join(__dirname8, "check.js"), JSON.stringify(this.#options)], {
|
|
350710
350592
|
detached: true,
|
|
350711
350593
|
stdio: "ignore"
|
|
350712
350594
|
}).unref();
|
|
@@ -350723,7 +350605,7 @@ var UpdateNotifier = class {
|
|
|
350723
350605
|
}
|
|
350724
350606
|
notify(options2) {
|
|
350725
350607
|
const suppressForNpm = !this._shouldNotifyInNpmScript && isNpmOrYarn;
|
|
350726
|
-
if (!
|
|
350608
|
+
if (!process47.stdout.isTTY || suppressForNpm || !this.update || !(0, import_gt.default)(this.update.latest, this.update.current)) {
|
|
350727
350609
|
return this;
|
|
350728
350610
|
}
|
|
350729
350611
|
options2 = {
|
|
@@ -350752,7 +350634,7 @@ var UpdateNotifier = class {
|
|
|
350752
350634
|
if (options2.defer === false) {
|
|
350753
350635
|
console.error(message);
|
|
350754
350636
|
} else {
|
|
350755
|
-
|
|
350637
|
+
process47.on("exit", () => {
|
|
350756
350638
|
console.error(message);
|
|
350757
350639
|
});
|
|
350758
350640
|
}
|
|
@@ -351206,7 +351088,7 @@ __name(useAutoAcceptIndicator, "useAutoAcceptIndicator");
|
|
|
351206
351088
|
// packages/cli/src/ui/hooks/useWorkspaceMigration.ts
|
|
351207
351089
|
init_esbuild_shims();
|
|
351208
351090
|
var import_react124 = __toESM(require_react(), 1);
|
|
351209
|
-
import
|
|
351091
|
+
import process48 from "node:process";
|
|
351210
351092
|
function useWorkspaceMigration(settings) {
|
|
351211
351093
|
const [showWorkspaceMigrationDialog, setShowWorkspaceMigrationDialog] = (0, import_react124.useState)(false);
|
|
351212
351094
|
const [workspaceExtensions, setWorkspaceExtensions] = (0, import_react124.useState)(
|
|
@@ -351216,7 +351098,7 @@ function useWorkspaceMigration(settings) {
|
|
|
351216
351098
|
if (!(settings.merged.experimental?.extensionManagement ?? true)) {
|
|
351217
351099
|
return;
|
|
351218
351100
|
}
|
|
351219
|
-
const cwd7 =
|
|
351101
|
+
const cwd7 = process48.cwd();
|
|
351220
351102
|
const extensions = getWorkspaceExtensions(cwd7);
|
|
351221
351103
|
if (extensions.length > 0 && !settings.merged.extensions?.workspacesWithMigrationNudge?.includes(cwd7)) {
|
|
351222
351104
|
setWorkspaceExtensions(extensions);
|
|
@@ -351233,7 +351115,7 @@ function useWorkspaceMigration(settings) {
|
|
|
351233
351115
|
disabled: []
|
|
351234
351116
|
};
|
|
351235
351117
|
const workspacesWithMigrationNudge = extensionSettings.workspacesWithMigrationNudge || [];
|
|
351236
|
-
const cwd7 =
|
|
351118
|
+
const cwd7 = process48.cwd();
|
|
351237
351119
|
if (!workspacesWithMigrationNudge.includes(cwd7)) {
|
|
351238
351120
|
workspacesWithMigrationNudge.push(cwd7);
|
|
351239
351121
|
}
|
|
@@ -351876,7 +351758,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
351876
351758
|
setQuittingMessages(messages);
|
|
351877
351759
|
setTimeout(async () => {
|
|
351878
351760
|
await runExitCleanup();
|
|
351879
|
-
|
|
351761
|
+
process49.exit(0);
|
|
351880
351762
|
}, 100);
|
|
351881
351763
|
}, "quit"),
|
|
351882
351764
|
setDebugMessage,
|
|
@@ -351943,6 +351825,9 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
351943
351825
|
},
|
|
351944
351826
|
[visionSwitchResolver]
|
|
351945
351827
|
);
|
|
351828
|
+
const onDebugMessage = (0, import_react132.useCallback)((message) => {
|
|
351829
|
+
console.debug(message);
|
|
351830
|
+
}, []);
|
|
351946
351831
|
const performMemoryRefresh = (0, import_react132.useCallback)(async () => {
|
|
351947
351832
|
historyManager.addItem(
|
|
351948
351833
|
{
|
|
@@ -351953,7 +351838,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
351953
351838
|
);
|
|
351954
351839
|
try {
|
|
351955
351840
|
const { memoryContent, fileCount } = await loadHierarchicalGeminiMemory(
|
|
351956
|
-
|
|
351841
|
+
process49.cwd(),
|
|
351957
351842
|
settings.merged.context?.loadMemoryFromIncludeDirectories ? config.getWorkspaceContext().getDirectories() : [],
|
|
351958
351843
|
config.getDebugMode(),
|
|
351959
351844
|
config.getFileService(),
|
|
@@ -352012,7 +351897,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
352012
351897
|
historyManager.addItem,
|
|
352013
351898
|
config,
|
|
352014
351899
|
settings,
|
|
352015
|
-
|
|
351900
|
+
onDebugMessage,
|
|
352016
351901
|
handleSlashCommand2,
|
|
352017
351902
|
shellModeActive,
|
|
352018
351903
|
() => settings.merged.general?.preferredEditor,
|
|
@@ -352741,15 +352626,15 @@ __name(readStdin, "readStdin");
|
|
|
352741
352626
|
// packages/cli/src/gemini.tsx
|
|
352742
352627
|
import { basename as basename15 } from "node:path";
|
|
352743
352628
|
import v8 from "node:v8";
|
|
352744
|
-
import
|
|
352629
|
+
import os41 from "node:os";
|
|
352745
352630
|
import dns from "node:dns";
|
|
352746
352631
|
import { randomUUID as randomUUID8 } from "node:crypto";
|
|
352747
352632
|
|
|
352748
352633
|
// packages/cli/src/utils/sandbox.ts
|
|
352749
352634
|
init_esbuild_shims();
|
|
352750
352635
|
var import_shell_quote5 = __toESM(require_shell_quote(), 1);
|
|
352751
|
-
import { exec as exec4, execSync as
|
|
352752
|
-
import
|
|
352636
|
+
import { exec as exec4, execSync as execSync7, spawn as spawn11 } from "node:child_process";
|
|
352637
|
+
import os38 from "node:os";
|
|
352753
352638
|
import path105 from "node:path";
|
|
352754
352639
|
import fs91 from "node:fs";
|
|
352755
352640
|
import { readFile as readFile10 } from "node:fs/promises";
|
|
@@ -352758,7 +352643,7 @@ import { promisify as promisify9 } from "node:util";
|
|
|
352758
352643
|
import { randomBytes as randomBytes5 } from "node:crypto";
|
|
352759
352644
|
var execAsync3 = promisify9(exec4);
|
|
352760
352645
|
function getContainerPath(hostPath) {
|
|
352761
|
-
if (
|
|
352646
|
+
if (os38.platform() !== "win32") {
|
|
352762
352647
|
return hostPath;
|
|
352763
352648
|
}
|
|
352764
352649
|
const withForwardSlashes = hostPath.replace(/\\/g, "/");
|
|
@@ -352788,7 +352673,7 @@ async function shouldUseCurrentUserInSandbox() {
|
|
|
352788
352673
|
if (envVar === "0" || envVar === "false") {
|
|
352789
352674
|
return false;
|
|
352790
352675
|
}
|
|
352791
|
-
if (
|
|
352676
|
+
if (os38.platform() === "linux") {
|
|
352792
352677
|
try {
|
|
352793
352678
|
const osReleaseContent = await readFile10("/etc/os-release", "utf8");
|
|
352794
352679
|
if (osReleaseContent.includes("ID=debian") || osReleaseContent.includes("ID=ubuntu") || osReleaseContent.match(/^ID_LIKE=.*debian.*/m) || // Covers derivatives
|
|
@@ -352818,7 +352703,7 @@ function ports() {
|
|
|
352818
352703
|
}
|
|
352819
352704
|
__name(ports, "ports");
|
|
352820
352705
|
function entrypoint(workdir, cliArgs) {
|
|
352821
|
-
const isWindows8 =
|
|
352706
|
+
const isWindows8 = os38.platform() === "win32";
|
|
352822
352707
|
const containerWorkdir = getContainerPath(workdir);
|
|
352823
352708
|
const shellCmds = [];
|
|
352824
352709
|
const pathSeparator = isWindows8 ? ";" : ":";
|
|
@@ -352903,11 +352788,11 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
352903
352788
|
"-D",
|
|
352904
352789
|
`TARGET_DIR=${fs91.realpathSync(process.cwd())}`,
|
|
352905
352790
|
"-D",
|
|
352906
|
-
`TMP_DIR=${fs91.realpathSync(
|
|
352791
|
+
`TMP_DIR=${fs91.realpathSync(os38.tmpdir())}`,
|
|
352907
352792
|
"-D",
|
|
352908
|
-
`HOME_DIR=${fs91.realpathSync(
|
|
352793
|
+
`HOME_DIR=${fs91.realpathSync(os38.homedir())}`,
|
|
352909
352794
|
"-D",
|
|
352910
|
-
`CACHE_DIR=${fs91.realpathSync(
|
|
352795
|
+
`CACHE_DIR=${fs91.realpathSync(execSync7(`getconf DARWIN_USER_CACHE_DIR`).toString().trim())}`
|
|
352911
352796
|
];
|
|
352912
352797
|
const MAX_INCLUDE_DIRS = 5;
|
|
352913
352798
|
const targetDir = fs91.realpathSync(cliConfig?.getTargetDir() || "");
|
|
@@ -353025,7 +352910,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
353025
352910
|
console.error(`using ${projectSandboxDockerfile2} for sandbox`);
|
|
353026
352911
|
buildArgs += `-f ${path105.resolve(projectSandboxDockerfile2)} -i ${image2}`;
|
|
353027
352912
|
}
|
|
353028
|
-
|
|
352913
|
+
execSync7(
|
|
353029
352914
|
`cd ${gcRoot} && node scripts/build_sandbox.js -s ${buildArgs}`,
|
|
353030
352915
|
{
|
|
353031
352916
|
stdio: "inherit",
|
|
@@ -353073,8 +352958,8 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
353073
352958
|
`${userSettingsDirOnHost}:${getContainerPath(userSettingsDirOnHost)}`
|
|
353074
352959
|
);
|
|
353075
352960
|
}
|
|
353076
|
-
args.push("--volume", `${
|
|
353077
|
-
const gcloudConfigDir = path105.join(
|
|
352961
|
+
args.push("--volume", `${os38.tmpdir()}:${getContainerPath(os38.tmpdir())}`);
|
|
352962
|
+
const gcloudConfigDir = path105.join(os38.homedir(), ".config", "gcloud");
|
|
353078
352963
|
if (fs91.existsSync(gcloudConfigDir)) {
|
|
353079
352964
|
args.push(
|
|
353080
352965
|
"--volume",
|
|
@@ -353134,12 +353019,12 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
353134
353019
|
args.push("--env", `no_proxy=${noProxy}`);
|
|
353135
353020
|
}
|
|
353136
353021
|
if (proxy) {
|
|
353137
|
-
|
|
353022
|
+
execSync7(
|
|
353138
353023
|
`${config.command} network inspect ${SANDBOX_NETWORK_NAME} || ${config.command} network create --internal ${SANDBOX_NETWORK_NAME}`
|
|
353139
353024
|
);
|
|
353140
353025
|
args.push("--network", SANDBOX_NETWORK_NAME);
|
|
353141
353026
|
if (proxyCommand) {
|
|
353142
|
-
|
|
353027
|
+
execSync7(
|
|
353143
353028
|
`${config.command} network inspect ${SANDBOX_PROXY_NAME} || ${config.command} network create ${SANDBOX_PROXY_NAME}`
|
|
353144
353029
|
);
|
|
353145
353030
|
}
|
|
@@ -353155,7 +353040,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
353155
353040
|
console.log(`ContainerName: ${containerName}`);
|
|
353156
353041
|
} else {
|
|
353157
353042
|
let index = 0;
|
|
353158
|
-
const containerNameCheck =
|
|
353043
|
+
const containerNameCheck = execSync7(
|
|
353159
353044
|
`${config.command} ps -a --format "{{.Names}}"`
|
|
353160
353045
|
).toString().trim();
|
|
353161
353046
|
while (containerNameCheck.includes(`${imageName}-${index}`)) {
|
|
@@ -353272,7 +353157,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
353272
353157
|
}
|
|
353273
353158
|
args.push("--env", `SANDBOX=${containerName}`);
|
|
353274
353159
|
if (config.command === "podman") {
|
|
353275
|
-
const emptyAuthFilePath = path105.join(
|
|
353160
|
+
const emptyAuthFilePath = path105.join(os38.tmpdir(), "empty_auth.json");
|
|
353276
353161
|
fs91.writeFileSync(emptyAuthFilePath, "{}", "utf-8");
|
|
353277
353162
|
args.push("--authfile", emptyAuthFilePath);
|
|
353278
353163
|
}
|
|
@@ -353283,10 +353168,10 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
353283
353168
|
userFlag = "--user root";
|
|
353284
353169
|
} else if (await shouldUseCurrentUserInSandbox()) {
|
|
353285
353170
|
args.push("--user", "root");
|
|
353286
|
-
const uid =
|
|
353287
|
-
const gid =
|
|
353171
|
+
const uid = execSync7("id -u").toString().trim();
|
|
353172
|
+
const gid = execSync7("id -g").toString().trim();
|
|
353288
353173
|
const username = "gemini";
|
|
353289
|
-
const homeDir = getContainerPath(
|
|
353174
|
+
const homeDir = getContainerPath(os38.homedir());
|
|
353290
353175
|
const setupUserCommands = [
|
|
353291
353176
|
// Use -f with groupadd to avoid errors if the group already exists.
|
|
353292
353177
|
`groupadd -f -g ${gid} ${username}`,
|
|
@@ -353298,7 +353183,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
353298
353183
|
const suCommand = `su -p ${username} -c '${escapedOriginalCommand}'`;
|
|
353299
353184
|
finalEntrypoint[2] = `${setupUserCommands} && ${suCommand}`;
|
|
353300
353185
|
userFlag = `--user ${uid}:${gid}`;
|
|
353301
|
-
args.push("--env", `HOME=${
|
|
353186
|
+
args.push("--env", `HOME=${os38.homedir()}`);
|
|
353302
353187
|
}
|
|
353303
353188
|
args.push(image2);
|
|
353304
353189
|
args.push(...finalEntrypoint);
|
|
@@ -353313,7 +353198,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
353313
353198
|
});
|
|
353314
353199
|
const stopProxy = /* @__PURE__ */ __name(() => {
|
|
353315
353200
|
console.log("stopping proxy container ...");
|
|
353316
|
-
|
|
353201
|
+
execSync7(`${config.command} rm -f ${SANDBOX_PROXY_NAME}`);
|
|
353317
353202
|
}, "stopProxy");
|
|
353318
353203
|
process.on("exit", stopProxy);
|
|
353319
353204
|
process.on("SIGINT", stopProxy);
|
|
@@ -353475,9 +353360,9 @@ __name(ensureSandboxImageIsPresent, "ensureSandboxImageIsPresent");
|
|
|
353475
353360
|
// packages/cli/src/utils/startupWarnings.ts
|
|
353476
353361
|
init_esbuild_shims();
|
|
353477
353362
|
import fs92 from "node:fs/promises";
|
|
353478
|
-
import
|
|
353363
|
+
import os39 from "node:os";
|
|
353479
353364
|
import { join as pathJoin } from "node:path";
|
|
353480
|
-
var warningsFilePath = pathJoin(
|
|
353365
|
+
var warningsFilePath = pathJoin(os39.tmpdir(), "qwen-code-warnings.txt");
|
|
353481
353366
|
async function getStartupWarnings() {
|
|
353482
353367
|
try {
|
|
353483
353368
|
await fs92.access(warningsFilePath);
|
|
@@ -353501,7 +353386,7 @@ __name(getStartupWarnings, "getStartupWarnings");
|
|
|
353501
353386
|
// packages/cli/src/utils/userStartupWarnings.ts
|
|
353502
353387
|
init_esbuild_shims();
|
|
353503
353388
|
import fs93 from "node:fs/promises";
|
|
353504
|
-
import * as
|
|
353389
|
+
import * as os40 from "node:os";
|
|
353505
353390
|
import path106 from "node:path";
|
|
353506
353391
|
var homeDirectoryCheck = {
|
|
353507
353392
|
id: "home-directory",
|
|
@@ -353509,7 +353394,7 @@ var homeDirectoryCheck = {
|
|
|
353509
353394
|
try {
|
|
353510
353395
|
const [workspaceRealPath, homeRealPath] = await Promise.all([
|
|
353511
353396
|
fs93.realpath(options2.workspaceRoot),
|
|
353512
|
-
fs93.realpath(
|
|
353397
|
+
fs93.realpath(os40.homedir())
|
|
353513
353398
|
]);
|
|
353514
353399
|
if (workspaceRealPath === homeRealPath) {
|
|
353515
353400
|
return "You are running Qwen Code in your home directory. It is recommended to run in a project-specific directory.";
|
|
@@ -355268,7 +355153,7 @@ function validateDnsResolutionOrder(order) {
|
|
|
355268
355153
|
}
|
|
355269
355154
|
__name(validateDnsResolutionOrder, "validateDnsResolutionOrder");
|
|
355270
355155
|
function getNodeMemoryArgs(isDebugMode2) {
|
|
355271
|
-
const totalMemoryMB =
|
|
355156
|
+
const totalMemoryMB = os41.totalmem() / (1024 * 1024);
|
|
355272
355157
|
const heapStats = v8.getHeapStatistics();
|
|
355273
355158
|
const currentMaxOldSpaceSizeMb = Math.floor(
|
|
355274
355159
|
heapStats.heap_size_limit / 1024 / 1024
|