lumina-code-agent 1.6.8 → 1.6.9

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.
Files changed (2) hide show
  1. package/dist/index.js +35 -19
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -121,10 +121,10 @@ RULES:
121
121
 
122
122
  Working directory: ${process.cwd()}`;
123
123
  console.log('');
124
- console.log(' ⏳ Sending to AI...');
124
+ console.log(' ⏳ Generating...');
125
125
  try {
126
126
  const controller = new AbortController();
127
- const timeout = setTimeout(() => controller.abort(), 300000);
127
+ const timeout = setTimeout(() => controller.abort(), 600000); // 10 min timeout
128
128
  const res = await fetch('https://openrouter.ai/api/v1/chat/completions', {
129
129
  method: 'POST',
130
130
  headers: {
@@ -140,7 +140,7 @@ Working directory: ${process.cwd()}`;
140
140
  { role: 'user', content: trimmed },
141
141
  ],
142
142
  stream: false,
143
- max_tokens: 16000,
143
+ max_tokens: 65000,
144
144
  temperature: 0.1,
145
145
  }),
146
146
  signal: controller.signal,
@@ -150,30 +150,47 @@ Working directory: ${process.cwd()}`;
150
150
  const err = await res.text().catch(() => '');
151
151
  throw new Error(`API error ${res.status}: ${err.slice(0, 200)}`);
152
152
  }
153
- console.log(' ⏳ AI is thinking...');
154
- const data = await res.json();
153
+ // Read response as text first, then parse
154
+ const rawText = await res.text();
155
+ let data;
156
+ try {
157
+ data = JSON.parse(rawText);
158
+ }
159
+ catch (e) {
160
+ // If JSON is truncated, try to fix it
161
+ console.log(' ⚠ Response was truncated. Attempting to parse...');
162
+ // Try to find the last complete JSON object
163
+ const lastBrace = rawText.lastIndexOf('}');
164
+ if (lastBrace > 0) {
165
+ try {
166
+ data = JSON.parse(rawText.slice(0, lastBrace + 1));
167
+ }
168
+ catch (e2) {
169
+ throw new Error('Response was truncated and could not be parsed. Try a shorter prompt.');
170
+ }
171
+ }
172
+ else {
173
+ throw new Error('Response was truncated. Try a shorter prompt.');
174
+ }
175
+ }
155
176
  const content = data.choices?.[0]?.message?.content || '';
156
177
  if (!content) {
157
178
  console.log(' ⚠ No response from model.\n');
158
179
  continue;
159
180
  }
160
- console.log(' ✓ AI responded! Parsing files...\n');
181
+ console.log(` ✓ AI responded (${content.length} chars)`);
161
182
  const files = extractFiles(content);
162
183
  if (files.length === 0) {
163
- console.log(' ⚠ No files detected. Full output:\n');
164
- console.log(' ──────────────────────────────────────');
165
- // Print first 100 lines
166
- const lines = content.split('\n').slice(0, 100);
167
- for (const line of lines) {
184
+ console.log(' ⚠ No files detected in output.\n');
185
+ // Show first 50 lines of output
186
+ const lines = content.split('\n').slice(0, 50);
187
+ console.log(' ── Output preview ──');
188
+ for (const line of lines)
168
189
  console.log(' ' + line);
169
- }
170
- if (content.split('\n').length > 100) {
171
- console.log(' ... (truncated)');
172
- }
173
- console.log(' ──────────────────────────────────────\n');
190
+ console.log(' ── End ──\n');
174
191
  continue;
175
192
  }
176
- console.log(` 📁 Found ${files.length} file(s):\n`);
193
+ console.log(` 📁 Creating ${files.length} file(s):\n`);
177
194
  for (const file of files) {
178
195
  try {
179
196
  const filePath = join(process.cwd(), file.path);
@@ -188,8 +205,7 @@ Working directory: ${process.cwd()}`;
188
205
  console.log(` ❌ ${file.path}: ${e.message}`);
189
206
  }
190
207
  }
191
- console.log(`\n 📊 Total files created: ${createdFiles.size}`);
192
- console.log('');
208
+ console.log(`\n 📊 Total files: ${createdFiles.size}\n`);
193
209
  }
194
210
  catch (e) {
195
211
  console.log(` ⚠ Error: ${e.message}\n`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lumina-code-agent",
3
- "version": "1.6.8",
3
+ "version": "1.6.9",
4
4
  "description": "Lumina Code - AI coding agent",
5
5
  "license": "MIT",
6
6
  "type": "module",