chore: import coordenador (subtree)

git-subtree-dir: coordenador
git-subtree-mainline: facbe2e340
git-subtree-split: ce7af94d55
This commit is contained in:
Gustavo Santos
2026-10-01 14:25:55 -03:00
72 changed files with 8913 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
function needsReanalysis({ memory, currentHash, now }) {
if (!memory) return { needsAi: true, reason: 'no_cache' };
if (memory.last_context_hash !== currentHash) return { needsAi: true, reason: 'context_changed' };
if (memory.next_review_at != null && now >= memory.next_review_at) return { needsAi: true, reason: 'review_due' };
return { needsAi: false, reason: 'cache_valid' };
}
// Chave de cache composta (conteudo do chamado + versao do classificador). Guardada no MESMO
// campo last_context_hash que ja existia -- sem migracao de schema na Data Table. Uma classe
// derivada e valida SE E SOMENTE SE contextHash bate E classifierVersion bate: bump de versao
// (logic/classification.js -> AI_CLASSIFIER_VERSION) forca cache miss em todo chamado, sem
// precisar apagar a Data Table na mao (missao "finalizacao para producao", secao 12).
function buildCacheKey(contextHash, classifierVersion) {
return `${contextHash}:v${classifierVersion}`;
}
module.exports = { needsReanalysis, buildCacheKey };