Compare commits
5 Commits
1a8e0353f5
...
4b520b2bc2
| Author | SHA1 | Date | |
|---|---|---|---|
| 4b520b2bc2 | |||
| 7bebd8ae50 | |||
| 3f7fba7e0e | |||
| 6f2d274d5d | |||
| 7615dedf9e |
+15
-7
@@ -34,7 +34,6 @@ from apscheduler.triggers.cron import CronTrigger
|
||||
load_dotenv(Path.home() / "aaronai" / ".env")
|
||||
|
||||
MEMORY_PATH = Path.home() / "aaronai" / "memory.md"
|
||||
DB_PATH = str(Path.home() / "aaronai" / "db")
|
||||
CONVERSATIONS_DB = str(Path.home() / "aaronai" / "conversations.db")
|
||||
SETTINGS_PATH = Path.home() / "aaronai" / "settings.json"
|
||||
WATCHER_LOG = str(Path.home() / "aaronai" / "watcher.log")
|
||||
@@ -50,7 +49,7 @@ DEFAULT_SETTINGS = {
|
||||
"show_sources": True,
|
||||
"dream_hour_utc": 8,
|
||||
"dream_minute_utc": 0,
|
||||
"dream_mode": "nrem",
|
||||
"dream_mode": "pipeline",
|
||||
"ingest_hour_utc": 2,
|
||||
"ingest_minute_utc": 30,
|
||||
"share_time": True,
|
||||
@@ -382,7 +381,7 @@ async def logout(request: Request, response: Response):
|
||||
@app.get("/auth/check")
|
||||
async def check_auth(request: Request):
|
||||
token = get_session(request)
|
||||
if not token or token not in SESSIONS:
|
||||
if not token or not session_exists(token):
|
||||
return JSONResponse({"authenticated": False})
|
||||
return JSONResponse({"authenticated": True})
|
||||
|
||||
@@ -1071,7 +1070,7 @@ async def corpus_retry(request: Request, auth: str = Depends(require_auth)):
|
||||
ON CONFLICT (source) DO UPDATE SET
|
||||
full_text = EXCLUDED.full_text, char_length = EXCLUDED.char_length,
|
||||
enqueued_at = NOW(), completed_at = NULL, failed_at = NULL, attempts = 0
|
||||
""", (source, text[:50000], len(text)))
|
||||
""", (source, text, len(text)))
|
||||
cur.execute("""
|
||||
UPDATE ingest_failures SET retry_count = retry_count + 1, last_failed_at = NOW()
|
||||
WHERE source = %s
|
||||
@@ -1105,16 +1104,25 @@ async def corpus_reconcile(request: Request, background_tasks: BackgroundTasks,
|
||||
scheduler = BackgroundScheduler()
|
||||
|
||||
def run_dream_job():
|
||||
"""Runs nightly dreamer — full interdependent pipeline, no mode flag."""
|
||||
"""Runs nightly dreamer at the mode set in settings.json (default: pipeline)."""
|
||||
try:
|
||||
import subprocess
|
||||
settings = load_settings()
|
||||
mode = settings.get("dream_mode", "pipeline")
|
||||
valid_modes = {"pipeline", "nrem", "early-rem", "late-rem"}
|
||||
if mode not in valid_modes:
|
||||
print(f"Dreamer: invalid dream_mode={mode!r}; falling back to pipeline")
|
||||
mode = "pipeline"
|
||||
dream_script = str(Path.home() / "aaronai" / "scripts" / "dream.py")
|
||||
cmd = [PYTHON, dream_script]
|
||||
if mode != "pipeline":
|
||||
cmd += ["--mode", mode]
|
||||
result = subprocess.run(
|
||||
[PYTHON, dream_script],
|
||||
cmd,
|
||||
cwd=str(Path.home() / "aaronai"),
|
||||
capture_output=True, text=True, timeout=600
|
||||
)
|
||||
print(f"Dreamer completed: {result.stdout[-200:] if result.stdout else 'no output'}")
|
||||
print(f"Dreamer completed (mode={mode}): {result.stdout[-200:] if result.stdout else 'no output'}")
|
||||
if result.returncode != 0:
|
||||
print(f"Dreamer error: {result.stderr[-200:] if result.stderr else 'unknown'}")
|
||||
except Exception as e:
|
||||
|
||||
+3
-1
@@ -473,7 +473,9 @@ def dream_pipeline():
|
||||
|
||||
# ── Stage 1: NREM ──────────────────────────────────────────────────────
|
||||
print("\n[NREM] Retrieving...")
|
||||
nrem_chunks = retrieve("nrem", excluded_sources=previously_retrieved | session_retrieved)
|
||||
# NREM is replay-and-consolidation — does not exclude prior traces.
|
||||
# Late REM and Early REM exclude prior content for novelty; NREM does not.
|
||||
nrem_chunks = retrieve("nrem", excluded_sources=None)
|
||||
session_retrieved.update(c["source"] for c in nrem_chunks)
|
||||
# Track sources that scored above Early REM ceiling — these are the only ones Early REM should exclude
|
||||
nrem_high_sources = {c["source"] for c in nrem_chunks if c["similarity"] > 0.55}
|
||||
|
||||
Reference in New Issue
Block a user