terminal-smart-cli 0.54.0 → 0.55.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 +6 -1
- package/lib/tools.js +6 -1
- package/package.json +1 -1
package/bin/ts.js
CHANGED
|
@@ -817,7 +817,12 @@ async function agentCmd(words, { askFn, cwd: cwdIn = null, onCwd = null } = {})
|
|
|
817
817
|
// @arquivo: expande referências "@caminho" no texto pro conteúdo do arquivo (padrão Claude Code/Cursor).
|
|
818
818
|
task = _expandFileRefs(task, startCwd);
|
|
819
819
|
const ask = askFn || ui.ask;
|
|
820
|
-
|
|
820
|
+
// Sem TTY (nohup, redirect >arquivo, CI) o spinner ora não renderiza E interferia engolindo a
|
|
821
|
+
// saída → o log ficava VAZIO enquanto o agente rodava. Nesses casos usa spinner NOOP: os passos
|
|
822
|
+
// saem por console.log (visíveis no arquivo/pipe) e o progresso aparece de verdade.
|
|
823
|
+
const _noTTY = !process.stdout.isTTY;
|
|
824
|
+
const sp = (streamJson || _noTTY) ? { text() {}, start() {}, stop() {} } : ui.spinner(T.agent_thinking).start();
|
|
825
|
+
if (_noTTY && !streamJson) console.log(' ' + C.dim(T.agent_thinking));
|
|
821
826
|
const t0 = Date.now();
|
|
822
827
|
if (streamJson) _emit(core.AgentEvents.systemInit({ model: model || 'auto', cwd: startCwd, mode: plan ? 'plan' : readOnly ? 'ask' : 'agent' }));
|
|
823
828
|
let out;
|
package/lib/tools.js
CHANGED
|
@@ -339,7 +339,12 @@ async function execute(name, input, opts = {}) {
|
|
|
339
339
|
// RECUSA INSTANTÂNEA (defesa em profundidade — o gate do agent.js já pega antes):
|
|
340
340
|
// comando auto-destrutivo NUNCA roda e NUNCA espera aprovação.
|
|
341
341
|
{ const sd = selfDestructiveReason(comando, { cwd: baseDir }); if (sd) return { erro: sd }; }
|
|
342
|
-
|
|
342
|
+
// Comandos de INSTALL/BUILD (apt/npm/pip/make/gcc/docker build…) levam muito mais que 60s —
|
|
343
|
+
// sem isso o apt-get de vários pacotes MORRIA no timeout padrão (nada instalava, em silêncio).
|
|
344
|
+
// Eles ganham 10min de default (até 30min se o agente pedir timeout_s); resto segue 60s.
|
|
345
|
+
const _slow = /(^|[\s;|&(])(apt|apt-get|aptitude|dpkg|yum|dnf|zypper|pacman|snap|brew|pip|pip3|npm|yarn|pnpm|gem|cargo|go\s+(get|build|install)|make|cmake|meson|ninja|gcc|g\+\+|clang|mvn|gradle|\.\/gradlew|dotnet|composer|bundle|flutter\s+(build|pub)|docker\s+(build|pull|compose)|configure|\.\/configure|\.\/build)([\s;|&)]|$)/i.test(comando);
|
|
346
|
+
const _dflt = _slow ? 600 : 60;
|
|
347
|
+
const timeout = Math.min(1800, Math.max(5, Number(input.timeout_s) || _dflt)) * 1000;
|
|
343
348
|
const cmd = process.platform === 'win32' ? `chcp 65001>nul & ${comando}` : comando;
|
|
344
349
|
return await new Promise((res) => {
|
|
345
350
|
require('child_process').exec(cmd, { timeout, shell: true, windowsHide: true, maxBuffer: 4 * 1024 * 1024, cwd: fs.existsSync(baseDir) ? baseDir : undefined }, (e, out, err) => {
|