natureco-cli 5.6.32 → 5.6.34
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/package.json +1 -1
- package/src/tools/grep_search.js +30 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "natureco-cli",
|
|
3
|
-
"version": "5.6.
|
|
3
|
+
"version": "5.6.34",
|
|
4
4
|
"description": "OpenClaw'dan daha güvenli, daha hızlı, daha ucuz AI agent CLI. Multi-agent, self-evolving skills, audit log, maliyet optimizasyonu ve NatureCo platform-native.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"natureco": "bin/natureco.js"
|
package/src/tools/grep_search.js
CHANGED
|
@@ -71,8 +71,21 @@ async function grepWithRipgrep(pattern, cwd, caseSensitive, includePattern, maxR
|
|
|
71
71
|
const proc = spawn('rg', args, { cwd });
|
|
72
72
|
let stdout = '';
|
|
73
73
|
let stderr = '';
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
// v5.6.32: Memory taşmasını önle - max 5MB output
|
|
75
|
+
let stdoutBytes = 0;
|
|
76
|
+
const MAX_OUTPUT = 5 * 1024 * 1024; // 5MB
|
|
77
|
+
let truncated = false;
|
|
78
|
+
const addStdout = (d) => {
|
|
79
|
+
if (truncated) return;
|
|
80
|
+
stdoutBytes += d.length;
|
|
81
|
+
if (stdoutBytes > MAX_OUTPUT) {
|
|
82
|
+
truncated = true;
|
|
83
|
+
stdout += '\n[OUTPUT TRUNCATED - exceeded 5MB limit]';
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
stdout += d.toString();
|
|
87
|
+
};
|
|
88
|
+
proc.stdout.on('data', addStdout);
|
|
76
89
|
|
|
77
90
|
let finished = false;
|
|
78
91
|
const finishOnce = () => {
|
|
@@ -105,8 +118,6 @@ async function grepWithRipgrep(pattern, cwd, caseSensitive, includePattern, maxR
|
|
|
105
118
|
setTimeout(finishOnce, 100);
|
|
106
119
|
}
|
|
107
120
|
};
|
|
108
|
-
proc.stdout.on('data', d => stdout += d.toString());
|
|
109
|
-
proc.stderr.on('data', d => stderr += d.toString());
|
|
110
121
|
proc.stdout.on('end', () => { stdoutClosed = true; checkFinish(); });
|
|
111
122
|
proc.stderr.on('end', () => { stderrClosed = true; checkFinish(); });
|
|
112
123
|
proc.on('exit', (code) => { exitCode = code; checkFinish(); });
|
|
@@ -125,8 +136,21 @@ async function grepWithFallback(pattern, cwd, caseSensitive, maxResults) {
|
|
|
125
136
|
const proc = spawn('grep', args);
|
|
126
137
|
let stdout = '';
|
|
127
138
|
let stderr = '';
|
|
128
|
-
|
|
129
|
-
|
|
139
|
+
// v5.6.32: Memory taşmasını önle - max 5MB output
|
|
140
|
+
let stdoutBytes = 0;
|
|
141
|
+
const MAX_OUTPUT = 5 * 1024 * 1024; // 5MB
|
|
142
|
+
let truncated = false;
|
|
143
|
+
const addStdout = (d) => {
|
|
144
|
+
if (truncated) return;
|
|
145
|
+
stdoutBytes += d.length;
|
|
146
|
+
if (stdoutBytes > MAX_OUTPUT) {
|
|
147
|
+
truncated = true;
|
|
148
|
+
stdout += '\n[OUTPUT TRUNCATED - exceeded 5MB limit]';
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
stdout += d.toString();
|
|
152
|
+
};
|
|
153
|
+
proc.stdout.on('data', addStdout);
|
|
130
154
|
|
|
131
155
|
proc.on('close', (code) => {
|
|
132
156
|
const results = [];
|