terminal-smart-cli 0.97.14 → 0.97.15

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/agent.js CHANGED
@@ -1587,7 +1587,7 @@ async function run(task, opts = {}) {
1587
1587
  try { require('./memoria').logErro(confineDir || cwd, name, String(result.erro || result.stderr || ('exit ' + result.codigo))); } catch (_) {}
1588
1588
  // RECOVERY ENGINE: erro de classe CONHECIDA → injeta a estratégia de conserto no
1589
1589
  // resultado (o modelo aplica o padrão DevOps em vez de chutar/entrar em loop).
1590
- try { const _rh = require('./recovery').recoveryHint(_tr.errorClass); if (_rh && result && typeof result === 'object' && !result._recovery) result = Object.assign({}, result, { _recovery: _rh }); } catch (_) {}
1590
+ try { const _rh = require('./recovery').recoveryHint(_tr.errorClass, { availableTools:_allowedToolNames }); if (_rh && result && typeof result === 'object' && !result._recovery) result = Object.assign({}, result, { _recovery: _rh }); } catch (_) {}
1591
1591
  }
1592
1592
  // HOOK PostToolUse (determinístico): feedback (ex: lint/format) vai pro modelo ver.
1593
1593
  if (_hooks._any) {
package/lib/recovery.js CHANGED
@@ -63,9 +63,17 @@ const RECOVERABLE = Object.keys(STRATEGIES); // classes com estratégia conhecid
63
63
  function strategiesFor(errorClass) { return STRATEGIES[errorClass] || null; }
64
64
 
65
65
  // Texto acionável pra INJETAR no resultado da ferramenta que o modelo lê. '' se classe sem estratégia.
66
- function recoveryHint(errorClass) {
66
+ function recoveryHint(errorClass, options = {}) {
67
67
  const s = STRATEGIES[errorClass];
68
68
  if (!s) return '';
69
+ if (errorClass === 'not_found' && Array.isArray(options.availableTools)) {
70
+ const available = new Set(options.availableTools);
71
+ const probes = ['listar_diretorio', 'buscar_arquivos'].filter(name => available.has(name));
72
+ if (!probes.length) {
73
+ return 'ESCOPO ESTRITO: o alvo não foi encontrado e as ferramentas de procura não foram autorizadas. Não contorne a restrição, não invente outro caminho e não repita a mesma leitura. Encerre com a falha objetiva e informe que listar_diretorio ou buscar_arquivos permitiria investigar.';
74
+ }
75
+ return `ESTRATÉGIA CONHECIDA (not_found) — use somente ferramentas disponíveis:\n1) DIAGNOSTIQUE com ${probes.join(' ou ')} para confirmar o caminho exato.\n2) Se encontrar um candidato inequívoco, tente ler uma única vez; caso contrário, encerre com a evidência sem inventar caminho.`;
76
+ }
69
77
  return `ESTRATÉGIA CONHECIDA (${errorClass}) — não chute:\n1) DIAGNOSTIQUE: ${s.diag}\n2) CONSERTO: ${s.fix}`;
70
78
  }
71
79
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "terminal-smart-cli",
3
- "version": "0.97.14",
3
+ "version": "0.97.15",
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"