primocode 7.12.1 → 7.12.2

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/lib/act.js CHANGED
@@ -15,7 +15,10 @@ const tools = require('./tools');
15
15
  const api = require('./api');
16
16
  const cfg = require('./config');
17
17
  const catalogo = require('./catalogo');
18
- const streaming = require('./streaming');
18
+ // "painel", não "streaming": dentro do runAct existe um `let streaming` (a
19
+ // flag de texto chegando em stream) que SOMBREARIA este módulo — e o step()
20
+ // viraria TypeError engolido pelo catch. Foi um bug real, pego em teste.
21
+ const painel = require('./streaming');
19
22
 
20
23
  const MAX_ITERATIONS = 15;
21
24
  const MAX_PROFUNDIDADE = 2; // principal + 1 nível de subagente
@@ -282,7 +285,7 @@ async function runAct(userPrompt, opts) {
282
285
 
283
286
  // Painel ao vivo (/streaming): registra o passo e fotografa a tela.
284
287
  // Nunca pode derrubar o loop — falha de foto é problema do painel.
285
- try { streaming.step(tc.name, tc.arguments, result); } catch {}
288
+ try { painel.step(tc.name, tc.arguments, result); } catch {}
286
289
 
287
290
  // Uma escrita bem-sucedida limpa a dívida: o agente se corrigiu.
288
291
  if (result && result.ok === false) falhasPendentes.push(`${tc.name}(${tc.arguments?.path || ''}): ${result.error}`);
package/lib/desktop.js CHANGED
@@ -407,8 +407,11 @@ function listWindows() {
407
407
  return m ? `|${m[1]}` : '';
408
408
  });
409
409
  } else if (TOOLS.xdotool) {
410
+ // O xdotool sai com código ≠ 0 se UMA janela da lista não tiver nome
411
+ // — mas o stdout com as outras continua valendo. Jogar a saída fora
412
+ // por causa do código fazia o total dar 0 com janelas na cara.
410
413
  const r = runOut(`xdotool search --onlyvisible --name '.*' getwindowname %@ 2>/dev/null`);
411
- if (r.ok) linhas = r.out.split('\n').map((t) => (t.trim() ? `|${t.trim()}` : ''));
414
+ if (r.out) linhas = r.out.split('\n').map((t) => (t.trim() ? `|${t.trim()}` : ''));
412
415
  } else {
413
416
  return { ok: false, error: 'Instale wmctrl ou xdotool para listar janelas no Linux.' };
414
417
  }
@@ -464,8 +467,13 @@ Write-Output $p.MainWindowTitle`,
464
467
  const busca = runOut(`xdotool search --onlyvisible --name ${sh1(t)} 2>/dev/null`);
465
468
  const id = (busca.out || '').trim().split('\n')[0];
466
469
  if (!id) return naoAchouJanela(t);
470
+ // windowactivate depende do window manager (EWMH). Sem ele — ou com um
471
+ // WM teimoso — raise+focus fazem o mesmo serviço.
467
472
  const r = run(`xdotool windowactivate --sync ${id}`);
468
- return r.ok ? { ok: true, janela: t } : r;
473
+ if (r.ok) return { ok: true, janela: t };
474
+ const raise = run(`xdotool windowraise ${id}`);
475
+ const foco = run(`xdotool windowfocus ${id}`);
476
+ return (raise.ok || foco.ok) ? { ok: true, janela: t } : r;
469
477
  }
470
478
  return { ok: false, error: 'Focar janela não disponível: instale xdotool (Linux).' };
471
479
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "primocode",
3
- "version": "7.12.1",
3
+ "version": "7.12.2",
4
4
  "description": "PrimoCode — agente de engenharia com IA e cursor próprio. Modelos grátis. Cria arquivos, roda comandos, controla navegador e desktop: abre apps, clica em botões e ícones pelo nome, digita e usa atalhos.",
5
5
  "main": "bin/primocode.js",
6
6
  "bin": {