Compare commits
1 Commits
mimo/creat
...
mimo/code/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4706861619 |
6
app.js
6
app.js
@@ -1,4 +1,4 @@
|
||||
import ResonanceVisualizer from './nexus/components/resonance-visualizer.js';\nimport * as THREE from 'three';
|
||||
import * as THREE from 'three';
|
||||
import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js';
|
||||
import { RenderPass } from 'three/addons/postprocessing/RenderPass.js';
|
||||
import { UnrealBloomPass } from 'three/addons/postprocessing/UnrealBloomPass.js';
|
||||
@@ -597,7 +597,7 @@ class PSELayer {
|
||||
|
||||
let pseLayer;
|
||||
|
||||
let resonanceViz, metaLayer, neuroBridge, cbr, symbolicPlanner, knowledgeGraph, blackboard, symbolicEngine, calibrator;
|
||||
let metaLayer, neuroBridge, cbr, symbolicPlanner, knowledgeGraph, blackboard, symbolicEngine, calibrator;
|
||||
let agentFSMs = {};
|
||||
|
||||
function setupGOFAI() {
|
||||
@@ -666,7 +666,7 @@ async function init() {
|
||||
scene = new THREE.Scene();
|
||||
scene.fog = new THREE.FogExp2(0x050510, 0.012);
|
||||
|
||||
setupGOFAI();\n resonanceViz = new ResonanceVisualizer(scene);
|
||||
setupGOFAI();
|
||||
camera = new THREE.PerspectiveCamera(65, window.innerWidth / window.innerHeight, 0.1, 1000);
|
||||
camera.position.copy(playerPos);
|
||||
|
||||
|
||||
@@ -815,6 +815,42 @@ const SpatialMemory = (() => {
|
||||
return results.slice(0, maxResults);
|
||||
}
|
||||
|
||||
// ─── CONTENT SEARCH ─────────────────────────────────
|
||||
/**
|
||||
* Search memories by text content — case-insensitive substring match.
|
||||
* @param {string} query - Search text
|
||||
* @param {object} [options] - Optional filters
|
||||
* @param {string} [options.category] - Restrict to a specific region
|
||||
* @param {number} [options.maxResults=20] - Cap results
|
||||
* @returns {Array<{memory: object, score: number, position: THREE.Vector3}>}
|
||||
*/
|
||||
function searchByContent(query, options = {}) {
|
||||
if (!query || !query.trim()) return [];
|
||||
const { category, maxResults = 20 } = options;
|
||||
const needle = query.trim().toLowerCase();
|
||||
const results = [];
|
||||
|
||||
Object.values(_memoryObjects).forEach(obj => {
|
||||
if (category && obj.region !== category) return;
|
||||
const content = (obj.data.content || '').toLowerCase();
|
||||
if (!content.includes(needle)) return;
|
||||
|
||||
// Score: number of occurrences + strength bonus
|
||||
let matches = 0, idx = 0;
|
||||
while ((idx = content.indexOf(needle, idx)) !== -1) { matches++; idx += needle.length; }
|
||||
const score = matches + (obj.mesh.userData.strength || 0.7);
|
||||
|
||||
results.push({
|
||||
memory: obj.data,
|
||||
score,
|
||||
position: obj.mesh.position.clone()
|
||||
});
|
||||
});
|
||||
|
||||
results.sort((a, b) => b.score - a.score);
|
||||
return results.slice(0, maxResults);
|
||||
}
|
||||
|
||||
|
||||
// ─── CRYSTAL MESH COLLECTION (for raycasting) ────────
|
||||
function getCrystalMeshes() {
|
||||
@@ -864,7 +900,7 @@ const SpatialMemory = (() => {
|
||||
init, placeMemory, removeMemory, update, importMemories, updateMemory,
|
||||
getMemoryAtPosition, getRegionAtPosition, getMemoriesInRegion, getAllMemories,
|
||||
getCrystalMeshes, getMemoryFromMesh, highlightMemory, clearHighlight, getSelectedId,
|
||||
exportIndex, importIndex, searchNearby, REGIONS,
|
||||
exportIndex, importIndex, searchNearby, searchByContent, REGIONS,
|
||||
saveToStorage, loadFromStorage, clearStorage,
|
||||
runGravityLayout, setCamera
|
||||
};
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
|
||||
"""Resonance Linker — Finds second-degree connections in the holographic graph."""
|
||||
|
||||
class ResonanceLinker:
|
||||
def __init__(self, archive):
|
||||
self.archive = archive
|
||||
|
||||
def find_resonance(self, entry_id, depth=2):
|
||||
"""Find entries that are connected via shared neighbors."""
|
||||
if entry_id not in self.archive._entries: return []
|
||||
|
||||
entry = self.archive._entries[entry_id]
|
||||
neighbors = set(entry.links)
|
||||
resonance = {}
|
||||
|
||||
for neighbor_id in neighbors:
|
||||
if neighbor_id in self.archive._entries:
|
||||
for second_neighbor in self.archive._entries[neighbor_id].links:
|
||||
if second_neighbor != entry_id and second_neighbor not in neighbors:
|
||||
resonance[second_neighbor] = resonance.get(second_neighbor, 0) + 1
|
||||
|
||||
return sorted(resonance.items(), key=lambda x: x[1], reverse=True)
|
||||
@@ -45,7 +45,6 @@ from nexus.perception_adapter import (
|
||||
)
|
||||
from nexus.experience_store import ExperienceStore
|
||||
from nexus.groq_worker import GroqWorker
|
||||
from nexus.heartbeat import write_heartbeat
|
||||
from nexus.trajectory_logger import TrajectoryLogger
|
||||
|
||||
logging.basicConfig(
|
||||
@@ -287,13 +286,6 @@ class NexusMind:
|
||||
|
||||
self.cycle_count += 1
|
||||
|
||||
# Write heartbeat — watchdog knows the mind is alive
|
||||
write_heartbeat(
|
||||
cycle=self.cycle_count,
|
||||
model=self.model,
|
||||
status="thinking",
|
||||
)
|
||||
|
||||
# Periodically distill old memories
|
||||
if self.cycle_count % 50 == 0 and self.cycle_count > 0:
|
||||
await self._distill_memories()
|
||||
@@ -391,13 +383,6 @@ class NexusMind:
|
||||
salience=1.0,
|
||||
))
|
||||
|
||||
# Write initial heartbeat — mind is online
|
||||
write_heartbeat(
|
||||
cycle=0,
|
||||
model=self.model,
|
||||
status="thinking",
|
||||
)
|
||||
|
||||
while self.running:
|
||||
try:
|
||||
await self.think_once()
|
||||
@@ -438,13 +423,6 @@ class NexusMind:
|
||||
log.info("Nexus Mind shutting down...")
|
||||
self.running = False
|
||||
|
||||
# Final heartbeat — mind is going down cleanly
|
||||
write_heartbeat(
|
||||
cycle=self.cycle_count,
|
||||
model=self.model,
|
||||
status="idle",
|
||||
)
|
||||
|
||||
# Final stats
|
||||
stats = self.trajectory_logger.get_session_stats()
|
||||
log.info(f"Session stats: {json.dumps(stats, indent=2)}")
|
||||
|
||||
Reference in New Issue
Block a user