terminal-smart-cli 0.97.59 → 0.97.63

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/ts.js CHANGED
@@ -1429,6 +1429,10 @@ async function agentCmd(words, { askFn, cwd: cwdIn = null, onCwd = null, maxIter
1429
1429
  // --navegador/--browser (EXPERIMENTAL, Evolve 5): dá ao agente um Chrome headless real
1430
1430
  // (abrir/ler/clicar/digitar/print com visão). Fora da flag a tool nem existe.
1431
1431
  const useBrowser = process.argv.includes('--navegador') || process.argv.includes('--browser');
1432
+ // Recuperação explícita quando o planejador está indisponível. O executor ainda
1433
+ // respeita política, aprovações, orçamento, ferramentas e provas; apenas evita
1434
+ // que uma otimização de planejamento vire ponto único de falha.
1435
+ const directExecution = process.argv.includes('--direto') || process.argv.includes('--direct');
1432
1436
  const _fti = process.argv.findIndex(a => a === '--ferramentas' || a === '--tools');
1433
1437
  const allowedTools = _fti >= 0
1434
1438
  ? String(process.argv[_fti + 1] || '').split(',').map(v => v.trim()).filter(Boolean)
@@ -1540,7 +1544,7 @@ async function agentCmd(words, { askFn, cwd: cwdIn = null, onCwd = null, maxIter
1540
1544
  const _maxDurationMs = 1000 * (_ti >= 0 ? Number(process.argv[_ti + 1]) : (_inlineMaxSeconds || 0));
1541
1545
  const _maxTokens = _tki >= 0 ? Number(process.argv[_tki + 1]) : _inlineMaxTokens;
1542
1546
  out = await agent.run(task, {
1543
- token, lang: cfg.lang || 'pt', yes: YES, autoAll: (YOLO || _inlineYolo || autoAllIn), model, priorMessages, cwd: startCwd, readOnly, plan, accountPlan: cfg.plan || 'free', browser: useBrowser, allowedTools, maxIter: _maxPassos,
1547
+ token, lang: cfg.lang || 'pt', yes: YES, autoAll: (YOLO || _inlineYolo || autoAllIn), model, priorMessages, cwd: startCwd, readOnly, plan, accountPlan: cfg.plan || 'free', browser: useBrowser, allowedTools, maxIter: _maxPassos, orchestrate: !directExecution,
1544
1548
  conversationId:sharedConversationId, sharedChannelPrompt,
1545
1549
  llmFn:personalAgentLlm || undefined,
1546
1550
  keyOverride:personalAgentLlm ? { key:'personal-subscription', baseUrl:'personal://subscription', source:'personal', billingAuthoritative:true } : undefined,
@@ -3071,8 +3075,9 @@ async function siteCmd(args) {
3071
3075
  const prompt = rest.join(' ').trim();
3072
3076
  const editing = ['editar', 'edit', 'alterar', 'update'].includes(sub);
3073
3077
  if (!slug || !prompt) return console.log(ui.errLine(`uso: ts site ${editing ? 'editar' : 'criar'} <nome> "<descreva ${editing ? 'a alteração' : 'o site'} em linguagem natural>"`));
3078
+ if (!FLAGS.has('--confirmar')) return console.log(ui.errLine(`Publicação não executada. Revise o pedido e repita com --confirmar: ts site ${editing ? 'editar' : 'criar'} <nome> "<descrição>" --confirmar`));
3074
3079
  console.log(C.dim(editing ? 'carregando, alterando e republicando o site…' : 'criando e publicando o site…'));
3075
- const r = await api('/api/sites/generate', { token, method: 'POST', body: { slug, prompt }, timeoutMs: 240000 });
3080
+ const r = await api('/api/sites/generate', { token, method: 'POST', body: { slug, prompt, confirmed: true }, timeoutMs: 240000 });
3076
3081
  if (!r.ok) return console.log(ui.errLine(r.error || r.message || 'não foi possível criar o site'));
3077
3082
  if (JSON_OUT) return console.log(JSON.stringify(r));
3078
3083
  console.log('\n' + ui.box([
package/lib/agent.js CHANGED
@@ -204,7 +204,7 @@ function modelCallCap(personalSubscription = false, complexTask = false) {
204
204
  function explicitExclusiveFileTargets(task, cwd) {
205
205
  const text = String(task || '');
206
206
  const targets = [];
207
- const pattern = /\b(?:somente|apenas)\s+(?:o\s+arquivo\s+)?["'`]?([^\s,"'`]+\.[a-z0-9]{1,12})["'`]?/gi;
207
+ const pattern = /\b(?:somente|apenas)\s+(?:o\s+arquivo\s+)?(?:existente\s+)?["'`]?([^\s,"'`]+\.[a-z0-9]{1,12})["'`]?/gi;
208
208
  for (const match of text.matchAll(pattern)) {
209
209
  const raw = String(match[1] || '').replace(/[.;:!?]+$/, '');
210
210
  if (raw) targets.push(path.resolve(cwd, raw));
@@ -841,11 +841,17 @@ function normalizeFileToolInput(name, input, { cwd = process.cwd(), exclusiveTar
841
841
  const alias = out.caminho || out.path || out.arquivo || out.file || out.filename;
842
842
  if (alias && String(alias).trim() && String(alias).trim() !== '.') {
843
843
  out.caminho = alias;
844
- return out;
845
- }
846
- if (exclusiveTargets.length === 1) {
844
+ } else if (exclusiveTargets.length === 1) {
847
845
  out.caminho = path.relative(cwd, exclusiveTargets[0]) || exclusiveTargets[0];
848
846
  }
847
+ if (name === 'escrever_arquivo' && !Object.prototype.hasOwnProperty.call(out, 'conteudo')) {
848
+ const contentAlias = out.content ?? out.contents ?? out.text ?? out.body;
849
+ if (contentAlias !== undefined) out.conteudo = contentAlias;
850
+ }
851
+ if (name === 'editar_arquivo') {
852
+ if (!Object.prototype.hasOwnProperty.call(out, 'buscar')) out.buscar = out.search ?? out.find ?? out.oldText;
853
+ if (!Object.prototype.hasOwnProperty.call(out, 'substituir')) out.substituir = out.replace ?? out.replacement ?? out.newText;
854
+ }
849
855
  return out;
850
856
  }
851
857
  function mutationBatchConflicts(toolCalls, cwd) {
package/lib/tools.js CHANGED
@@ -802,6 +802,9 @@ async function execute(name, input, opts = {}) {
802
802
  if (!input.caminho || !String(input.caminho).trim() || String(input.caminho).trim() === '.') {
803
803
  return { erro: 'Informe o caminho completo do ARQUIVO em caminho (ex.: docs/relatorio.md). O diretório de trabalho sozinho não é um arquivo.' };
804
804
  }
805
+ if (!Object.prototype.hasOwnProperty.call(input, 'conteudo')) {
806
+ return { erro: 'Informe o conteúdo do arquivo em conteudo. A escrita foi recusada para não apagar o arquivo com conteúdo ausente.' };
807
+ }
805
808
  let p = _abs(input.caminho, baseDir);
806
809
  { const g = _guardTsHome(p); if (g) return { erro: g }; }
807
810
  // Confinamento (missões): modelos fracos inventam pastas absolutas
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "terminal-smart-cli",
3
- "version": "0.97.59",
3
+ "version": "0.97.63",
4
4
  "description": "Terminal Smart no seu terminal — pergunte, analise logs por pipe e orquestre agentes de IA. Comando: ts",
5
5
  "bin": {
6
6
  "ts": "bin/ts.js"