Buckets:

TakaSystem/Enigma-bucket / neurosintese.js
dr-tkxx's picture
download
raw
8.9 kB
/*
MOTOR DE NEUROSÍNTESE AOI-HESSENBERG (v7.0 - Majestoso)
Integração Completa: Memória de Sessão + História Real + AMORC + Ditritium
*/
class ConversationLogger {
constructor() {
this.storageKey = 'aoi_conversation_papyri';
this.logs = this.loadLogs();
}
loadLogs() {
try {
const stored = localStorage.getItem(this.storageKey);
return stored ? JSON.parse(stored) : [];
} catch (e) { return []; }
}
log(input, output, xk, type) {
const entry = { id: Date.now(), data: new Date().toLocaleString(), input, output, xk, intencao: type, versao: "7.0" };
this.logs.push(entry);
try { localStorage.setItem(this.storageKey, JSON.stringify(this.logs)); } catch (e) {}
}
reset() { this.logs = []; localStorage.removeItem(this.storageKey); }
export() { return JSON.stringify({ projeto: "Papiro de Amarna", entradas: this.logs }, null, 2); }
}
class ResponseMemory {
constructor() {
this.historyKey = 'aoi_pharaoh_history';
this.usedPhrasesKey = 'aoi_used_phrases';
this.maxVariations = 15;
this.usedPhrases = this.loadUsed();
}
loadUsed() {
try {
const stored = sessionStorage.getItem(this.usedPhrasesKey);
return stored ? JSON.parse(stored) : [];
} catch (e) { return []; }
}
track(text) {
this.usedPhrases.push(text);
if (this.usedPhrases.length > 50) this.usedPhrases.shift();
sessionStorage.setItem(this.usedPhrasesKey, JSON.stringify(this.usedPhrases));
}
isRepeated(text) { return this.usedPhrases.includes(text); }
getVariationIndex(inputHash) {
let count = parseInt(sessionStorage.getItem('var_' + inputHash) || "0");
return count % this.maxVariations;
}
incrementVariation(inputHash) {
let count = parseInt(sessionStorage.getItem('var_' + inputHash) || "0");
sessionStorage.setItem('var_' + inputHash, (count + 1).toString());
}
getStats(inputHash) {
return { count: parseInt(sessionStorage.getItem('var_' + inputHash) || "0"), max: this.maxVariations };
}
reset() { sessionStorage.clear(); }
}
class InputAnalyzer {
constructor() {
this.horoscopeWords = ['horoscopo', 'horóscopo', 'signo', 'previsão', 'aniversario', 'aniversário', 'nascimento', 'tarot', 'tárot', 'oraculo', 'oráculo', 'sabedoria'];
this.channelingWords = ['canalização', 'canalizacao', 'psicografia', 'carta', 'alem tumulo', 'além túmulo'];
this.adviceWords = ['fazer', 'hoje', 'conselho', 'ajuda', 'ajudar', 'melhorar', 'viver', 'dia'];
}
analyze(text) {
const lower = text.toLowerCase();
let tipo = 'STATEMENT';
const history = window.EGIPCIO_HISTORY || [];
const historyMatch = history.find(h => lower.includes(h.name.toLowerCase()));
if (historyMatch) tipo = 'HISTORY';
else if (this.channelingWords.some(w => lower.includes(w))) tipo = 'CHANNELING';
else if (this.horoscopeWords.some(w => lower.includes(w)) || /\d{1,2}[/-]\d{1,2}[/-]\d{4}/.test(text)) tipo = 'HOROSCOPE';
else if (this.adviceWords.some(w => lower.includes(w))) tipo = 'ADVICE';
else if (text.includes('?')) tipo = 'QUESTION';
else if (['oi', 'olá', 'bom dia', 'boa tarde', 'boa noite', 'salve'].some(w => lower.includes(w))) tipo = 'GREETING';
return { tipo, xk: this.calculateXK(text), historyMatch };
}
calculateXK(text) {
let xk = (text.length / 10) + (text.match(/[.,;:!?]/g) || []).length;
return Math.min(Math.max(xk - 5, -15), 15);
}
}
class NeuroSynthesizer {
constructor(dictionary, pragmatics, sociolinguistics, morphosyntax, amarna) {
this.dict = dictionary; this.prag = pragmatics; this.socio = sociolinguistics;
this.morph = morphosyntax; this.amarna = amarna;
this.memory = new ResponseMemory();
this.analyzer = new InputAnalyzer();
}
hashString(str) {
let hash = 0;
for (let i = 0; i < str.length; i++) hash = ((hash << 5) - hash) + str.charCodeAt(i);
return Math.abs(hash);
}
process(input) {
const analysis = this.analyzer.analyze(input);
const inputHash = this.hashString(input);
let variationIndex = this.memory.getVariationIndex(inputHash);
let response = "";
let safety = 0;
do {
const seed = inputHash + variationIndex * 1000 + safety * 777 + Date.now();
response = this.generateResponse(input, analysis, seed, variationIndex);
safety++;
} while (this.memory.isRepeated(response) && safety < 10);
this.memory.track(response);
this.memory.incrementVariation(inputHash);
return { text: response, xk: analysis.xk, type: analysis.tipo, stats: this.memory.getStats(inputHash) };
}
generateResponse(input, analysis, seed, variationIndex) {
const rand = (max) => Math.floor((Math.abs(Math.sin(seed++) * 10000)) % max);
if (analysis.tipo === 'HISTORY') {
const h = analysis.historyMatch;
const fact = h.facts[rand(h.facts.length)];
const cult = window.EGIPCIO_CULTURE[rand(window.EGIPCIO_CULTURE.length)];
const intros = [`Sobre ${h.name}, os registros de Amarna dizem: `, `Buscador, a história revela que ${h.name} `, `Pela luz de Aton, saiba que ${h.name} `];
return intros[rand(intros.length)] + fact + " " + cult;
}
if (analysis.tipo === 'CHANNELING') {
const dit = new DitritiumEngine();
const date = sessionStorage.getItem('aoi_birth_date') || "01/01/1900";
return `[SINTONIA: ${rand(800) + 200} MHz] ` + dit.getPsychography(date, input).message;
}
if (analysis.tipo === 'ADVICE') {
const advices = [
"Busca hoje o equilíbrio de Maat. Ação correta gera destino favorável.",
"Medita sobre o silêncio do deserto; nele encontrarás tua resposta.",
"Honra a luz de Aton em cada gesto. O dia será de transmutação.",
"Trabalha como um construtor de pirâmides: com paciência e propósito eterno.",
"Ouve teu coração (Ib), pois ele é o guia mais sábio nas areias do tempo."
];
const amorc = window.AMORC_KNOWLEDGE[rand(window.AMORC_KNOWLEDGE.length)];
return `${advices[rand(advices.length)]} Sintonize-se com o ${amorc}. Paz Profunda.`;
}
if (analysis.tipo === 'HOROSCOPE') {
const horo = new EgyptianHoroscope();
let date = sessionStorage.getItem('aoi_birth_date');
const dateMatch = input.match(/\d{1,2}[/-]\d{1,2}[/-]\d{4}/);
if (dateMatch) { date = dateMatch[0]; sessionStorage.setItem('aoi_birth_date', date); }
if (!date) return "Para que eu possa ler o destino, revela-me o dia de teu surgimento (DD/MM/AAAA).";
const h = horo.getHoroscope(date);
const amorc = window.AMORC_KNOWLEDGE[rand(window.AMORC_KNOWLEDGE.length)];
const low = input.toLowerCase();
if (low.includes('tarot')) return `Pela sabedoria de Thoth para ${date}: O Arcano é ${h.arcanoNum} (${h.arcano}) no Plano ${h.plano}. Derivada: ${h.derivada} Q-Units. ${h.insight} Medite no ${amorc}.`;
if (low.includes('oraculo') || low.includes('oráculo')) return `O Oráculo proclama para ${date}: "${h.profecia}" Sente a vibração do ${amorc}.`;
if (low.includes('sabedoria')) return `A sabedoria para ${date} revela: "${this.amarna.axiomas_pt[rand(this.amarna.axiomas_pt.length)].titulo}". Guie-se pelo ${amorc}.`;
return `Saudações, iniciado de ${date}. Teu signo é ${h.sign.name} (${h.sign.regence}). ${h.sign.profile} Ouve o ${amorc}: "${h.mensagem_neith}".`;
}
// Default Generative
const lex = this.dict.categorias;
const s = lex.substantivos.sagrados[rand(lex.substantivos.sagrados.length)];
const v = lex.verbos.transmutacao[rand(lex.verbos.transmutacao.length)].slice(0, -1);
const o = lex.substantivos.comuns[rand(lex.substantivos.comuns.length)];
const a = lex.adjetivos.qualidade[rand(lex.adjetivos.qualidade.length)];
const am = this.amarna.termos[rand(this.amarna.termos.length)].conceito;
const wrappers = [
`O ${o} ${a} é o que ${s} ${v} sob o ${am}.`,
`Quando ${s} ${v} o ${o}, uma energia ${a} ressoa no ${am}.`,
`Pela luz de Aton, vejo que ${s} sempre ${v} o ${o} ${a}.`
];
let res = (analysis.tipo === 'QUESTION' ? "A resposta ressoa: " : "") + wrappers[rand(wrappers.length)];
return res.replace(/ o luz /gi, " a luz ").replace(/ o verdade /gi, " a verdade ");
}
}
window.NeuroSynthesizer = NeuroSynthesizer;

Xet Storage Details

Size:
8.9 kB
·
Xet hash:
e14406b17a72c78b1e284d937ec39c7402d794cf2d4fc859496dc8535c76648b

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.