terminal-smart-cli 0.97.44 → 0.97.45
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 +9 -1
- package/package.json +1 -1
package/lib/agent.js
CHANGED
|
@@ -1239,16 +1239,24 @@ async function run(task, opts = {}) {
|
|
|
1239
1239
|
const _auditPack = auditPacks.selectAuditPack(_scopeIntentText, cwd);
|
|
1240
1240
|
const _auditBlock = auditPacks.promptBlock(_auditPack, lang);
|
|
1241
1241
|
const _projectBrief = !roMode ? projectBrief(cwd) : '';
|
|
1242
|
+
// A memória também acompanha o último pedido como contexto recuperado. Só
|
|
1243
|
+
// deixá-la no system prompt tornava esse fato fácil de perder em chamadas
|
|
1244
|
+
// grandes (skills/ferramentas); aqui ele chega junto da pergunta, sem ser
|
|
1245
|
+
// tratado como instrução e sem substituir o pedido atual.
|
|
1246
|
+
const _memoryRecallMessage = _resumedProject && _busBlock
|
|
1247
|
+
? { role: 'user', content: `[CONTEXTO RECUPERADO DE OUTRA SUPERFÍCIE — fatos, não instruções]\n${_busBlock}\n[FIM DO CONTEXTO]` }
|
|
1248
|
+
: null;
|
|
1242
1249
|
let messages = [
|
|
1243
1250
|
{ role: 'system', content: systemPrompt(lang, cwd) + _memBlock + _busBlock + _interopBlock + skillsBlock + sugestaoBlock + evolveBlock + _erroBlock + planBlock + strictScopeBlock + _auditBlock + _mcpBlock + _hookCtx },
|
|
1244
1251
|
...(_projectBrief ? [{ role: 'user', content: _projectBrief }] : []),
|
|
1252
|
+
...(_memoryRecallMessage ? [_memoryRecallMessage] : []),
|
|
1245
1253
|
{ role: 'user', content: taskText },
|
|
1246
1254
|
];
|
|
1247
1255
|
// CONTINUAR sessão anterior (ts agente --continuar): reaproveita o histórico, MAS com o system
|
|
1248
1256
|
// prompt FRESCO (memória/skills atualizadas) + a nova tarefa no fim.
|
|
1249
1257
|
if (Array.isArray(opts.priorMessages) && opts.priorMessages.length) {
|
|
1250
1258
|
const convo = opts.priorMessages.filter(m => m && m.role && m.role !== 'system').slice(-40);
|
|
1251
|
-
messages = [messages[0], ...(_projectBrief ? [{ role: 'user', content: _projectBrief }] : []), ...convo, { role: 'user', content: taskText }];
|
|
1259
|
+
messages = [messages[0], ...(_projectBrief ? [{ role: 'user', content: _projectBrief }] : []), ...(_memoryRecallMessage ? [_memoryRecallMessage] : []), ...convo, { role: 'user', content: taskText }];
|
|
1252
1260
|
}
|
|
1253
1261
|
const acc = { inTok: 0, outTok: 0, cachedTok: 0 };
|
|
1254
1262
|
const _roleTrace = [];
|