terminal-smart-cli 0.87.0 → 0.89.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/ts.js CHANGED
@@ -902,8 +902,12 @@ async function agentCmd(words, { askFn, cwd: cwdIn = null, onCwd = null } = {})
902
902
  if (streamJson) _emit(core.AgentEvents.systemInit({ model: model || 'auto', cwd: startCwd, mode: plan ? 'plan' : readOnly ? 'ask' : 'agent' }));
903
903
  let out;
904
904
  try {
905
+ // --passos N (ou --steps): quantas iterações o agente pode fazer numa run (default 15, teto 120).
906
+ // Pra missões grandes ("faça tudo de uma vez") sem o pára-e-continua.
907
+ const _pi = process.argv.findIndex(a => a === '--passos' || a === '--steps' || a === '--max-passos');
908
+ const _maxPassos = _pi >= 0 ? Number(process.argv[_pi + 1]) : undefined;
905
909
  out = await agent.run(task, {
906
- token, lang: cfg.lang || 'pt', yes: YES, autoAll: YOLO, model, priorMessages, cwd: startCwd, readOnly, plan, browser: useBrowser,
910
+ token, lang: cfg.lang || 'pt', yes: YES, autoAll: YOLO, model, priorMessages, cwd: startCwd, readOnly, plan, browser: useBrowser, maxIter: _maxPassos,
907
911
  onThinking: (p) => {
908
912
  if (p && typeof p === 'object') {
909
913
  _live.steps = p.steps ?? _live.steps; _live.inTok = p.inTok ?? _live.inTok; _live.outTok = p.outTok ?? _live.outTok;
package/lib/agent.js CHANGED
@@ -248,6 +248,7 @@ async function _remoteApprove(comando, token, onRemote) {
248
248
  */
249
249
  async function run(task, opts = {}) {
250
250
  const { token, lang = 'pt', yes = false, autoAll = false, model = null, confineDir = null, onStep = () => {}, onStepDone = () => {}, askApprove = async () => false, onThinking = () => {}, onRemote = () => {} } = opts;
251
+ const maxIter = Math.max(1, Math.min(Number(opts.maxIter) || MAX_ITER, 120)); // --passos N (teto 120)
251
252
  // FULL-AUTO (autoridade total): aprova destrutivos sem perguntar. Começa por --yolo/--full-auto
252
253
  // (opts.autoAll) e pode ser LIGADO no meio da sessão quando o humano responde "a" (aprovar tudo).
253
254
  let autoApproveDestructive = !!autoAll;
@@ -462,7 +463,7 @@ async function run(task, opts = {}) {
462
463
  // encerra no próximo limite de passo (não interrompe uma chamada em curso, mas para de
463
464
  // gastar). Marca `stopped` pra pular o fechamento por LLM lá embaixo.
464
465
  let stopped = false;
465
- for (let iter = 0; iter < MAX_ITER; iter++) {
466
+ for (let iter = 0; iter < maxIter; iter++) {
466
467
  if (opts.shouldStop && opts.shouldStop()) { stopped = true; break; }
467
468
  // passa o snapshot de progresso pra a status line ao vivo (tempo é contado no cliente)
468
469
  onThinking({ iter, inTok: acc.inTok, outTok: acc.outTok, cachedTok: acc.cachedTok, steps, model: usedModel });
package/lib/core.js CHANGED
@@ -45,6 +45,7 @@ const _DESTR_DESC = [
45
45
  [/\bmkfs\b|\bdd\s+if=|(?:^|[\s&;|])format\s+[a-z]:|\bdiskpart\b|>\s?\/dev\/sd/i, ['formatar ou sobrescrever um disco', 'format or overwrite a disk']],
46
46
  [/\bDROP\s+DATABASE\b/i, ['apagar um banco de dados INTEIRO', 'delete an ENTIRE database']],
47
47
  [/\bDROP\s+TABLE\b/i, ['apagar uma tabela do banco', 'delete a database table']],
48
+ [/\btruncate\s+-/i, ['zerar ou reduzir um arquivo', 'empty or shrink a file']], // comando shell (truncate -s) — ANTES do SQL
48
49
  [/\bTRUNCATE\b/i, ['esvaziar uma tabela do banco', 'empty a database table']],
49
50
  [/\bDELETE\s+FROM\b/i, ['apagar registros de uma tabela', 'delete rows from a table']],
50
51
  [/\bALTER\s+USER\b[^;]*IDENTIFIED|(\bSET\s+PASSWORD|GRANT\s+ALL\s+PRIVILEGES)\b/i, ['mudar credenciais/permissões do banco (afeta tudo que usa esse acesso)', "change DB credentials/permissions (affects everything using that access)"]],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "terminal-smart-cli",
3
- "version": "0.87.0",
3
+ "version": "0.89.0",
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"