natureco-cli 5.6.31 → 5.6.33

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "natureco-cli",
3
- "version": "5.6.31",
3
+ "version": "5.6.33",
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"
@@ -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
- proc.stdout.on('data', d => stdout += d.toString());
75
- proc.stderr.on('data', d => stderr += d.toString());
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,21 @@ 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());
121
+ // v5.6.32: Memory taşmasını önle - max 5MB output
122
+ let stdoutBytes = 0;
123
+ const MAX_OUTPUT = 5 * 1024 * 1024; // 5MB
124
+ let truncated = false;
125
+ const addStdout = (d) => {
126
+ if (truncated) return;
127
+ stdoutBytes += d.length;
128
+ if (stdoutBytes > MAX_OUTPUT) {
129
+ truncated = true;
130
+ stdout += '\n[OUTPUT TRUNCATED - exceeded 5MB limit]';
131
+ return;
132
+ }
133
+ stdout += d.toString();
134
+ };
135
+ proc.stdout.on('data', addStdout);
110
136
  proc.stdout.on('end', () => { stdoutClosed = true; checkFinish(); });
111
137
  proc.stderr.on('end', () => { stderrClosed = true; checkFinish(); });
112
138
  proc.on('exit', (code) => { exitCode = code; checkFinish(); });
@@ -125,8 +151,21 @@ async function grepWithFallback(pattern, cwd, caseSensitive, maxResults) {
125
151
  const proc = spawn('grep', args);
126
152
  let stdout = '';
127
153
  let stderr = '';
128
- proc.stdout.on('data', d => stdout += d.toString());
129
- proc.stderr.on('data', d => stderr += d.toString());
154
+ // v5.6.32: Memory taşmasını önle - max 5MB output
155
+ let stdoutBytes = 0;
156
+ const MAX_OUTPUT = 5 * 1024 * 1024; // 5MB
157
+ let truncated = false;
158
+ const addStdout = (d) => {
159
+ if (truncated) return;
160
+ stdoutBytes += d.length;
161
+ if (stdoutBytes > MAX_OUTPUT) {
162
+ truncated = true;
163
+ stdout += '\n[OUTPUT TRUNCATED - exceeded 5MB limit]';
164
+ return;
165
+ }
166
+ stdout += d.toString();
167
+ };
168
+ proc.stdout.on('data', addStdout);
130
169
 
131
170
  proc.on('close', (code) => {
132
171
  const results = [];