nexo-brain 5.3.13 → 5.3.15
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/.claude-plugin/plugin.json +1 -1
- package/bin/nexo-brain.js +52 -1
- package/package.json +1 -1
- package/src/crons/sync.py +18 -4
- package/src/dashboard/static/favicon 2.svg +32 -0
- package/src/dashboard/static/nexo-logo 2.png +0 -0
- package/src/dashboard/static/nexo-logo 2.svg +40 -0
- package/src/dashboard/static/style 2.css +2458 -0
- package/src/dashboard/templates/adaptive 2.html +118 -0
- package/src/dashboard/templates/artifacts 2.html +133 -0
- package/src/dashboard/templates/backups 2.html +136 -0
- package/src/dashboard/templates/base 2.html +417 -0
- package/src/dashboard/templates/calendar 2.html +591 -0
- package/src/dashboard/templates/chat 2.html +356 -0
- package/src/dashboard/templates/claims 2.html +259 -0
- package/src/dashboard/templates/cortex 2.html +321 -0
- package/src/dashboard/templates/credentials 2.html +128 -0
- package/src/dashboard/templates/crons 2.html +370 -0
- package/src/dashboard/templates/dashboard 2.html +494 -0
- package/src/dashboard/templates/dreams 2.html +252 -0
- package/src/dashboard/templates/email 2.html +160 -0
- package/src/dashboard/templates/evolution 2.html +189 -0
- package/src/dashboard/templates/feed 2.html +249 -0
- package/src/dashboard/templates/followup_health 2.html +170 -0
- package/src/dashboard/templates/graph 2.html +201 -0
- package/src/dashboard/templates/guard 2.html +259 -0
- package/src/dashboard/templates/inbox 2.html +251 -0
- package/src/dashboard/templates/memory 2.html +420 -0
- package/src/dashboard/templates/operations 2.html +608 -0
- package/src/dashboard/templates/plugins 2.html +185 -0
- package/src/dashboard/templates/protocol 2.html +199 -0
- package/src/dashboard/templates/rules 2.html +246 -0
- package/src/dashboard/templates/sentiment 2.html +247 -0
- package/src/dashboard/templates/sessions 2.html +218 -0
- package/src/dashboard/templates/skills 2.html +329 -0
- package/src/dashboard/templates/somatic 2.html +73 -0
- package/src/dashboard/templates/triggers 2.html +133 -0
- package/src/dashboard/templates/trust 2.html +360 -0
- package/src/db/__init__ 2.py +259 -0
- package/src/db/_core 2.py +437 -0
- package/src/db/_credentials 2.py +124 -0
- package/src/db/_entities.py +1 -1
- package/src/db/_episodic 2.py +762 -0
- package/src/db/_evolution 2.py +54 -0
- package/src/db/_fts 2.py +406 -0
- package/src/db/_goal_profiles 2.py +376 -0
- package/src/db/_hot_context 2.py +660 -0
- package/src/db/_outcomes 2.py +800 -0
- package/src/db/_personal_scripts 2.py +582 -0
- package/src/db/_sessions 2.py +330 -0
- package/src/db/_tasks 2.py +91 -0
- package/src/db/_watchers 2.py +173 -0
- package/src/doctor/formatters 2.py +52 -0
- package/src/doctor/models 2.py +69 -0
- package/src/doctor/planes 2.py +87 -0
- package/src/doctor/providers/__init__ 2.py +1 -0
- package/src/doctor/providers/deep 2.py +367 -0
- package/src/evolution_cycle 2.py +519 -0
- package/src/hooks/auto_capture 2.py +208 -0
- package/src/hooks/caffeinate-guard 2.sh +8 -0
- package/src/hooks/capture-session 2.sh +21 -0
- package/src/hooks/capture-tool-logs 2.sh +158 -0
- package/src/hooks/daily-briefing-check 2.sh +33 -0
- package/src/hooks/heartbeat-enforcement 2.py +90 -0
- package/src/hooks/heartbeat-posttool 2.sh +18 -0
- package/src/hooks/inbox-hook 2.sh +76 -0
- package/src/hooks/post-compact 2.sh +152 -0
- package/src/hooks/pre-compact 2.sh +169 -0
- package/src/hooks/protocol-guardrail 2.sh +10 -0
- package/src/hooks/protocol-pretool-guardrail 2.sh +9 -0
- package/src/hooks/session-stop 2.sh +52 -0
- package/src/kg_populate 2.py +292 -0
- package/src/maintenance 2.py +53 -0
- package/src/memory_backends 2.py +71 -0
- package/src/migrate_embeddings 2.py +124 -0
- package/src/nexo_sdk 2.py +103 -0
- package/src/observability 2.py +199 -0
- package/src/plugin_loader 2.py +217 -0
- package/src/plugins/__init__ 2.py +0 -0
- package/src/plugins/agents.py +10 -3
- package/src/plugins/artifact_registry 2.py +450 -0
- package/src/plugins/backup 2.py +127 -0
- package/src/plugins/claims_tools 2.py +119 -0
- package/src/plugins/cognitive_memory 2.py +609 -0
- package/src/plugins/core_rules 2.py +252 -0
- package/src/plugins/cortex 2.py +1155 -0
- package/src/plugins/entities 2.py +67 -0
- package/src/plugins/episodic_memory 2.py +560 -0
- package/src/plugins/evolution 2.py +167 -0
- package/src/plugins/goal_engine 2.py +142 -0
- package/src/plugins/guard 2.py +862 -0
- package/src/plugins/impact 2.py +29 -0
- package/src/plugins/knowledge_graph_tools 2.py +137 -0
- package/src/plugins/media_memory_tools 2.py +98 -0
- package/src/plugins/memory_export 2.py +196 -0
- package/src/plugins/outcomes 2.py +130 -0
- package/src/plugins/personal_scripts 2.py +117 -0
- package/src/plugins/preferences 2.py +47 -0
- package/src/plugins/protocol 2.py +1449 -0
- package/src/plugins/schedule.py +2 -1
- package/src/plugins/simple_api 2.py +106 -0
- package/src/plugins/skills 2.py +341 -0
- package/src/plugins/state_watchers 2.py +79 -0
- package/src/plugins/update 2.py +986 -0
- package/src/plugins/user_state_tools 2.py +43 -0
- package/src/plugins/workflow 2.py +588 -0
- package/src/protocol_settings 2.py +59 -0
- package/src/public_contribution 2.py +466 -0
- package/src/public_evolution_queue 2.py +241 -0
- package/src/requirements 2.txt +14 -0
- package/src/requirements.txt +1 -1
- package/src/retroactive_learnings 2.py +373 -0
- package/src/rules/__init__ 2.py +0 -0
- package/src/rules/core-rules 2.json +331 -0
- package/src/rules/migrate 2.py +207 -0
- package/src/runtime_power 2.py +874 -0
- package/src/runtime_power.py +18 -1
- package/src/script_registry 2.py +1559 -0
- package/src/scripts/check-context 2.py +272 -0
- package/src/scripts/deep-sleep/apply_findings 2.py +2327 -0
- package/src/scripts/deep-sleep/collect 2.py +928 -0
- package/src/scripts/deep-sleep/extract 2.py +330 -0
- package/src/scripts/deep-sleep/extract-prompt 2.md +285 -0
- package/src/scripts/deep-sleep/synthesize 2.py +312 -0
- package/src/scripts/deep-sleep/synthesize-prompt 2.md +336 -0
- package/src/scripts/nexo-agent-run 2.py +75 -0
- package/src/scripts/nexo-auto-update 2.py +6 -0
- package/src/scripts/nexo-backup 2.sh +25 -0
- package/src/scripts/nexo-brain-activation 2.sh +140 -0
- package/src/scripts/nexo-catchup 2.py +300 -0
- package/src/scripts/nexo-cognitive-decay 2.py +257 -0
- package/src/scripts/nexo-cortex-cycle 2.py +293 -0
- package/src/scripts/nexo-cron-wrapper 2.sh +53 -0
- package/src/scripts/nexo-cron-wrapper.sh +7 -0
- package/src/scripts/nexo-daily-self-audit 2.py +2161 -0
- package/src/scripts/nexo-dashboard 2.sh +29 -0
- package/src/scripts/nexo-deep-sleep 2.sh +86 -0
- package/src/scripts/nexo-evolution-run 2.py +1664 -0
- package/src/scripts/nexo-followup-hygiene 2.py +139 -0
- package/src/scripts/nexo-hook-record 2.py +42 -0
- package/src/scripts/nexo-immune 2.py +936 -0
- package/src/scripts/nexo-impact-scorer 2.py +117 -0
- package/src/scripts/nexo-inbox-hook 2.sh +74 -0
- package/src/scripts/nexo-install 2.py +6 -0
- package/src/scripts/nexo-learning-housekeep 2.py +401 -0
- package/src/scripts/nexo-learning-validator 2.py +266 -0
- package/src/scripts/nexo-migrate 2.py +260 -0
- package/src/scripts/nexo-outcome-checker 2.py +127 -0
- package/src/scripts/nexo-postmortem-consolidator 2.py +456 -0
- package/src/scripts/nexo-pre-commit 2.py +120 -0
- package/src/scripts/nexo-prevent-sleep 2.sh +35 -0
- package/src/scripts/nexo-proactive-dashboard 2.py +354 -0
- package/src/scripts/nexo-reflection 2.py +256 -0
- package/src/scripts/nexo-runtime-preflight 2.py +274 -0
- package/src/scripts/nexo-sleep 2.py +631 -0
- package/src/scripts/nexo-snapshot-restore 2.sh +35 -0
- package/src/scripts/nexo-sync-clients 2.py +16 -0
- package/src/scripts/nexo-synthesis 2.py +475 -0
- package/src/scripts/nexo-tcc-approve 2.sh +79 -0
- package/src/scripts/nexo-update 2.sh +306 -0
- package/src/scripts/nexo-watchdog 2.sh +1207 -0
- package/src/scripts/nexo-watchdog-smoke 2.py +119 -0
- package/src/scripts/rehydrate_learnings_from_archive 2.py +245 -0
- package/src/server 2.py +1296 -0
- package/src/skills/run-nexo-audit-phase/guide 2.md +43 -0
- package/src/skills/run-nexo-audit-phase/skill 2.json +59 -0
- package/src/skills/run-nexo-core-fix-cycle/guide 2.md +17 -0
- package/src/skills/run-nexo-core-fix-cycle/script 2.py +276 -0
- package/src/skills/run-nexo-core-fix-cycle/skill 2.json +58 -0
- package/src/skills/run-release-final-audit/guide 2.md +16 -0
- package/src/skills/run-release-final-audit/script 2.py +259 -0
- package/src/skills/run-release-final-audit/skill 2.json +77 -0
- package/src/skills/run-runtime-doctor/guide 2.md +12 -0
- package/src/skills/run-runtime-doctor/script 2.py +21 -0
- package/src/skills/run-runtime-doctor/skill 2.json +25 -0
- package/src/skills_runtime 2.py +932 -0
- package/src/state_watchers_runtime 2.py +475 -0
- package/src/storage_router 2.py +32 -0
- package/src/system_catalog 2.py +786 -0
- package/src/tools_coordination 2.py +103 -0
- package/src/tools_credentials 2.py +68 -0
- package/src/tools_drive 2.py +487 -0
- package/src/tools_hot_context 2.py +163 -0
- package/src/tools_learnings 2.py +612 -0
- package/src/tools_menu 2.py +229 -0
- package/src/tools_reminders 2.py +88 -0
- package/src/tools_reminders_crud 2.py +363 -0
- package/src/tools_sessions 2.py +1054 -0
- package/src/tools_system_catalog 2.py +19 -0
- package/src/tools_task_history 2.py +57 -0
- package/src/tools_transcripts 2.py +98 -0
- package/src/transcript_utils 2.py +412 -0
- package/src/user_context 2.py +46 -0
- package/src/user_data_portability 2.py +328 -0
- package/src/user_state_model 2.py +170 -0
- package/templates/CLAUDE.md 2.template +108 -0
- package/templates/CODEX.AGENTS.md 2.template +66 -0
- package/templates/launchagents/README 2.md +132 -0
- package/templates/launchagents/com.nexo.auto-close-sessions 2.plist +39 -0
- package/templates/launchagents/com.nexo.auto-close-sessions.plist +1 -1
- package/templates/launchagents/com.nexo.catchup 2.plist +39 -0
- package/templates/launchagents/com.nexo.catchup.plist +1 -1
- package/templates/launchagents/com.nexo.cognitive-decay 2.plist +40 -0
- package/templates/launchagents/com.nexo.dashboard 2.plist +43 -0
- package/templates/launchagents/com.nexo.dashboard.plist +1 -1
- package/templates/launchagents/com.nexo.deep-sleep 2.plist +43 -0
- package/templates/launchagents/com.nexo.deep-sleep.plist +1 -1
- package/templates/launchagents/com.nexo.evolution 2.plist +44 -0
- package/templates/launchagents/com.nexo.evolution.plist +1 -1
- package/templates/launchagents/com.nexo.followup-hygiene 2.plist +45 -0
- package/templates/launchagents/com.nexo.followup-hygiene.plist +1 -1
- package/templates/launchagents/com.nexo.immune 2.plist +41 -0
- package/templates/launchagents/com.nexo.immune.plist +1 -1
- package/templates/launchagents/com.nexo.postmortem 2.plist +45 -0
- package/templates/launchagents/com.nexo.postmortem.plist +1 -1
- package/templates/launchagents/com.nexo.self-audit 2.plist +47 -0
- package/templates/launchagents/com.nexo.self-audit.plist +1 -1
- package/templates/launchagents/com.nexo.synthesis 2.plist +45 -0
- package/templates/launchagents/com.nexo.synthesis.plist +1 -1
- package/templates/launchagents/com.nexo.watchdog 2.plist +37 -0
- package/templates/launchagents/com.nexo.watchdog.plist +1 -1
- package/templates/nexo_helper 2.py +301 -0
- package/templates/openclaw 2.json +13 -0
- package/templates/plugin-template 2.py +40 -0
- package/templates/script-template 2.py +59 -0
- package/templates/script-template 2.sh +13 -0
- package/templates/script-template.py +5 -4
- package/templates/skill-script-template 2.py +48 -0
- package/templates/skill-script-template.py +2 -1
- package/templates/skill-template 2.md +33 -0
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
{% extends "base.html" %}
|
|
2
|
+
|
|
3
|
+
{% block title %}Memory Flow{% endblock %}
|
|
4
|
+
{% block page_title %}Memory Flow{% endblock %}
|
|
5
|
+
|
|
6
|
+
{% block head %}
|
|
7
|
+
<style>
|
|
8
|
+
.flow-connector {
|
|
9
|
+
position: absolute;
|
|
10
|
+
height: 3px;
|
|
11
|
+
background: linear-gradient(90deg, var(--from), var(--to));
|
|
12
|
+
top: 50%;
|
|
13
|
+
transform: translateY(-50%);
|
|
14
|
+
border-radius: 2px;
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
}
|
|
17
|
+
.flow-connector::after {
|
|
18
|
+
content: '';
|
|
19
|
+
position: absolute;
|
|
20
|
+
top: 0; left: -100%; width: 60%; height: 100%;
|
|
21
|
+
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
|
|
22
|
+
animation: flowPulse 2s ease-in-out infinite;
|
|
23
|
+
}
|
|
24
|
+
@keyframes flowPulse {
|
|
25
|
+
0% { left: -60%; }
|
|
26
|
+
100% { left: 160%; }
|
|
27
|
+
}
|
|
28
|
+
.flow-box {
|
|
29
|
+
transition: transform 0.2s, box-shadow 0.2s;
|
|
30
|
+
}
|
|
31
|
+
.flow-box:hover {
|
|
32
|
+
transform: translateY(-2px);
|
|
33
|
+
box-shadow: 0 8px 25px rgba(0,0,0,0.3);
|
|
34
|
+
}
|
|
35
|
+
.memory-card {
|
|
36
|
+
transition: all 0.2s ease;
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
}
|
|
39
|
+
.memory-card:hover {
|
|
40
|
+
border-color: rgba(124,58,237,0.4);
|
|
41
|
+
box-shadow: 0 0 20px rgba(124,58,237,0.1);
|
|
42
|
+
}
|
|
43
|
+
.memory-card .full-content {
|
|
44
|
+
max-height: 0;
|
|
45
|
+
overflow: hidden;
|
|
46
|
+
transition: max-height 0.3s ease;
|
|
47
|
+
}
|
|
48
|
+
.memory-card.expanded .full-content {
|
|
49
|
+
max-height: 500px;
|
|
50
|
+
}
|
|
51
|
+
.strength-bar {
|
|
52
|
+
transition: width 0.8s ease-out;
|
|
53
|
+
}
|
|
54
|
+
@keyframes countUp {
|
|
55
|
+
from { opacity: 0; transform: translateY(10px); }
|
|
56
|
+
to { opacity: 1; transform: translateY(0); }
|
|
57
|
+
}
|
|
58
|
+
.count-animate {
|
|
59
|
+
animation: countUp 0.5s ease-out forwards;
|
|
60
|
+
}
|
|
61
|
+
</style>
|
|
62
|
+
{% endblock %}
|
|
63
|
+
|
|
64
|
+
{% block header_actions %}
|
|
65
|
+
<div class="flex items-center gap-2">
|
|
66
|
+
<input type="text" id="search-input" placeholder="Search memories..."
|
|
67
|
+
class="bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-xs text-slate-200 placeholder-slate-500 focus:outline-none focus:ring-1 focus:ring-violet-500 w-64"
|
|
68
|
+
onkeydown="if(event.key==='Enter')searchMemories()">
|
|
69
|
+
<button onclick="searchMemories()" class="px-3 py-1.5 text-xs bg-violet-600 text-white rounded-lg hover:bg-violet-500 transition-colors font-medium">Search</button>
|
|
70
|
+
</div>
|
|
71
|
+
{% endblock %}
|
|
72
|
+
|
|
73
|
+
{% block content %}
|
|
74
|
+
<!-- Flow Diagram -->
|
|
75
|
+
<div class="mb-6">
|
|
76
|
+
<h2 class="text-xs uppercase tracking-wider text-slate-500 font-semibold mb-4">Memory Pipeline</h2>
|
|
77
|
+
<div class="relative flex items-center justify-center gap-0 py-6 px-4" id="flow-diagram">
|
|
78
|
+
<!-- STM Box -->
|
|
79
|
+
<div class="flow-box bg-cyan-500/10 border border-cyan-500/30 rounded-xl p-5 text-center min-w-[140px] z-10">
|
|
80
|
+
<div class="text-xs uppercase tracking-wider text-cyan-400 font-semibold mb-1">STM</div>
|
|
81
|
+
<div class="text-3xl font-display font-bold text-cyan-300 count-animate" id="count-stm">--</div>
|
|
82
|
+
<div class="text-[10px] text-cyan-500/60 mt-1">Short-Term</div>
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<!-- Arrow STM -> LTM -->
|
|
86
|
+
<div class="flex flex-col items-center mx-2 z-10">
|
|
87
|
+
<div class="text-[10px] text-emerald-400 font-mono font-semibold mb-1" id="count-promoted">--</div>
|
|
88
|
+
<div class="w-24 h-[3px] rounded-full relative overflow-hidden bg-gradient-to-r from-cyan-500 to-violet-500">
|
|
89
|
+
<div class="absolute top-0 left-0 w-1/2 h-full bg-gradient-to-r from-transparent via-white/40 to-transparent" style="animation: flowPulse 2s ease-in-out infinite;"></div>
|
|
90
|
+
</div>
|
|
91
|
+
<div class="text-[10px] text-slate-600 mt-1">promoted</div>
|
|
92
|
+
</div>
|
|
93
|
+
|
|
94
|
+
<!-- LTM Box -->
|
|
95
|
+
<div class="flow-box bg-violet-500/10 border border-violet-500/30 rounded-xl p-5 text-center min-w-[140px] z-10">
|
|
96
|
+
<div class="text-xs uppercase tracking-wider text-violet-400 font-semibold mb-1">LTM</div>
|
|
97
|
+
<div class="text-3xl font-display font-bold text-violet-300 count-animate" id="count-ltm">--</div>
|
|
98
|
+
<div class="text-[10px] text-violet-500/60 mt-1">Long-Term</div>
|
|
99
|
+
</div>
|
|
100
|
+
|
|
101
|
+
<!-- Arrow to Dreamed -->
|
|
102
|
+
<div class="flex flex-col items-center mx-2 z-10">
|
|
103
|
+
<div class="text-[10px] text-indigo-400 font-mono font-semibold mb-1" id="count-dreamed">--</div>
|
|
104
|
+
<div class="w-16 h-[3px] rounded-full bg-gradient-to-r from-violet-500 to-indigo-500 relative overflow-hidden">
|
|
105
|
+
<div class="absolute top-0 left-0 w-1/2 h-full bg-gradient-to-r from-transparent via-white/30 to-transparent" style="animation: flowPulse 3s ease-in-out infinite;"></div>
|
|
106
|
+
</div>
|
|
107
|
+
<div class="text-[10px] text-slate-600 mt-1">dreamed</div>
|
|
108
|
+
</div>
|
|
109
|
+
|
|
110
|
+
<!-- Dreamed Box -->
|
|
111
|
+
<div class="flow-box bg-indigo-500/10 border border-indigo-500/30 rounded-xl p-5 text-center min-w-[130px] z-10">
|
|
112
|
+
<div class="text-xs uppercase tracking-wider text-indigo-400 font-semibold mb-1">Dreamed</div>
|
|
113
|
+
<div class="text-3xl font-display font-bold text-indigo-300 count-animate" id="count-dreamed-box">--</div>
|
|
114
|
+
<div class="text-[10px] text-indigo-500/60 mt-1">Insights</div>
|
|
115
|
+
</div>
|
|
116
|
+
|
|
117
|
+
<!-- Quarantine Branch (below STM) -->
|
|
118
|
+
<div class="absolute left-[calc(50%-280px)] top-[calc(100%-10px)] flex flex-col items-center z-10" id="quarantine-branch">
|
|
119
|
+
<div class="w-[3px] h-8 bg-gradient-to-b from-cyan-500/50 to-amber-500/50 rounded-full"></div>
|
|
120
|
+
<div class="flow-box bg-amber-500/10 border border-amber-500/30 rounded-xl p-4 text-center min-w-[120px]">
|
|
121
|
+
<div class="text-xs uppercase tracking-wider text-amber-400 font-semibold mb-1">Quarantine</div>
|
|
122
|
+
<div class="text-2xl font-display font-bold text-amber-300 count-animate" id="count-quarantine">--</div>
|
|
123
|
+
<div class="text-[10px] text-amber-500/60 mt-1">Pending Review</div>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
|
|
129
|
+
<!-- Hot Context -->
|
|
130
|
+
<div class="mb-6">
|
|
131
|
+
<div class="flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between mb-3">
|
|
132
|
+
<div>
|
|
133
|
+
<h2 class="text-xs uppercase tracking-wider text-slate-500 font-semibold flex items-center gap-2">
|
|
134
|
+
<span class="w-2 h-2 rounded-full bg-emerald-400 glow-dot" style="color:#34d399"></span>
|
|
135
|
+
Hot Context 24h
|
|
136
|
+
</h2>
|
|
137
|
+
<p class="text-xs text-slate-600 mt-1">Recent operational memory shared across sessions, clients, and channels.</p>
|
|
138
|
+
</div>
|
|
139
|
+
<div class="flex items-center gap-2">
|
|
140
|
+
<input type="text" id="context-query" placeholder="Search recent context..."
|
|
141
|
+
class="bg-slate-800 border border-slate-700 rounded-lg px-3 py-1.5 text-xs text-slate-200 placeholder-slate-500 focus:outline-none focus:ring-1 focus:ring-emerald-500 w-64"
|
|
142
|
+
onkeydown="if(event.key==='Enter')loadRecentContext()">
|
|
143
|
+
<button onclick="loadRecentContext()" class="px-3 py-1.5 text-xs bg-emerald-600 text-white rounded-lg hover:bg-emerald-500 transition-colors font-medium">Refresh</button>
|
|
144
|
+
</div>
|
|
145
|
+
</div>
|
|
146
|
+
|
|
147
|
+
<div class="grid grid-cols-1 xl:grid-cols-2 gap-5">
|
|
148
|
+
<div class="bg-emerald-500/5 border border-emerald-500/20 rounded-xl p-4">
|
|
149
|
+
<div class="flex items-center justify-between mb-3">
|
|
150
|
+
<div class="text-xs uppercase tracking-wider text-emerald-400 font-semibold">Active Contexts</div>
|
|
151
|
+
<div class="text-[10px] text-slate-500 font-mono" id="hot-context-count">--</div>
|
|
152
|
+
</div>
|
|
153
|
+
<div class="space-y-2" id="hot-context-list">
|
|
154
|
+
<div class="text-xs text-slate-600 text-center py-6">Loading...</div>
|
|
155
|
+
</div>
|
|
156
|
+
</div>
|
|
157
|
+
|
|
158
|
+
<div class="bg-emerald-500/5 border border-emerald-500/20 rounded-xl p-4">
|
|
159
|
+
<div class="flex items-center justify-between mb-3">
|
|
160
|
+
<div class="text-xs uppercase tracking-wider text-emerald-400 font-semibold">Recent Events</div>
|
|
161
|
+
<div class="text-[10px] text-slate-500 font-mono" id="hot-event-count">--</div>
|
|
162
|
+
</div>
|
|
163
|
+
<div class="space-y-2" id="hot-event-list">
|
|
164
|
+
<div class="text-xs text-slate-600 text-center py-6">Loading...</div>
|
|
165
|
+
</div>
|
|
166
|
+
</div>
|
|
167
|
+
</div>
|
|
168
|
+
</div>
|
|
169
|
+
|
|
170
|
+
<!-- Two-column: STM and LTM Recent -->
|
|
171
|
+
<div class="grid grid-cols-1 lg:grid-cols-2 gap-5 mb-6" id="columns-area">
|
|
172
|
+
<!-- Recent STM -->
|
|
173
|
+
<div>
|
|
174
|
+
<h2 class="text-xs uppercase tracking-wider text-slate-500 font-semibold mb-3 flex items-center gap-2">
|
|
175
|
+
<span class="w-2 h-2 rounded-full bg-cyan-400 glow-dot" style="color:#22d3ee"></span>
|
|
176
|
+
Recent STM
|
|
177
|
+
</h2>
|
|
178
|
+
<div class="space-y-2" id="stm-list">
|
|
179
|
+
<div class="text-xs text-slate-600 text-center py-8">Loading...</div>
|
|
180
|
+
</div>
|
|
181
|
+
</div>
|
|
182
|
+
|
|
183
|
+
<!-- Recent LTM -->
|
|
184
|
+
<div>
|
|
185
|
+
<h2 class="text-xs uppercase tracking-wider text-slate-500 font-semibold mb-3 flex items-center gap-2">
|
|
186
|
+
<span class="w-2 h-2 rounded-full bg-violet-400 glow-dot" style="color:#a78bfa"></span>
|
|
187
|
+
Recent LTM
|
|
188
|
+
</h2>
|
|
189
|
+
<div class="space-y-2" id="ltm-list">
|
|
190
|
+
<div class="text-xs text-slate-600 text-center py-8">Loading...</div>
|
|
191
|
+
</div>
|
|
192
|
+
</div>
|
|
193
|
+
</div>
|
|
194
|
+
|
|
195
|
+
<!-- Quarantine Items -->
|
|
196
|
+
<div class="mb-6" id="quarantine-section">
|
|
197
|
+
<h2 class="text-xs uppercase tracking-wider text-slate-500 font-semibold mb-3 flex items-center gap-2">
|
|
198
|
+
<span class="w-2 h-2 rounded-full bg-amber-400 glow-dot" style="color:#fbbf24"></span>
|
|
199
|
+
Quarantine Queue
|
|
200
|
+
</h2>
|
|
201
|
+
<div class="space-y-2" id="quarantine-list">
|
|
202
|
+
<div class="text-xs text-slate-600 text-center py-4">Loading...</div>
|
|
203
|
+
</div>
|
|
204
|
+
</div>
|
|
205
|
+
|
|
206
|
+
<!-- Search Results (hidden by default) -->
|
|
207
|
+
<div class="mb-6 hidden" id="search-results-section">
|
|
208
|
+
<div class="flex items-center justify-between mb-3">
|
|
209
|
+
<h2 class="text-xs uppercase tracking-wider text-slate-500 font-semibold flex items-center gap-2">
|
|
210
|
+
Search Results
|
|
211
|
+
<span class="text-violet-400 font-mono" id="search-count"></span>
|
|
212
|
+
</h2>
|
|
213
|
+
<button onclick="clearSearch()" class="text-xs text-slate-500 hover:text-slate-300 transition-colors">Clear</button>
|
|
214
|
+
</div>
|
|
215
|
+
<div class="space-y-2" id="search-results"></div>
|
|
216
|
+
</div>
|
|
217
|
+
{% endblock %}
|
|
218
|
+
|
|
219
|
+
{% block scripts %}
|
|
220
|
+
<script>
|
|
221
|
+
const REFRESH_MS = 60000;
|
|
222
|
+
|
|
223
|
+
function sourceTypeBadge(type) {
|
|
224
|
+
const map = {
|
|
225
|
+
learning: 'bg-blue-500/10 text-blue-400',
|
|
226
|
+
feedback: 'bg-pink-500/10 text-pink-400',
|
|
227
|
+
preference: 'bg-violet-500/10 text-violet-400',
|
|
228
|
+
diary: 'bg-cyan-500/10 text-cyan-400',
|
|
229
|
+
decision: 'bg-amber-500/10 text-amber-400',
|
|
230
|
+
};
|
|
231
|
+
return map[type] || 'bg-slate-700 text-slate-400';
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function renderMemoryCard(m) {
|
|
235
|
+
const content = m.content || '';
|
|
236
|
+
const snippet = content.length > 180 ? content.substring(0, 180) + '...' : content;
|
|
237
|
+
const hasMore = content.length > 180;
|
|
238
|
+
const strength = m.strength != null ? m.strength : null;
|
|
239
|
+
const sourceType = m.source_type || 'unknown';
|
|
240
|
+
const domain = m.domain || '';
|
|
241
|
+
const created = m.created_at ? relativeTime(m.created_at) : '';
|
|
242
|
+
|
|
243
|
+
return `<div class="memory-card bg-slate-900/50 border border-slate-800/50 rounded-xl p-4" onclick="this.classList.toggle('expanded')">
|
|
244
|
+
<div class="flex items-center gap-2 mb-2 flex-wrap">
|
|
245
|
+
<span class="text-[10px] px-1.5 py-0.5 rounded font-medium ${sourceTypeBadge(sourceType)}">${escapeHtml(sourceType)}</span>
|
|
246
|
+
${domain ? `<span class="text-[10px] px-1.5 py-0.5 rounded bg-slate-800 text-slate-500">${escapeHtml(domain)}</span>` : ''}
|
|
247
|
+
<span class="text-[10px] text-slate-600 ml-auto font-mono">${escapeHtml(created)}</span>
|
|
248
|
+
</div>
|
|
249
|
+
<p class="text-sm text-slate-300 leading-relaxed">${escapeHtml(snippet)}</p>
|
|
250
|
+
${hasMore ? `<div class="full-content mt-2 pt-2 border-t border-slate-800/50">
|
|
251
|
+
<p class="text-sm text-slate-300 leading-relaxed whitespace-pre-wrap">${escapeHtml(content)}</p>
|
|
252
|
+
</div>
|
|
253
|
+
<div class="text-[10px] text-violet-400 mt-1">Click to expand</div>` : ''}
|
|
254
|
+
${strength != null ? `<div class="mt-2 flex items-center gap-2">
|
|
255
|
+
<span class="text-[10px] text-slate-600">Strength</span>
|
|
256
|
+
<div class="flex-1 h-1.5 bg-slate-800 rounded-full overflow-hidden">
|
|
257
|
+
<div class="strength-bar h-full rounded-full ${strength > 0.7 ? 'bg-emerald-500' : strength > 0.4 ? 'bg-violet-500' : 'bg-amber-500'}" style="width:${(strength * 100).toFixed(0)}%"></div>
|
|
258
|
+
</div>
|
|
259
|
+
<span class="text-[10px] text-slate-500 font-mono">${strength.toFixed(2)}</span>
|
|
260
|
+
</div>` : ''}
|
|
261
|
+
</div>`;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
function renderQuarantineCard(m) {
|
|
265
|
+
const content = m.content || '';
|
|
266
|
+
const reason = m.quarantine_reason || m.reason || 'Unknown reason';
|
|
267
|
+
return `<div class="bg-amber-500/5 border border-amber-500/20 rounded-xl p-4">
|
|
268
|
+
<div class="flex items-center gap-2 mb-2">
|
|
269
|
+
<span class="text-[10px] px-1.5 py-0.5 rounded bg-amber-500/10 text-amber-400 font-medium">quarantine</span>
|
|
270
|
+
<span class="text-[10px] text-amber-500/60 ml-auto">${escapeHtml(reason)}</span>
|
|
271
|
+
</div>
|
|
272
|
+
<p class="text-sm text-slate-400 leading-relaxed">${escapeHtml(content.length > 200 ? content.substring(0, 200) + '...' : content)}</p>
|
|
273
|
+
</div>`;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
function recentTime(value) {
|
|
277
|
+
if (value === null || value === undefined || value === '') return '--';
|
|
278
|
+
if (typeof value === 'number') return relativeTime(new Date(value * 1000).toISOString());
|
|
279
|
+
if (/^\d+(\.\d+)?$/.test(String(value))) return relativeTime(new Date(parseFloat(value) * 1000).toISOString());
|
|
280
|
+
return relativeTime(value);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function renderHotContextCard(item) {
|
|
284
|
+
const title = item.title || item.context_key || '(untitled)';
|
|
285
|
+
const summary = item.summary || '';
|
|
286
|
+
const state = item.state || 'active';
|
|
287
|
+
const owner = item.owner || '';
|
|
288
|
+
const lastEvent = item.last_event_at ? recentTime(item.last_event_at) : '';
|
|
289
|
+
return `<div class="bg-slate-900/50 border border-emerald-500/15 rounded-xl p-4">
|
|
290
|
+
<div class="flex items-center gap-2 mb-2 flex-wrap">
|
|
291
|
+
<span class="text-[10px] px-1.5 py-0.5 rounded bg-emerald-500/10 text-emerald-400 font-medium">${escapeHtml(state)}</span>
|
|
292
|
+
${owner ? `<span class="text-[10px] px-1.5 py-0.5 rounded bg-slate-800 text-slate-500">${escapeHtml(owner)}</span>` : ''}
|
|
293
|
+
<span class="text-[10px] text-slate-600 ml-auto font-mono">${escapeHtml(lastEvent)}</span>
|
|
294
|
+
</div>
|
|
295
|
+
<div class="text-sm text-slate-200 leading-relaxed">${escapeHtml(title)}</div>
|
|
296
|
+
${summary ? `<div class="text-xs text-slate-400 leading-relaxed mt-2">${escapeHtml(summary)}</div>` : ''}
|
|
297
|
+
<div class="text-[10px] text-slate-600 font-mono mt-2">${escapeHtml(item.context_key || '')}</div>
|
|
298
|
+
</div>`;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
function renderHotEventCard(event) {
|
|
302
|
+
const title = event.title || event.context_key || '(event)';
|
|
303
|
+
const summary = event.summary || event.body || '';
|
|
304
|
+
const created = event.created_at ? recentTime(event.created_at) : '';
|
|
305
|
+
return `<div class="bg-slate-900/50 border border-emerald-500/15 rounded-xl p-4">
|
|
306
|
+
<div class="flex items-center gap-2 mb-2 flex-wrap">
|
|
307
|
+
<span class="text-[10px] px-1.5 py-0.5 rounded bg-emerald-500/10 text-emerald-400 font-medium">${escapeHtml(event.event_type || 'event')}</span>
|
|
308
|
+
<span class="text-[10px] text-slate-600 ml-auto font-mono">${escapeHtml(created)}</span>
|
|
309
|
+
</div>
|
|
310
|
+
<div class="text-sm text-slate-200 leading-relaxed">${escapeHtml(title)}</div>
|
|
311
|
+
${summary ? `<div class="text-xs text-slate-400 leading-relaxed mt-2 whitespace-pre-wrap">${escapeHtml(summary)}</div>` : ''}
|
|
312
|
+
<div class="text-[10px] text-slate-600 font-mono mt-2">${escapeHtml(event.context_key || '')}</div>
|
|
313
|
+
</div>`;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
async function loadRecentContext() {
|
|
317
|
+
const q = document.getElementById('context-query').value.trim();
|
|
318
|
+
const url = '/api/recent-context?hours=24&limit=8' + (q ? `&query=${encodeURIComponent(q)}` : '');
|
|
319
|
+
const data = await fetchJSON(url);
|
|
320
|
+
if (!data) return;
|
|
321
|
+
|
|
322
|
+
document.getElementById('hot-context-count').textContent = formatNumber((data.counts && data.counts.contexts) || 0);
|
|
323
|
+
document.getElementById('hot-event-count').textContent = formatNumber((data.counts && data.counts.events) || 0);
|
|
324
|
+
|
|
325
|
+
const contexts = data.contexts || [];
|
|
326
|
+
const events = data.events || [];
|
|
327
|
+
document.getElementById('hot-context-list').innerHTML = contexts.length === 0
|
|
328
|
+
? '<div class="text-xs text-slate-600 text-center py-6">No active hot context in the last 24h</div>'
|
|
329
|
+
: contexts.map(renderHotContextCard).join('');
|
|
330
|
+
document.getElementById('hot-event-list').innerHTML = events.length === 0
|
|
331
|
+
? '<div class="text-xs text-slate-600 text-center py-6">No recent events in the last 24h</div>'
|
|
332
|
+
: events.map(renderHotEventCard).join('');
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
async function loadFlow() {
|
|
336
|
+
const data = await fetchJSON('/api/memory/flow');
|
|
337
|
+
if (!data) return;
|
|
338
|
+
|
|
339
|
+
const c = data.counts || {};
|
|
340
|
+
animateCount('count-stm', c.stm || 0);
|
|
341
|
+
animateCount('count-ltm', c.ltm || 0);
|
|
342
|
+
animateCount('count-quarantine', c.quarantine || 0);
|
|
343
|
+
animateCount('count-dreamed-box', c.dreamed || 0);
|
|
344
|
+
document.getElementById('count-promoted').textContent = formatNumber(c.promoted || 0);
|
|
345
|
+
document.getElementById('count-dreamed').textContent = formatNumber(c.dreamed || 0);
|
|
346
|
+
|
|
347
|
+
// STM recent
|
|
348
|
+
const stmList = document.getElementById('stm-list');
|
|
349
|
+
const stmItems = data.stm_recent || [];
|
|
350
|
+
stmList.innerHTML = stmItems.length === 0
|
|
351
|
+
? '<div class="text-xs text-slate-600 text-center py-6">No recent STM memories</div>'
|
|
352
|
+
: stmItems.map(renderMemoryCard).join('');
|
|
353
|
+
|
|
354
|
+
// LTM recent
|
|
355
|
+
const ltmList = document.getElementById('ltm-list');
|
|
356
|
+
const ltmItems = data.ltm_recent || [];
|
|
357
|
+
ltmList.innerHTML = ltmItems.length === 0
|
|
358
|
+
? '<div class="text-xs text-slate-600 text-center py-6">No recent LTM memories</div>'
|
|
359
|
+
: ltmItems.map(renderMemoryCard).join('');
|
|
360
|
+
|
|
361
|
+
// Quarantine
|
|
362
|
+
const qList = document.getElementById('quarantine-list');
|
|
363
|
+
const qItems = data.quarantine || [];
|
|
364
|
+
qList.innerHTML = qItems.length === 0
|
|
365
|
+
? '<div class="text-xs text-slate-600 text-center py-4">No items in quarantine</div>'
|
|
366
|
+
: qItems.map(renderQuarantineCard).join('');
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
function animateCount(id, target) {
|
|
370
|
+
const el = document.getElementById(id);
|
|
371
|
+
if (!el) return;
|
|
372
|
+
const start = parseInt(el.textContent) || 0;
|
|
373
|
+
if (start === target) { el.textContent = formatNumber(target); return; }
|
|
374
|
+
const duration = 600;
|
|
375
|
+
const startTime = performance.now();
|
|
376
|
+
function step(now) {
|
|
377
|
+
const progress = Math.min((now - startTime) / duration, 1);
|
|
378
|
+
const eased = 1 - Math.pow(1 - progress, 3);
|
|
379
|
+
el.textContent = formatNumber(Math.round(start + (target - start) * eased));
|
|
380
|
+
if (progress < 1) requestAnimationFrame(step);
|
|
381
|
+
}
|
|
382
|
+
requestAnimationFrame(step);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
async function searchMemories() {
|
|
386
|
+
const q = document.getElementById('search-input').value.trim();
|
|
387
|
+
if (!q) return;
|
|
388
|
+
|
|
389
|
+
const section = document.getElementById('search-results-section');
|
|
390
|
+
const results = document.getElementById('search-results');
|
|
391
|
+
const count = document.getElementById('search-count');
|
|
392
|
+
|
|
393
|
+
section.classList.remove('hidden');
|
|
394
|
+
results.innerHTML = '<div class="text-xs text-slate-500 text-center py-4">Searching...</div>';
|
|
395
|
+
|
|
396
|
+
const data = await fetchJSON(`/api/memories?q=${encodeURIComponent(q)}&limit=30`);
|
|
397
|
+
if (!data) {
|
|
398
|
+
results.innerHTML = '<div class="text-xs text-red-400 text-center py-4">Search failed</div>';
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
const items = data.results || [];
|
|
403
|
+
count.textContent = `(${items.length})`;
|
|
404
|
+
results.innerHTML = items.length === 0
|
|
405
|
+
? '<div class="text-xs text-slate-600 text-center py-6">No memories found</div>'
|
|
406
|
+
: items.map(renderMemoryCard).join('');
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
function clearSearch() {
|
|
410
|
+
document.getElementById('search-results-section').classList.add('hidden');
|
|
411
|
+
document.getElementById('search-input').value = '';
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
// Init
|
|
415
|
+
loadRecentContext();
|
|
416
|
+
loadFlow();
|
|
417
|
+
setInterval(loadRecentContext, REFRESH_MS);
|
|
418
|
+
setInterval(loadFlow, REFRESH_MS);
|
|
419
|
+
</script>
|
|
420
|
+
{% endblock %}
|