nexo-brain 5.3.26 → 5.3.27

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.
Files changed (211) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/package.json +1 -1
  3. package/src/server.py +3 -0
  4. package/src/tools_sessions.py +6 -1
  5. package/src/dashboard/static/favicon 2.svg +0 -32
  6. package/src/dashboard/static/nexo-logo 2.png +0 -0
  7. package/src/dashboard/static/nexo-logo 2.svg +0 -40
  8. package/src/dashboard/static/style 2.css +0 -2458
  9. package/src/dashboard/templates/adaptive 2.html +0 -118
  10. package/src/dashboard/templates/artifacts 2.html +0 -133
  11. package/src/dashboard/templates/backups 2.html +0 -136
  12. package/src/dashboard/templates/base 2.html +0 -417
  13. package/src/dashboard/templates/calendar 2.html +0 -591
  14. package/src/dashboard/templates/chat 2.html +0 -356
  15. package/src/dashboard/templates/claims 2.html +0 -259
  16. package/src/dashboard/templates/cortex 2.html +0 -321
  17. package/src/dashboard/templates/credentials 2.html +0 -128
  18. package/src/dashboard/templates/crons 2.html +0 -370
  19. package/src/dashboard/templates/dashboard 2.html +0 -494
  20. package/src/dashboard/templates/dreams 2.html +0 -252
  21. package/src/dashboard/templates/email 2.html +0 -160
  22. package/src/dashboard/templates/evolution 2.html +0 -189
  23. package/src/dashboard/templates/feed 2.html +0 -249
  24. package/src/dashboard/templates/followup_health 2.html +0 -170
  25. package/src/dashboard/templates/graph 2.html +0 -201
  26. package/src/dashboard/templates/guard 2.html +0 -259
  27. package/src/dashboard/templates/inbox 2.html +0 -251
  28. package/src/dashboard/templates/memory 2.html +0 -420
  29. package/src/dashboard/templates/operations 2.html +0 -608
  30. package/src/dashboard/templates/plugins 2.html +0 -185
  31. package/src/dashboard/templates/protocol 2.html +0 -199
  32. package/src/dashboard/templates/rules 2.html +0 -246
  33. package/src/dashboard/templates/sentiment 2.html +0 -247
  34. package/src/dashboard/templates/sessions 2.html +0 -218
  35. package/src/dashboard/templates/skills 2.html +0 -329
  36. package/src/dashboard/templates/somatic 2.html +0 -73
  37. package/src/dashboard/templates/triggers 2.html +0 -133
  38. package/src/dashboard/templates/trust 2.html +0 -360
  39. package/src/db/__init__ 2.py +0 -259
  40. package/src/db/_core 2.py +0 -437
  41. package/src/db/_credentials 2.py +0 -124
  42. package/src/db/_episodic 2.py +0 -762
  43. package/src/db/_evolution 2.py +0 -54
  44. package/src/db/_fts 2.py +0 -406
  45. package/src/db/_goal_profiles 2.py +0 -376
  46. package/src/db/_hot_context 2.py +0 -660
  47. package/src/db/_outcomes 2.py +0 -800
  48. package/src/db/_personal_scripts 2.py +0 -582
  49. package/src/db/_sessions 2.py +0 -330
  50. package/src/db/_tasks 2.py +0 -91
  51. package/src/db/_watchers 2.py +0 -173
  52. package/src/doctor/formatters 2.py +0 -52
  53. package/src/doctor/models 2.py +0 -69
  54. package/src/doctor/planes 2.py +0 -87
  55. package/src/doctor/providers/__init__ 2.py +0 -1
  56. package/src/doctor/providers/deep 2.py +0 -367
  57. package/src/evolution_cycle 2.py +0 -519
  58. package/src/hooks/auto_capture 2.py +0 -208
  59. package/src/hooks/caffeinate-guard 2.sh +0 -8
  60. package/src/hooks/capture-session 2.sh +0 -21
  61. package/src/hooks/capture-tool-logs 2.sh +0 -158
  62. package/src/hooks/daily-briefing-check 2.sh +0 -33
  63. package/src/hooks/heartbeat-enforcement 2.py +0 -90
  64. package/src/hooks/heartbeat-posttool 2.sh +0 -18
  65. package/src/hooks/inbox-hook 2.sh +0 -76
  66. package/src/hooks/post-compact 2.sh +0 -152
  67. package/src/hooks/pre-compact 2.sh +0 -169
  68. package/src/hooks/protocol-guardrail 2.sh +0 -10
  69. package/src/hooks/protocol-pretool-guardrail 2.sh +0 -9
  70. package/src/hooks/session-stop 2.sh +0 -52
  71. package/src/kg_populate 2.py +0 -292
  72. package/src/maintenance 2.py +0 -53
  73. package/src/memory_backends 2.py +0 -71
  74. package/src/migrate_embeddings 2.py +0 -124
  75. package/src/nexo_sdk 2.py +0 -103
  76. package/src/observability 2.py +0 -199
  77. package/src/plugin_loader 2.py +0 -217
  78. package/src/plugins/__init__ 2.py +0 -0
  79. package/src/plugins/artifact_registry 2.py +0 -450
  80. package/src/plugins/backup 2.py +0 -127
  81. package/src/plugins/claims_tools 2.py +0 -119
  82. package/src/plugins/cognitive_memory 2.py +0 -609
  83. package/src/plugins/core_rules 2.py +0 -252
  84. package/src/plugins/cortex 2.py +0 -1155
  85. package/src/plugins/entities 2.py +0 -67
  86. package/src/plugins/episodic_memory 2.py +0 -560
  87. package/src/plugins/evolution 2.py +0 -167
  88. package/src/plugins/goal_engine 2.py +0 -142
  89. package/src/plugins/guard 2.py +0 -862
  90. package/src/plugins/impact 2.py +0 -29
  91. package/src/plugins/knowledge_graph_tools 2.py +0 -137
  92. package/src/plugins/media_memory_tools 2.py +0 -98
  93. package/src/plugins/memory_export 2.py +0 -196
  94. package/src/plugins/outcomes 2.py +0 -130
  95. package/src/plugins/personal_scripts 2.py +0 -117
  96. package/src/plugins/preferences 2.py +0 -47
  97. package/src/plugins/protocol 2.py +0 -1449
  98. package/src/plugins/simple_api 2.py +0 -106
  99. package/src/plugins/skills 2.py +0 -341
  100. package/src/plugins/state_watchers 2.py +0 -79
  101. package/src/plugins/update 2.py +0 -986
  102. package/src/plugins/user_state_tools 2.py +0 -43
  103. package/src/plugins/workflow 2.py +0 -588
  104. package/src/protocol_settings 2.py +0 -59
  105. package/src/public_contribution 2.py +0 -466
  106. package/src/public_evolution_queue 2.py +0 -241
  107. package/src/requirements 2.txt +0 -14
  108. package/src/retroactive_learnings 2.py +0 -373
  109. package/src/rules/__init__ 2.py +0 -0
  110. package/src/rules/core-rules 2.json +0 -331
  111. package/src/rules/migrate 2.py +0 -207
  112. package/src/runtime_power 2.py +0 -874
  113. package/src/script_registry 2.py +0 -1559
  114. package/src/scripts/check-context 2.py +0 -272
  115. package/src/scripts/deep-sleep/apply_findings 2.py +0 -2327
  116. package/src/scripts/deep-sleep/collect 2.py +0 -928
  117. package/src/scripts/deep-sleep/extract 2.py +0 -330
  118. package/src/scripts/deep-sleep/extract-prompt 2.md +0 -285
  119. package/src/scripts/deep-sleep/synthesize 2.py +0 -312
  120. package/src/scripts/deep-sleep/synthesize-prompt 2.md +0 -336
  121. package/src/scripts/nexo-agent-run 2.py +0 -75
  122. package/src/scripts/nexo-auto-update 2.py +0 -6
  123. package/src/scripts/nexo-backup 2.sh +0 -25
  124. package/src/scripts/nexo-brain-activation 2.sh +0 -140
  125. package/src/scripts/nexo-catchup 2.py +0 -300
  126. package/src/scripts/nexo-cognitive-decay 2.py +0 -257
  127. package/src/scripts/nexo-cortex-cycle 2.py +0 -293
  128. package/src/scripts/nexo-cron-wrapper 2.sh +0 -53
  129. package/src/scripts/nexo-daily-self-audit 2.py +0 -2161
  130. package/src/scripts/nexo-dashboard 2.sh +0 -29
  131. package/src/scripts/nexo-deep-sleep 2.sh +0 -86
  132. package/src/scripts/nexo-evolution-run 2.py +0 -1664
  133. package/src/scripts/nexo-followup-hygiene 2.py +0 -139
  134. package/src/scripts/nexo-hook-record 2.py +0 -42
  135. package/src/scripts/nexo-immune 2.py +0 -936
  136. package/src/scripts/nexo-impact-scorer 2.py +0 -117
  137. package/src/scripts/nexo-inbox-hook 2.sh +0 -74
  138. package/src/scripts/nexo-install 2.py +0 -6
  139. package/src/scripts/nexo-learning-housekeep 2.py +0 -401
  140. package/src/scripts/nexo-learning-validator 2.py +0 -266
  141. package/src/scripts/nexo-migrate 2.py +0 -260
  142. package/src/scripts/nexo-outcome-checker 2.py +0 -127
  143. package/src/scripts/nexo-postmortem-consolidator 2.py +0 -456
  144. package/src/scripts/nexo-pre-commit 2.py +0 -120
  145. package/src/scripts/nexo-prevent-sleep 2.sh +0 -35
  146. package/src/scripts/nexo-proactive-dashboard 2.py +0 -354
  147. package/src/scripts/nexo-reflection 2.py +0 -256
  148. package/src/scripts/nexo-runtime-preflight 2.py +0 -274
  149. package/src/scripts/nexo-sleep 2.py +0 -631
  150. package/src/scripts/nexo-snapshot-restore 2.sh +0 -35
  151. package/src/scripts/nexo-sync-clients 2.py +0 -16
  152. package/src/scripts/nexo-synthesis 2.py +0 -475
  153. package/src/scripts/nexo-tcc-approve 2.sh +0 -79
  154. package/src/scripts/nexo-update 2.sh +0 -306
  155. package/src/scripts/nexo-watchdog 2.sh +0 -1207
  156. package/src/scripts/nexo-watchdog-smoke 2.py +0 -119
  157. package/src/scripts/rehydrate_learnings_from_archive 2.py +0 -245
  158. package/src/server 2.py +0 -1296
  159. package/src/skills/run-nexo-audit-phase/guide 2.md +0 -43
  160. package/src/skills/run-nexo-audit-phase/skill 2.json +0 -59
  161. package/src/skills/run-nexo-core-fix-cycle/guide 2.md +0 -17
  162. package/src/skills/run-nexo-core-fix-cycle/script 2.py +0 -276
  163. package/src/skills/run-nexo-core-fix-cycle/skill 2.json +0 -58
  164. package/src/skills/run-release-final-audit/guide 2.md +0 -16
  165. package/src/skills/run-release-final-audit/script 2.py +0 -259
  166. package/src/skills/run-release-final-audit/skill 2.json +0 -77
  167. package/src/skills/run-runtime-doctor/guide 2.md +0 -12
  168. package/src/skills/run-runtime-doctor/script 2.py +0 -21
  169. package/src/skills/run-runtime-doctor/skill 2.json +0 -25
  170. package/src/skills_runtime 2.py +0 -932
  171. package/src/state_watchers_runtime 2.py +0 -475
  172. package/src/storage_router 2.py +0 -32
  173. package/src/system_catalog 2.py +0 -786
  174. package/src/tools_coordination 2.py +0 -103
  175. package/src/tools_credentials 2.py +0 -68
  176. package/src/tools_drive 2.py +0 -487
  177. package/src/tools_hot_context 2.py +0 -163
  178. package/src/tools_learnings 2.py +0 -612
  179. package/src/tools_menu 2.py +0 -229
  180. package/src/tools_reminders 2.py +0 -88
  181. package/src/tools_reminders_crud 2.py +0 -363
  182. package/src/tools_sessions 2.py +0 -1054
  183. package/src/tools_system_catalog 2.py +0 -19
  184. package/src/tools_task_history 2.py +0 -57
  185. package/src/tools_transcripts 2.py +0 -98
  186. package/src/transcript_utils 2.py +0 -412
  187. package/src/user_context 2.py +0 -46
  188. package/src/user_data_portability 2.py +0 -328
  189. package/src/user_state_model 2.py +0 -170
  190. package/templates/CLAUDE.md 2.template +0 -108
  191. package/templates/CODEX.AGENTS.md 2.template +0 -66
  192. package/templates/launchagents/README 2.md +0 -132
  193. package/templates/launchagents/com.nexo.auto-close-sessions 2.plist +0 -39
  194. package/templates/launchagents/com.nexo.catchup 2.plist +0 -39
  195. package/templates/launchagents/com.nexo.cognitive-decay 2.plist +0 -40
  196. package/templates/launchagents/com.nexo.dashboard 2.plist +0 -43
  197. package/templates/launchagents/com.nexo.deep-sleep 2.plist +0 -43
  198. package/templates/launchagents/com.nexo.evolution 2.plist +0 -44
  199. package/templates/launchagents/com.nexo.followup-hygiene 2.plist +0 -45
  200. package/templates/launchagents/com.nexo.immune 2.plist +0 -41
  201. package/templates/launchagents/com.nexo.postmortem 2.plist +0 -45
  202. package/templates/launchagents/com.nexo.self-audit 2.plist +0 -47
  203. package/templates/launchagents/com.nexo.synthesis 2.plist +0 -45
  204. package/templates/launchagents/com.nexo.watchdog 2.plist +0 -37
  205. package/templates/nexo_helper 2.py +0 -301
  206. package/templates/openclaw 2.json +0 -13
  207. package/templates/plugin-template 2.py +0 -40
  208. package/templates/script-template 2.py +0 -59
  209. package/templates/script-template 2.sh +0 -13
  210. package/templates/skill-script-template 2.py +0 -48
  211. package/templates/skill-template 2.md +0 -33
@@ -1,494 +0,0 @@
1
- {% extends "base.html" %}
2
-
3
- {% block title %}Cognitive Pulse{% endblock %}
4
- {% block page_title %}Cognitive Pulse{% endblock %}
5
-
6
- {% block header_actions %}
7
- <button onclick="openQuickCreate('reminder')" class="text-xs px-2.5 py-1 rounded-md bg-slate-800 text-slate-300 hover:bg-slate-700 transition-colors">+ Reminder</button>
8
- <button onclick="openQuickCreate('followup')" class="text-xs px-2.5 py-1 rounded-md bg-slate-800 text-slate-300 hover:bg-slate-700 transition-colors">+ Followup</button>
9
- <button onclick="openQuickCreate('note')" class="text-xs px-2.5 py-1 rounded-md bg-slate-800 text-slate-300 hover:bg-slate-700 transition-colors">+ Note</button>
10
- {% endblock %}
11
-
12
- {% block content %}
13
- <div class="space-y-4">
14
- <!-- Row 1: 4 stat cards -->
15
- <div class="grid grid-cols-4 gap-4">
16
- <!-- Trust Score -->
17
- <div class="bg-slate-900/50 border border-slate-800/50 rounded-xl p-5 card">
18
- <div class="text-xs uppercase tracking-wider text-slate-400 font-medium mb-3">Trust Score</div>
19
- <div class="flex items-center gap-4">
20
- <div class="relative">
21
- <svg id="trust-gauge" viewBox="0 0 80 80" class="w-16 h-16">
22
- <circle cx="40" cy="40" r="32" fill="none" stroke="rgba(51,65,85,0.4)" stroke-width="6"/>
23
- <circle id="trust-arc" cx="40" cy="40" r="32" fill="none" stroke="#7C3AED" stroke-width="6"
24
- stroke-dasharray="0 201" stroke-dashoffset="50.3" stroke-linecap="round"
25
- style="transition: stroke-dasharray 1s ease-out, stroke 0.5s;"/>
26
- <text id="trust-center" x="40" y="44" text-anchor="middle" fill="#7C3AED" class="font-mono font-bold" style="font-size:16px">--</text>
27
- </svg>
28
- </div>
29
- <div>
30
- <div class="text-xs text-slate-500" id="trust-label">loading...</div>
31
- <div class="mt-1 h-1 w-20 bg-slate-800 rounded-full overflow-hidden">
32
- <div id="trust-bar" class="h-full bg-gradient-to-r from-violet-500 to-pink-500 rounded-full transition-all duration-700" style="width:0%"></div>
33
- </div>
34
- </div>
35
- </div>
36
- </div>
37
-
38
- <!-- Active Sessions -->
39
- <div class="bg-slate-900/50 border border-slate-800/50 rounded-xl p-5 card">
40
- <div class="text-xs uppercase tracking-wider text-slate-400 font-medium mb-3">Sessions</div>
41
- <div class="flex items-center gap-2">
42
- <span class="relative flex h-2.5 w-2.5">
43
- <span id="session-pulse" class="animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"></span>
44
- <span class="relative inline-flex rounded-full h-2.5 w-2.5 bg-emerald-500"></span>
45
- </span>
46
- <span class="text-2xl font-mono font-semibold text-slate-200" id="session-count">0</span>
47
- </div>
48
- <div class="mt-2 text-xs text-slate-500" id="session-label">active terminals</div>
49
- <div class="mt-1 text-xs text-slate-600 font-mono" id="session-detail">--</div>
50
- </div>
51
-
52
- <!-- Overdue Items -->
53
- <a href="/ops" class="bg-slate-900/50 border border-slate-800/50 rounded-xl p-5 card block hover:border-slate-700/50 transition-colors">
54
- <div class="text-xs uppercase tracking-wider text-slate-400 font-medium mb-3">Overdue</div>
55
- <div class="flex items-end gap-2">
56
- <span class="text-2xl font-mono font-semibold" id="overdue-count">0</span>
57
- </div>
58
- <div class="mt-2 text-xs text-slate-500" id="overdue-detail">reminders &amp; followups</div>
59
- <div class="mt-1 text-xs text-violet-500 font-medium">view in ops &rarr;</div>
60
- </a>
61
-
62
- <!-- Watchdog -->
63
- <div class="bg-slate-900/50 border border-slate-800/50 rounded-xl p-5 card">
64
- <div class="text-xs uppercase tracking-wider text-slate-400 font-medium mb-3">Watchdog</div>
65
- <div class="flex items-center gap-2 mb-3">
66
- <span id="watchdog-badge" class="inline-flex items-center px-2 py-0.5 rounded text-xs font-mono font-medium bg-slate-700 text-slate-300">--</span>
67
- </div>
68
- <div id="watchdog-services" class="space-y-1.5">
69
- <div class="text-xs text-slate-500">loading...</div>
70
- </div>
71
- </div>
72
- </div>
73
-
74
- <!-- Row 2: 3 detail cards -->
75
- <div class="grid grid-cols-3 gap-4">
76
- <!-- Today's Agenda -->
77
- <div class="bg-slate-900/50 border border-slate-800/50 rounded-xl p-5 card">
78
- <div class="text-xs uppercase tracking-wider text-slate-400 font-medium mb-3">Today's Agenda</div>
79
- <ul id="agenda-list" class="space-y-1.5">
80
- <li class="text-xs text-slate-600 py-1">No items due today</li>
81
- </ul>
82
- </div>
83
-
84
- <!-- Cognitive Memory -->
85
- <div class="bg-slate-900/50 border border-slate-800/50 rounded-xl p-5 card">
86
- <div class="text-xs uppercase tracking-wider text-slate-400 font-medium mb-3">Cognitive Memory</div>
87
- <div class="space-y-3">
88
- <div>
89
- <div class="flex items-center justify-between mb-1">
90
- <span class="text-xs text-slate-400 uppercase tracking-wide">STM</span>
91
- <span class="text-xs font-mono text-slate-300" id="cog-stm">--</span>
92
- </div>
93
- <div class="h-1 bg-slate-800 rounded-full overflow-hidden">
94
- <div id="cog-stm-bar" class="h-full bg-violet-500/60 rounded-full transition-all duration-500" style="width:0%"></div>
95
- </div>
96
- </div>
97
- <div>
98
- <div class="flex items-center justify-between mb-1">
99
- <span class="text-xs text-slate-400 uppercase tracking-wide">LTM</span>
100
- <span class="text-xs font-mono text-slate-300" id="cog-ltm">--</span>
101
- </div>
102
- <div class="h-1 bg-slate-800 rounded-full overflow-hidden">
103
- <div id="cog-ltm-bar" class="h-full bg-pink-500/60 rounded-full transition-all duration-500" style="width:0%"></div>
104
- </div>
105
- </div>
106
- <div class="flex items-center justify-between pt-1 border-t border-slate-800">
107
- <span class="text-xs text-slate-500">Avg strength</span>
108
- <span class="text-xs font-mono text-slate-400" id="cog-strength">--</span>
109
- </div>
110
- <div class="pt-1 border-t border-slate-800">
111
- <div class="text-xs text-slate-400 uppercase tracking-wide mb-2">Knowledge Graph</div>
112
- <div class="grid grid-cols-3 gap-2 text-center">
113
- <div>
114
- <div class="text-sm font-mono font-medium text-slate-200" id="kg-nodes">--</div>
115
- <div class="text-xs text-slate-500 mt-0.5">nodes</div>
116
- </div>
117
- <div>
118
- <div class="text-sm font-mono font-medium text-slate-200" id="kg-edges">--</div>
119
- <div class="text-xs text-slate-500 mt-0.5">edges</div>
120
- </div>
121
- <div>
122
- <div class="text-sm font-mono font-medium text-slate-200" id="kg-historical">--</div>
123
- <div class="text-xs text-slate-500 mt-0.5">hist.</div>
124
- </div>
125
- </div>
126
- </div>
127
- </div>
128
- </div>
129
-
130
- <!-- Recent Sessions -->
131
- <div class="bg-slate-900/50 border border-slate-800/50 rounded-xl p-5 card">
132
- <div class="flex items-center justify-between mb-3">
133
- <div class="text-xs uppercase tracking-wider text-slate-400 font-medium">Recent Sessions</div>
134
- <a href="/sessions" class="text-xs text-violet-400 hover:text-violet-300 transition-colors">view all &rarr;</a>
135
- </div>
136
- <div id="recent-sessions" class="space-y-3">
137
- <div class="text-xs text-slate-600">loading...</div>
138
- </div>
139
- </div>
140
- </div>
141
-
142
- <!-- Row 3: engineering loop narrative -->
143
- <div class="grid grid-cols-3 gap-4">
144
- <div class="bg-slate-900/50 border border-slate-800/50 rounded-xl p-5 card">
145
- <div class="text-xs uppercase tracking-wider text-slate-400 font-medium mb-3">What Matters Now</div>
146
- <ul id="matters-now-list" class="space-y-2">
147
- <li class="text-xs text-slate-600 py-1">loading...</li>
148
- </ul>
149
- </div>
150
-
151
- <div class="bg-slate-900/50 border border-slate-800/50 rounded-xl p-5 card">
152
- <div class="text-xs uppercase tracking-wider text-slate-400 font-medium mb-3">What Is Drifting</div>
153
- <ul id="drifting-list" class="space-y-2">
154
- <li class="text-xs text-slate-600 py-1">loading...</li>
155
- </ul>
156
- </div>
157
-
158
- <div class="bg-slate-900/50 border border-slate-800/50 rounded-xl p-5 card">
159
- <div class="text-xs uppercase tracking-wider text-slate-400 font-medium mb-3">What Is Improving</div>
160
- <ul id="improving-list" class="space-y-2">
161
- <li class="text-xs text-slate-600 py-1">loading...</li>
162
- </ul>
163
- </div>
164
- </div>
165
- </div>
166
-
167
- <!-- Quick Create Modal -->
168
- <div id="modal-overlay" class="hidden fixed inset-0 bg-black/60 backdrop-blur-sm z-[60] flex items-center justify-center" onclick="if(event.target===this)closeModal()">
169
- <div class="bg-slate-900 border border-slate-700 rounded-xl p-6 w-full max-w-md shadow-2xl animate-slide-in">
170
- <div class="flex items-center justify-between mb-4">
171
- <h2 id="modal-title" class="text-sm font-display font-semibold text-slate-100">New Item</h2>
172
- <button onclick="closeModal()" class="text-slate-400 hover:text-white text-lg leading-none">&times;</button>
173
- </div>
174
- <form id="modal-form" onsubmit="submitQuickCreate(event)" class="space-y-3">
175
- <div>
176
- <label class="block text-xs text-slate-400 mb-1">Description</label>
177
- <textarea name="description" rows="3" required class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-slate-200 focus:outline-none focus:ring-1 focus:ring-violet-500 resize-none placeholder-slate-600"></textarea>
178
- </div>
179
- <div>
180
- <label class="block text-xs text-slate-400 mb-1">Date <span class="text-slate-600">(optional)</span></label>
181
- <input type="date" name="date" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-slate-200 focus:outline-none focus:ring-1 focus:ring-violet-500">
182
- </div>
183
- <div id="category-group" class="hidden">
184
- <label class="block text-xs text-slate-400 mb-1">Category</label>
185
- <select name="category" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-slate-200 focus:outline-none focus:ring-1 focus:ring-violet-500">
186
- <option value="general">General</option>
187
- <option value="ideas">Ideas</option>
188
- <option value="my-project">My Project</option>
189
- <option value="project-a">Project A</option>
190
- <option value="server">Server</option>
191
- </select>
192
- </div>
193
- <div id="note-direction-group" class="hidden">
194
- <label class="block text-xs text-slate-400 mb-1">Direction</label>
195
- <select name="direction" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-slate-200 focus:outline-none focus:ring-1 focus:ring-violet-500">
196
- <option value="to_nexo">To NEXO</option>
197
- <option value="to_user">To User</option>
198
- </select>
199
- </div>
200
- <input type="hidden" name="type" id="modal-type">
201
- <div class="flex justify-end gap-2 pt-2">
202
- <button type="button" onclick="closeModal()" class="px-3 py-1.5 text-xs rounded-lg text-slate-400 hover:text-slate-200 transition-colors">Cancel</button>
203
- <button type="submit" class="px-3 py-1.5 text-xs rounded-lg bg-violet-600 text-white hover:bg-violet-500 transition-colors font-medium">Create</button>
204
- </div>
205
- </form>
206
- </div>
207
- </div>
208
- {% endblock %}
209
-
210
- {% block scripts %}
211
- <script>
212
- function getToday() { return new Date().toISOString().split('T')[0]; }
213
-
214
- function isInactiveItemStatus(status) {
215
- const normalized = String(status || '').trim().toUpperCase();
216
- return normalized.startsWith('COMPLETED') || ['ARCHIVED', 'DELETED', 'BLOCKED', 'WAITING', 'CANCELLED'].includes(normalized);
217
- }
218
-
219
- // -----------------------------------------------------------------------
220
- // Modal
221
- // -----------------------------------------------------------------------
222
- function openQuickCreate(type) {
223
- const overlay = document.getElementById('modal-overlay');
224
- const title = document.getElementById('modal-title');
225
- const typeInput = document.getElementById('modal-type');
226
- document.getElementById('modal-form').reset();
227
-
228
- typeInput.value = type;
229
- document.getElementById('category-group').classList.toggle('hidden', type !== 'reminder');
230
- document.getElementById('note-direction-group').classList.toggle('hidden', type !== 'note');
231
-
232
- if (type === 'reminder') title.textContent = 'New Reminder';
233
- else if (type === 'followup') title.textContent = 'New Followup';
234
- else title.textContent = 'New Note';
235
-
236
- overlay.classList.remove('hidden');
237
- }
238
-
239
- function closeModal() {
240
- document.getElementById('modal-overlay').classList.add('hidden');
241
- }
242
-
243
- document.addEventListener('keydown', e => { if (e.key === 'Escape') closeModal(); });
244
-
245
- async function submitQuickCreate(e) {
246
- e.preventDefault();
247
- const fd = new FormData(document.getElementById('modal-form'));
248
- const type = fd.get('type');
249
- let url, body;
250
-
251
- if (type === 'reminder') {
252
- url = '/api/reminders';
253
- body = { description: fd.get('description'), date: fd.get('date') || null, category: fd.get('category') || 'general' };
254
- } else if (type === 'followup') {
255
- url = '/api/followups';
256
- body = { description: fd.get('description'), date: fd.get('date') || null };
257
- } else {
258
- url = '/api/inbox';
259
- body = { direction: fd.get('direction') || 'to_nexo', content: fd.get('description') };
260
- }
261
-
262
- try {
263
- const res = await fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) });
264
- const data = await res.json();
265
- if (data.success) { showToast('Created successfully'); closeModal(); loadDashboardData(); }
266
- else showToast(data.error || data.detail || 'Create failed');
267
- } catch (err) { showToast('Error: ' + err.message); }
268
- }
269
-
270
- // -----------------------------------------------------------------------
271
- // Dashboard data
272
- // -----------------------------------------------------------------------
273
- async function loadDashboardData() {
274
- const today = getToday();
275
-
276
- const [trustData, statsData, remindersData, followupsData, sessionsData, watchdogData, inboxData, engineeringData] =
277
- await Promise.all([
278
- fetchJSON('/api/trust'),
279
- fetchJSON('/api/stats'),
280
- fetchJSON('/api/reminders'),
281
- fetchJSON('/api/followups'),
282
- fetchJSON('/api/sessions?limit=3'),
283
- fetchJSON('/api/watchdog'),
284
- fetchJSON('/api/inbox/unread'),
285
- fetchJSON('/api/engineering-loop'),
286
- ]);
287
-
288
- // --- Trust Score (animated gauge) ---
289
- if (trustData) {
290
- const score = trustData.current_score ?? 0;
291
- const pct = Math.max(0, Math.min(100, score));
292
- const circumference = 2 * Math.PI * 32;
293
- const arc = (pct / 100) * circumference;
294
-
295
- const trustArc = document.getElementById('trust-arc');
296
- const trustCenter = document.getElementById('trust-center');
297
- trustArc.setAttribute('stroke-dasharray', `${arc} ${circumference - arc}`);
298
- trustCenter.textContent = Math.round(score);
299
-
300
- // Color by score
301
- const color = pct >= 75 ? '#7C3AED' : pct >= 50 ? '#F59E0B' : '#EF4444';
302
- trustArc.setAttribute('stroke', color);
303
- trustCenter.setAttribute('fill', color);
304
-
305
- document.getElementById('trust-bar').style.width = pct + '%';
306
- document.getElementById('sidebar-trust-value').textContent = score.toFixed(1);
307
-
308
- const label = pct >= 75 ? 'high alignment' : pct >= 50 ? 'moderate' : pct >= 25 ? 'low -- more caution' : 'critical';
309
- document.getElementById('trust-label').textContent = label;
310
- }
311
-
312
- // --- Active Sessions ---
313
- if (sessionsData && sessionsData.sessions) {
314
- const cutoff = Date.now() - 15 * 60 * 1000;
315
- const active = sessionsData.sessions.filter(s => {
316
- const ts = new Date(s.last_heartbeat || s.created_at || 0).getTime();
317
- return ts > cutoff;
318
- });
319
- document.getElementById('session-count').textContent = active.length;
320
- document.getElementById('session-label').textContent = active.length === 1 ? 'active terminal' : 'active terminals';
321
- if (active.length > 0) {
322
- const names = active.slice(0, 2).map(s => s.session_id ? s.session_id.substring(0, 8) : '??').join(', ');
323
- document.getElementById('session-detail').textContent = names + (active.length > 2 ? ' +' + (active.length - 2) : '');
324
- } else {
325
- document.getElementById('session-detail').textContent = 'none active';
326
- document.getElementById('session-pulse').classList.remove('animate-ping');
327
- }
328
- }
329
-
330
- // --- Overdue Items ---
331
- if (remindersData || followupsData) {
332
- const reminders = (remindersData?.reminders || []).filter(r =>
333
- !isInactiveItemStatus(r.status) && r.date && r.date <= today);
334
- const followups = (followupsData?.followups || []).filter(f =>
335
- !isInactiveItemStatus(f.status) && f.date && f.date <= today);
336
- const total = reminders.length + followups.length;
337
- const el = document.getElementById('overdue-count');
338
- el.textContent = total;
339
- el.className = 'text-2xl font-mono font-semibold ' + (total > 0 ? 'text-red-400' : 'text-slate-200');
340
- document.getElementById('overdue-detail').textContent = reminders.length + ' reminders, ' + followups.length + ' followups';
341
- }
342
-
343
- // --- Watchdog ---
344
- const watchdogBadge = document.getElementById('watchdog-badge');
345
- const watchdogServices = document.getElementById('watchdog-services');
346
- if (watchdogData && !watchdogData.error) {
347
- const overall = watchdogData.summary?.overall || 'UNKNOWN';
348
- const isPass = overall === 'PASS' || overall === 'ok';
349
- watchdogBadge.textContent = overall;
350
- watchdogBadge.className = 'inline-flex items-center px-2 py-0.5 rounded text-xs font-mono font-medium ' +
351
- (isPass ? 'bg-emerald-500/10 text-emerald-400' : 'bg-red-500/10 text-red-400');
352
-
353
- const services = watchdogData.services || watchdogData.checks || [];
354
- if (Array.isArray(services) && services.length > 0) {
355
- watchdogServices.innerHTML = services.map(svc => {
356
- const ok = svc.status === 'ok' || svc.status === 'PASS' || svc.pass === true;
357
- const dot = ok ? 'bg-emerald-500' : 'bg-red-500';
358
- const name = svc.name || svc.service || 'unknown';
359
- return `<div class="flex items-center gap-1.5"><span class="w-1.5 h-1.5 rounded-full ${dot} flex-shrink-0"></span><span class="text-xs text-slate-400 truncate">${escapeHtml(name)}</span></div>`;
360
- }).join('');
361
- } else {
362
- const entries = Object.entries(watchdogData).filter(([k]) => k !== 'summary' && k !== 'timestamp');
363
- if (entries.length > 0) {
364
- watchdogServices.innerHTML = entries.map(([key, val]) => {
365
- if (typeof val !== 'object' || val === null) return '';
366
- const ok = val.status === 'PASS' || val.status === 'ok' || val.pass === true;
367
- const dot = ok ? 'bg-emerald-500' : 'bg-red-500';
368
- return `<div class="flex items-center gap-1.5"><span class="w-1.5 h-1.5 rounded-full ${dot} flex-shrink-0"></span><span class="text-xs text-slate-400 truncate">${escapeHtml(key)}</span></div>`;
369
- }).filter(Boolean).join('');
370
- }
371
- }
372
- } else {
373
- watchdogBadge.textContent = 'N/A';
374
- watchdogBadge.className = 'inline-flex items-center px-2 py-0.5 rounded text-xs font-mono font-medium bg-slate-700 text-slate-400';
375
- watchdogServices.innerHTML = '<div class="text-xs text-slate-600">no watchdog data</div>';
376
- }
377
-
378
- // --- Agenda ---
379
- const agendaList = document.getElementById('agenda-list');
380
- const agendaItems = [];
381
- if (remindersData?.reminders) {
382
- remindersData.reminders.filter(r => !isInactiveItemStatus(r.status) && r.date && r.date <= today)
383
- .forEach(r => agendaItems.push({ text: r.description, type: 'reminder', date: r.date }));
384
- }
385
- if (followupsData?.followups) {
386
- followupsData.followups.filter(f => !isInactiveItemStatus(f.status) && f.date && f.date <= today)
387
- .forEach(f => agendaItems.push({ text: f.description, type: 'followup', date: f.date }));
388
- }
389
- if (agendaItems.length > 0) {
390
- agendaList.innerHTML = agendaItems.slice(0, 8).map(item => {
391
- const color = item.type === 'reminder' ? 'text-amber-400' : 'text-violet-400';
392
- const badge = item.type === 'reminder' ? 'bg-amber-500/10 text-amber-400' : 'bg-violet-500/10 text-violet-400';
393
- return `<li class="flex items-start gap-2 py-1">
394
- <span class="px-1.5 py-0.5 rounded text-[9px] font-medium ${badge} mt-0.5">${item.type}</span>
395
- <span class="text-xs text-slate-300 leading-relaxed">${escapeHtml(item.text || '--')}</span>
396
- </li>`;
397
- }).join('');
398
- } else {
399
- agendaList.innerHTML = '<li class="text-xs text-slate-600 py-1">No items due today</li>';
400
- }
401
-
402
- // --- Cognitive Memory ---
403
- if (statsData) {
404
- const cog = statsData.cognitive || statsData;
405
- const stm = cog.stm_total ?? cog.stm_active ?? cog.stm_count ?? cog.stm ?? 0;
406
- const ltm = cog.ltm_active ?? cog.ltm_count ?? cog.ltm ?? 0;
407
- const strength = cog.avg_stm_strength ?? cog.avg_strength ?? 0;
408
- const stmCap = cog.stm_capacity || 500;
409
-
410
- document.getElementById('cog-stm').textContent = stm;
411
- document.getElementById('cog-ltm').textContent = ltm;
412
- document.getElementById('cog-strength').textContent = typeof strength === 'number' ? strength.toFixed(2) : strength;
413
- document.getElementById('cog-stm-bar').style.width = Math.min(100, (stm / stmCap) * 100) + '%';
414
- document.getElementById('cog-ltm-bar').style.width = Math.min(100, ltm > 0 ? 60 : 0) + '%';
415
-
416
- // KG stats
417
- const kg = statsData.knowledge_graph || statsData.kg || {};
418
- if (kg.nodes !== undefined || kg.entities !== undefined || kg.total_nodes !== undefined) {
419
- document.getElementById('kg-nodes').textContent = formatNumber(kg.nodes ?? kg.total_nodes ?? kg.entities ?? 0);
420
- document.getElementById('kg-edges').textContent = formatNumber(kg.edges ?? kg.edges_active ?? kg.relations ?? 0);
421
- document.getElementById('kg-historical').textContent = formatNumber(kg.historical ?? kg.edges_historical ?? 0);
422
- }
423
- }
424
-
425
- // --- Recent Sessions ---
426
- if (sessionsData) {
427
- const diaries = sessionsData.diaries || sessionsData.sessions || [];
428
- const container = document.getElementById('recent-sessions');
429
- if (diaries.length > 0) {
430
- container.innerHTML = diaries.slice(0, 3).map(d => {
431
- return `<div class="border-b border-slate-800/30 pb-2.5 last:border-0 last:pb-0">
432
- <div class="flex items-center gap-2 mb-1">
433
- <span class="text-[10px] font-mono text-violet-400">${escapeHtml(String(d.session_id || d.id || '').substring(0, 8))}</span>
434
- <span class="text-[10px] text-slate-600">${relativeTime(d.created_at)}</span>
435
- ${d.domain ? `<span class="text-[10px] px-1 py-0.5 rounded bg-slate-800 text-slate-400">${escapeHtml(d.domain)}</span>` : ''}
436
- </div>
437
- ${d.summary ? `<p class="text-xs text-slate-400 leading-relaxed line-clamp-2">${escapeHtml(d.summary)}</p>` : ''}
438
- ${d.mental_state ? `<div class="text-[10px] text-violet-400/60 mt-1 italic">${escapeHtml(d.mental_state)}</div>` : ''}
439
- </div>`;
440
- }).join('');
441
- } else {
442
- container.innerHTML = '<div class="text-xs text-slate-600">No recent sessions</div>';
443
- }
444
- }
445
-
446
- // --- Inbox badge ---
447
- if (inboxData) {
448
- const count = inboxData.count ?? inboxData.unread ?? (Array.isArray(inboxData) ? inboxData.length : 0);
449
- const badge = document.getElementById('inbox-badge');
450
- if (badge && count > 0) {
451
- badge.textContent = count;
452
- badge.classList.remove('hidden');
453
- badge.classList.add('flex');
454
- }
455
- }
456
-
457
- // --- Engineering loop narrative ---
458
- const toneClass = tone => {
459
- if (tone === 'critical') return 'text-red-400';
460
- if (tone === 'elevated' || tone === 'watch') return 'text-amber-400';
461
- return 'text-emerald-400';
462
- };
463
- const renderNarrativeList = (id, items, emptyText) => {
464
- const node = document.getElementById(id);
465
- if (!node) return;
466
- if (!items || items.length === 0) {
467
- node.innerHTML = `<li class="text-xs text-slate-600 py-1">${escapeHtml(emptyText)}</li>`;
468
- return;
469
- }
470
- node.innerHTML = items.map(item => `
471
- <li class="border-b border-slate-800/30 pb-2 last:border-0 last:pb-0">
472
- <div class="flex items-center justify-between gap-2">
473
- <span class="text-xs text-slate-300">${escapeHtml(item.title || '--')}</span>
474
- <span class="text-[10px] font-mono ${toneClass(item.tone)}">${escapeHtml(item.detail || '')}</span>
475
- </div>
476
- ${item.meta ? `<div class="text-[10px] text-slate-600 mt-1">${escapeHtml(item.meta)}</div>` : ''}
477
- </li>
478
- `).join('');
479
- };
480
- if (engineeringData && !engineeringData.error) {
481
- renderNarrativeList('matters-now-list', engineeringData.matters_now, 'No active pressure detected');
482
- renderNarrativeList('drifting-list', engineeringData.drifting, 'No major drift detected');
483
- renderNarrativeList('improving-list', engineeringData.improving, 'No improvement deltas yet');
484
- } else {
485
- renderNarrativeList('matters-now-list', [], 'No periodic summary available');
486
- renderNarrativeList('drifting-list', [], 'No periodic summary available');
487
- renderNarrativeList('improving-list', [], 'No periodic summary available');
488
- }
489
- }
490
-
491
- loadDashboardData();
492
- setInterval(loadDashboardData, 60000);
493
- </script>
494
- {% endblock %}