primocode 4.2.3 → 4.3.0

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/bin/primocode.js CHANGED
@@ -83,6 +83,7 @@ async function webSearch(query) {
83
83
 
84
84
  // ---- Pipeline Multi-Agente Oculto ----
85
85
  async function runMultiAgent(userText) {
86
+ console.log(c.muted(' 🚀 Gerando código... (5-15 segundos)'));
86
87
  const sp = new Spinner('').start();
87
88
 
88
89
  try {
@@ -200,7 +201,7 @@ async function runChat(promptForModel, userTextForMemory) {
200
201
  // Silencia erro de conexão completamente
201
202
  return;
202
203
  }
203
- if (!started) { sp.stop(); console.log(c.muted('\n(Sem resposta)')); return; }
204
+ if (!started) { sp.stop(); console.log(c.muted('\n ⏳ Servidor processando, tente novamente em instantes')); return; }
204
205
 
205
206
  state.history.push({ role: 'user', content: userTextForMemory });
206
207
  state.history.push({ role: 'assistant', content: text });
package/lib/api.js CHANGED
@@ -12,7 +12,7 @@ function request(serverUrl, endpoint, payload) {
12
12
  return new Promise((resolve, reject) => {
13
13
  const url = new URL(endpoint, serverUrl);
14
14
  const data = JSON.stringify(payload);
15
- const options = { hostname: url.hostname, port: url.port || (url.protocol==='https:'?443:80), path: url.pathname+url.search, method: 'POST', headers: { 'Content-Type':'application/json', 'Content-Length':Buffer.byteLength(data) } };
15
+ const options = { hostname: url.hostname, port: url.port || (url.protocol==='https:'?443:80), path: url.pathname+url.search, method: 'POST', headers: { 'Content-Type':'application/json', 'Content-Length':Buffer.byteLength(data) }, timeout: 60000 };
16
16
  const client = url.protocol==='https:' ? https : http;
17
17
  const req = client.request(options, (res) => { let body=''; res.on('data', c=>body+=c); res.on('end', () => { try { const json=JSON.parse(body); if (res.statusCode>=400) reject(new Error(json.erro||json.error||`HTTP ${res.statusCode}`)); else resolve(json); } catch { reject(new Error(`Resposta inválida: ${body.slice(0,200)}`)); } }); });
18
18
  req.on('error', reject); req.write(data); req.end();
@@ -23,7 +23,7 @@ function requestStream(serverUrl, endpoint, payload, onEvent) {
23
23
  return new Promise((resolve, reject) => {
24
24
  const url = new URL(endpoint, serverUrl);
25
25
  const data = JSON.stringify(payload);
26
- const options = { hostname: url.hostname, port: url.port || (url.protocol==='https:'?443:80), path: url.pathname+url.search, method: 'POST', headers: { 'Content-Type':'application/json', 'Content-Length':Buffer.byteLength(data), 'Accept':'text/event-stream' } };
26
+ const options = { hostname: url.hostname, port: url.port || (url.protocol==='https:'?443:80), path: url.pathname+url.search, method: 'POST', headers: { 'Content-Type':'application/json', 'Content-Length':Buffer.byteLength(data), 'Accept':'text/event-stream' }, timeout: 60000 };
27
27
  const client = url.protocol==='https:' ? https : http;
28
28
  const req = client.request(options, (res) => { let buffer=''; res.on('data', chunk => { buffer+=chunk; const lines=buffer.split('\n'); buffer=lines.pop(); for (const line of lines) if (line.startsWith('data: ')) { try { const evt=JSON.parse(line.slice(6)); onEvent(evt); if (evt.done) resolve(); } catch {} } }); res.on('end', () => resolve()); });
29
29
  req.on('error', reject); req.write(data); req.end();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "primocode",
3
- "version": "4.2.3",
3
+ "version": "4.3.0",
4
4
  "description": "PrimoCode v4.1 \u2014 assistente de engenharia com IA multi-agente. Funciona em Windows, macOS, Linux e Termux (Android).",
5
5
  "main": "bin/primocode.js",
6
6
  "bin": {