terminal-smart-cli 0.97.28 → 0.97.29
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/meta.js +22 -0
- package/package.json +1 -1
package/lib/meta.js
CHANGED
|
@@ -1167,6 +1167,16 @@ async function _checkCriteria(st, dir) {
|
|
|
1167
1167
|
}
|
|
1168
1168
|
}
|
|
1169
1169
|
|
|
1170
|
+
// Fast fail-closed gate used after every implementation round. File/content
|
|
1171
|
+
// criteria may belong to later checklist items, but command criteria (tests,
|
|
1172
|
+
// lint, typecheck) describe repository health and must stay green throughout.
|
|
1173
|
+
async function _checkRoundCommandCriteria(st, dir) {
|
|
1174
|
+
const criteria = (st.criteria || []).filter(c => c && c.type === 'command');
|
|
1175
|
+
if (!criteria.length) return { allOk: true, passed: 0, total: 0, results: [] };
|
|
1176
|
+
try { return await require('./verify').runAll(criteria, { cwd: dir }); }
|
|
1177
|
+
catch (e) { return { allOk: false, passed: 0, total: criteria.length, results: [], error: String(e && e.message || e) }; }
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1170
1180
|
async function run(goal, opts = {}) {
|
|
1171
1181
|
const { token, lang = 'pt', yes = false, autoAll = false, budget = 400, maxRounds = 20, dir = process.cwd(), model = null, thinker = null, maxMinutes = 0, designer = null, design = 'auto', runGate = true, eye = null, visualLadder = true, prove = false } = opts;
|
|
1172
1182
|
const onChecklist = opts.onChecklist || (() => {});
|
|
@@ -1693,6 +1703,18 @@ async function run(goal, opts = {}) {
|
|
|
1693
1703
|
return st;
|
|
1694
1704
|
}
|
|
1695
1705
|
|
|
1706
|
+
const roundCommandProof = await _checkRoundCommandCriteria(st, dir);
|
|
1707
|
+
if (!roundCommandProof.allOk) {
|
|
1708
|
+
item.attempts = Math.max(0, (item.attempts || 1) - 1);
|
|
1709
|
+
st.status = 'paused'; st.pause_reason = 'verification_failed';
|
|
1710
|
+
st.rounds.push({ item: item.desc, id: item.id,
|
|
1711
|
+
result: `Prova determinística falhou: ${roundCommandProof.passed}/${roundCommandProof.total} comandos passaram. O item permanece aberto para correção.`,
|
|
1712
|
+
credits: out.credits || 0, steps: out.steps || 0, at: new Date().toISOString() });
|
|
1713
|
+
save(st, dir);
|
|
1714
|
+
onAlert({ type: 'verification', text: `Os testes/comandos obrigatórios falharam (${roundCommandProof.passed}/${roundCommandProof.total}). Não marquei o item como concluído; a próxima janela deve corrigir a regressão.` });
|
|
1715
|
+
return st;
|
|
1716
|
+
}
|
|
1717
|
+
|
|
1696
1718
|
// ── BLOQUEIO HUMANO: o agente pediu uma ação externa que só o usuário faz ──
|
|
1697
1719
|
// A missão PAUSA (gasto zero enquanto espera) e chama o usuário. Retoma com "ts meta".
|
|
1698
1720
|
if (out.needHuman) {
|