nexo-brain 5.3.26 → 5.3.28

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 (212) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/package.json +1 -1
  3. package/src/hook_guardrails.py +44 -0
  4. package/src/server.py +3 -0
  5. package/src/tools_sessions.py +6 -1
  6. package/src/dashboard/static/favicon 2.svg +0 -32
  7. package/src/dashboard/static/nexo-logo 2.png +0 -0
  8. package/src/dashboard/static/nexo-logo 2.svg +0 -40
  9. package/src/dashboard/static/style 2.css +0 -2458
  10. package/src/dashboard/templates/adaptive 2.html +0 -118
  11. package/src/dashboard/templates/artifacts 2.html +0 -133
  12. package/src/dashboard/templates/backups 2.html +0 -136
  13. package/src/dashboard/templates/base 2.html +0 -417
  14. package/src/dashboard/templates/calendar 2.html +0 -591
  15. package/src/dashboard/templates/chat 2.html +0 -356
  16. package/src/dashboard/templates/claims 2.html +0 -259
  17. package/src/dashboard/templates/cortex 2.html +0 -321
  18. package/src/dashboard/templates/credentials 2.html +0 -128
  19. package/src/dashboard/templates/crons 2.html +0 -370
  20. package/src/dashboard/templates/dashboard 2.html +0 -494
  21. package/src/dashboard/templates/dreams 2.html +0 -252
  22. package/src/dashboard/templates/email 2.html +0 -160
  23. package/src/dashboard/templates/evolution 2.html +0 -189
  24. package/src/dashboard/templates/feed 2.html +0 -249
  25. package/src/dashboard/templates/followup_health 2.html +0 -170
  26. package/src/dashboard/templates/graph 2.html +0 -201
  27. package/src/dashboard/templates/guard 2.html +0 -259
  28. package/src/dashboard/templates/inbox 2.html +0 -251
  29. package/src/dashboard/templates/memory 2.html +0 -420
  30. package/src/dashboard/templates/operations 2.html +0 -608
  31. package/src/dashboard/templates/plugins 2.html +0 -185
  32. package/src/dashboard/templates/protocol 2.html +0 -199
  33. package/src/dashboard/templates/rules 2.html +0 -246
  34. package/src/dashboard/templates/sentiment 2.html +0 -247
  35. package/src/dashboard/templates/sessions 2.html +0 -218
  36. package/src/dashboard/templates/skills 2.html +0 -329
  37. package/src/dashboard/templates/somatic 2.html +0 -73
  38. package/src/dashboard/templates/triggers 2.html +0 -133
  39. package/src/dashboard/templates/trust 2.html +0 -360
  40. package/src/db/__init__ 2.py +0 -259
  41. package/src/db/_core 2.py +0 -437
  42. package/src/db/_credentials 2.py +0 -124
  43. package/src/db/_episodic 2.py +0 -762
  44. package/src/db/_evolution 2.py +0 -54
  45. package/src/db/_fts 2.py +0 -406
  46. package/src/db/_goal_profiles 2.py +0 -376
  47. package/src/db/_hot_context 2.py +0 -660
  48. package/src/db/_outcomes 2.py +0 -800
  49. package/src/db/_personal_scripts 2.py +0 -582
  50. package/src/db/_sessions 2.py +0 -330
  51. package/src/db/_tasks 2.py +0 -91
  52. package/src/db/_watchers 2.py +0 -173
  53. package/src/doctor/formatters 2.py +0 -52
  54. package/src/doctor/models 2.py +0 -69
  55. package/src/doctor/planes 2.py +0 -87
  56. package/src/doctor/providers/__init__ 2.py +0 -1
  57. package/src/doctor/providers/deep 2.py +0 -367
  58. package/src/evolution_cycle 2.py +0 -519
  59. package/src/hooks/auto_capture 2.py +0 -208
  60. package/src/hooks/caffeinate-guard 2.sh +0 -8
  61. package/src/hooks/capture-session 2.sh +0 -21
  62. package/src/hooks/capture-tool-logs 2.sh +0 -158
  63. package/src/hooks/daily-briefing-check 2.sh +0 -33
  64. package/src/hooks/heartbeat-enforcement 2.py +0 -90
  65. package/src/hooks/heartbeat-posttool 2.sh +0 -18
  66. package/src/hooks/inbox-hook 2.sh +0 -76
  67. package/src/hooks/post-compact 2.sh +0 -152
  68. package/src/hooks/pre-compact 2.sh +0 -169
  69. package/src/hooks/protocol-guardrail 2.sh +0 -10
  70. package/src/hooks/protocol-pretool-guardrail 2.sh +0 -9
  71. package/src/hooks/session-stop 2.sh +0 -52
  72. package/src/kg_populate 2.py +0 -292
  73. package/src/maintenance 2.py +0 -53
  74. package/src/memory_backends 2.py +0 -71
  75. package/src/migrate_embeddings 2.py +0 -124
  76. package/src/nexo_sdk 2.py +0 -103
  77. package/src/observability 2.py +0 -199
  78. package/src/plugin_loader 2.py +0 -217
  79. package/src/plugins/__init__ 2.py +0 -0
  80. package/src/plugins/artifact_registry 2.py +0 -450
  81. package/src/plugins/backup 2.py +0 -127
  82. package/src/plugins/claims_tools 2.py +0 -119
  83. package/src/plugins/cognitive_memory 2.py +0 -609
  84. package/src/plugins/core_rules 2.py +0 -252
  85. package/src/plugins/cortex 2.py +0 -1155
  86. package/src/plugins/entities 2.py +0 -67
  87. package/src/plugins/episodic_memory 2.py +0 -560
  88. package/src/plugins/evolution 2.py +0 -167
  89. package/src/plugins/goal_engine 2.py +0 -142
  90. package/src/plugins/guard 2.py +0 -862
  91. package/src/plugins/impact 2.py +0 -29
  92. package/src/plugins/knowledge_graph_tools 2.py +0 -137
  93. package/src/plugins/media_memory_tools 2.py +0 -98
  94. package/src/plugins/memory_export 2.py +0 -196
  95. package/src/plugins/outcomes 2.py +0 -130
  96. package/src/plugins/personal_scripts 2.py +0 -117
  97. package/src/plugins/preferences 2.py +0 -47
  98. package/src/plugins/protocol 2.py +0 -1449
  99. package/src/plugins/simple_api 2.py +0 -106
  100. package/src/plugins/skills 2.py +0 -341
  101. package/src/plugins/state_watchers 2.py +0 -79
  102. package/src/plugins/update 2.py +0 -986
  103. package/src/plugins/user_state_tools 2.py +0 -43
  104. package/src/plugins/workflow 2.py +0 -588
  105. package/src/protocol_settings 2.py +0 -59
  106. package/src/public_contribution 2.py +0 -466
  107. package/src/public_evolution_queue 2.py +0 -241
  108. package/src/requirements 2.txt +0 -14
  109. package/src/retroactive_learnings 2.py +0 -373
  110. package/src/rules/__init__ 2.py +0 -0
  111. package/src/rules/core-rules 2.json +0 -331
  112. package/src/rules/migrate 2.py +0 -207
  113. package/src/runtime_power 2.py +0 -874
  114. package/src/script_registry 2.py +0 -1559
  115. package/src/scripts/check-context 2.py +0 -272
  116. package/src/scripts/deep-sleep/apply_findings 2.py +0 -2327
  117. package/src/scripts/deep-sleep/collect 2.py +0 -928
  118. package/src/scripts/deep-sleep/extract 2.py +0 -330
  119. package/src/scripts/deep-sleep/extract-prompt 2.md +0 -285
  120. package/src/scripts/deep-sleep/synthesize 2.py +0 -312
  121. package/src/scripts/deep-sleep/synthesize-prompt 2.md +0 -336
  122. package/src/scripts/nexo-agent-run 2.py +0 -75
  123. package/src/scripts/nexo-auto-update 2.py +0 -6
  124. package/src/scripts/nexo-backup 2.sh +0 -25
  125. package/src/scripts/nexo-brain-activation 2.sh +0 -140
  126. package/src/scripts/nexo-catchup 2.py +0 -300
  127. package/src/scripts/nexo-cognitive-decay 2.py +0 -257
  128. package/src/scripts/nexo-cortex-cycle 2.py +0 -293
  129. package/src/scripts/nexo-cron-wrapper 2.sh +0 -53
  130. package/src/scripts/nexo-daily-self-audit 2.py +0 -2161
  131. package/src/scripts/nexo-dashboard 2.sh +0 -29
  132. package/src/scripts/nexo-deep-sleep 2.sh +0 -86
  133. package/src/scripts/nexo-evolution-run 2.py +0 -1664
  134. package/src/scripts/nexo-followup-hygiene 2.py +0 -139
  135. package/src/scripts/nexo-hook-record 2.py +0 -42
  136. package/src/scripts/nexo-immune 2.py +0 -936
  137. package/src/scripts/nexo-impact-scorer 2.py +0 -117
  138. package/src/scripts/nexo-inbox-hook 2.sh +0 -74
  139. package/src/scripts/nexo-install 2.py +0 -6
  140. package/src/scripts/nexo-learning-housekeep 2.py +0 -401
  141. package/src/scripts/nexo-learning-validator 2.py +0 -266
  142. package/src/scripts/nexo-migrate 2.py +0 -260
  143. package/src/scripts/nexo-outcome-checker 2.py +0 -127
  144. package/src/scripts/nexo-postmortem-consolidator 2.py +0 -456
  145. package/src/scripts/nexo-pre-commit 2.py +0 -120
  146. package/src/scripts/nexo-prevent-sleep 2.sh +0 -35
  147. package/src/scripts/nexo-proactive-dashboard 2.py +0 -354
  148. package/src/scripts/nexo-reflection 2.py +0 -256
  149. package/src/scripts/nexo-runtime-preflight 2.py +0 -274
  150. package/src/scripts/nexo-sleep 2.py +0 -631
  151. package/src/scripts/nexo-snapshot-restore 2.sh +0 -35
  152. package/src/scripts/nexo-sync-clients 2.py +0 -16
  153. package/src/scripts/nexo-synthesis 2.py +0 -475
  154. package/src/scripts/nexo-tcc-approve 2.sh +0 -79
  155. package/src/scripts/nexo-update 2.sh +0 -306
  156. package/src/scripts/nexo-watchdog 2.sh +0 -1207
  157. package/src/scripts/nexo-watchdog-smoke 2.py +0 -119
  158. package/src/scripts/rehydrate_learnings_from_archive 2.py +0 -245
  159. package/src/server 2.py +0 -1296
  160. package/src/skills/run-nexo-audit-phase/guide 2.md +0 -43
  161. package/src/skills/run-nexo-audit-phase/skill 2.json +0 -59
  162. package/src/skills/run-nexo-core-fix-cycle/guide 2.md +0 -17
  163. package/src/skills/run-nexo-core-fix-cycle/script 2.py +0 -276
  164. package/src/skills/run-nexo-core-fix-cycle/skill 2.json +0 -58
  165. package/src/skills/run-release-final-audit/guide 2.md +0 -16
  166. package/src/skills/run-release-final-audit/script 2.py +0 -259
  167. package/src/skills/run-release-final-audit/skill 2.json +0 -77
  168. package/src/skills/run-runtime-doctor/guide 2.md +0 -12
  169. package/src/skills/run-runtime-doctor/script 2.py +0 -21
  170. package/src/skills/run-runtime-doctor/skill 2.json +0 -25
  171. package/src/skills_runtime 2.py +0 -932
  172. package/src/state_watchers_runtime 2.py +0 -475
  173. package/src/storage_router 2.py +0 -32
  174. package/src/system_catalog 2.py +0 -786
  175. package/src/tools_coordination 2.py +0 -103
  176. package/src/tools_credentials 2.py +0 -68
  177. package/src/tools_drive 2.py +0 -487
  178. package/src/tools_hot_context 2.py +0 -163
  179. package/src/tools_learnings 2.py +0 -612
  180. package/src/tools_menu 2.py +0 -229
  181. package/src/tools_reminders 2.py +0 -88
  182. package/src/tools_reminders_crud 2.py +0 -363
  183. package/src/tools_sessions 2.py +0 -1054
  184. package/src/tools_system_catalog 2.py +0 -19
  185. package/src/tools_task_history 2.py +0 -57
  186. package/src/tools_transcripts 2.py +0 -98
  187. package/src/transcript_utils 2.py +0 -412
  188. package/src/user_context 2.py +0 -46
  189. package/src/user_data_portability 2.py +0 -328
  190. package/src/user_state_model 2.py +0 -170
  191. package/templates/CLAUDE.md 2.template +0 -108
  192. package/templates/CODEX.AGENTS.md 2.template +0 -66
  193. package/templates/launchagents/README 2.md +0 -132
  194. package/templates/launchagents/com.nexo.auto-close-sessions 2.plist +0 -39
  195. package/templates/launchagents/com.nexo.catchup 2.plist +0 -39
  196. package/templates/launchagents/com.nexo.cognitive-decay 2.plist +0 -40
  197. package/templates/launchagents/com.nexo.dashboard 2.plist +0 -43
  198. package/templates/launchagents/com.nexo.deep-sleep 2.plist +0 -43
  199. package/templates/launchagents/com.nexo.evolution 2.plist +0 -44
  200. package/templates/launchagents/com.nexo.followup-hygiene 2.plist +0 -45
  201. package/templates/launchagents/com.nexo.immune 2.plist +0 -41
  202. package/templates/launchagents/com.nexo.postmortem 2.plist +0 -45
  203. package/templates/launchagents/com.nexo.self-audit 2.plist +0 -47
  204. package/templates/launchagents/com.nexo.synthesis 2.plist +0 -45
  205. package/templates/launchagents/com.nexo.watchdog 2.plist +0 -37
  206. package/templates/nexo_helper 2.py +0 -301
  207. package/templates/openclaw 2.json +0 -13
  208. package/templates/plugin-template 2.py +0 -40
  209. package/templates/script-template 2.py +0 -59
  210. package/templates/script-template 2.sh +0 -13
  211. package/templates/skill-script-template 2.py +0 -48
  212. package/templates/skill-template 2.md +0 -33
@@ -1,118 +0,0 @@
1
- {% extends "base.html" %}
2
-
3
- {% block title %}Adaptive Personality{% endblock %}
4
- {% block page_title %}Adaptive Personality{% endblock %}
5
-
6
- {% block content %}
7
- <div class="grid grid-cols-2 gap-4 max-w-4xl mb-6">
8
- <!-- Current Mode card -->
9
- <div class="bg-slate-900/50 border border-slate-800/50 rounded-lg p-4">
10
- <div class="text-xs uppercase tracking-wider text-slate-400 font-medium mb-3">Current Mode</div>
11
- <div id="mode" class="mb-2"></div>
12
- <p id="mode-desc" class="text-xs text-slate-400"></p>
13
- </div>
14
- <!-- Weights card -->
15
- <div class="bg-slate-900/50 border border-slate-800/50 rounded-lg p-4">
16
- <div class="text-xs uppercase tracking-wider text-slate-400 font-medium mb-3">Signal Weights</div>
17
- <div id="weights" class="space-y-2"></div>
18
- </div>
19
- </div>
20
- <!-- History table -->
21
- <div class="bg-slate-900/50 border border-slate-800/50 rounded-lg p-4 max-w-4xl">
22
- <div class="text-xs uppercase tracking-wider text-slate-400 font-medium mb-3">Mode History</div>
23
- <div class="overflow-x-auto">
24
- <table class="w-full text-sm">
25
- <thead><tr class="text-left text-slate-400 border-b border-slate-800">
26
- <th class="py-2.5 pr-4 font-medium text-xs uppercase tracking-wide">Time</th>
27
- <th class="py-2.5 pr-4 font-medium text-xs uppercase tracking-wide">Mode</th>
28
- <th class="py-2.5 pr-4 font-medium text-xs uppercase tracking-wide">Score</th>
29
- <th class="py-2.5 font-medium text-xs uppercase tracking-wide">Signals</th>
30
- </tr></thead>
31
- <tbody id="history" class="divide-y divide-slate-800/50"></tbody>
32
- </table>
33
- </div>
34
- </div>
35
- {% endblock %}
36
-
37
- {% block scripts %}
38
- <script>
39
- const MODE_META = {
40
- FLOW: { desc: 'Operating at peak alignment. User is in flow state — proactive suggestions welcome.' },
41
- NORMAL: { desc: 'Standard operating mode. Balanced tone and normal autonomy levels.' },
42
- TENSION: { desc: 'Elevated tension detected. Ultra-concise mode active — no preamble, direct resolution only.' },
43
- };
44
-
45
- function modeBadge(mode) {
46
- if (mode === 'FLOW') return `<span class="px-2 py-1 rounded-md text-xs font-medium bg-emerald-500/10 text-emerald-400">FLOW</span>`;
47
- if (mode === 'TENSION') return `<span class="px-2 py-1 rounded-md text-xs font-medium bg-red-500/10 text-red-400">TENSION</span>`;
48
- return `<span class="px-2 py-1 rounded-md text-xs font-medium bg-blue-500/10 text-blue-400">NORMAL</span>`;
49
- }
50
-
51
- function formatTime(ts) {
52
- if (!ts) return '—';
53
- try {
54
- const d = new Date(ts);
55
- return d.toLocaleString('en-GB', { dateStyle: 'short', timeStyle: 'short' });
56
- } catch { return ts; }
57
- }
58
-
59
- function loadData() {
60
- fetch('/api/adaptive')
61
- .then(r => r.json())
62
- .then(data => {
63
- const mode = data.state?.mode || data.mode || 'NORMAL';
64
-
65
- // Current Mode
66
- document.getElementById('mode').innerHTML = modeBadge(mode);
67
- document.getElementById('mode-desc').textContent =
68
- data.modes?.[mode] || MODE_META[mode]?.desc || '';
69
-
70
- // Signal Weights
71
- const weights = data.weights || {};
72
- const weightEntries = Object.entries(weights).sort((a, b) => b[1] - a[1]);
73
- const weightsEl = document.getElementById('weights');
74
-
75
- if (!weightEntries.length) {
76
- weightsEl.innerHTML = '<p class="text-sm text-slate-500">No signal weights configured.</p>';
77
- } else {
78
- weightsEl.innerHTML = weightEntries.map(([name, value]) => {
79
- const pct = Math.min(Math.max(value * 100, 0), 100);
80
- return `<div class="flex items-center gap-2">
81
- <span class="text-sm text-slate-300 w-24">${name}</span>
82
- <div class="flex-1 h-2 bg-slate-800 rounded-full overflow-hidden">
83
- <div class="h-full bg-violet-500 rounded-full" style="width:${pct.toFixed(0)}%"></div>
84
- </div>
85
- <span class="text-xs font-mono text-slate-400 w-12 text-right">${pct.toFixed(0)}%</span>
86
- </div>`;
87
- }).join('');
88
- }
89
-
90
- // History
91
- const history = (data.history || []).slice(0, 50);
92
- const tbody = document.getElementById('history');
93
-
94
- if (!history.length) {
95
- tbody.innerHTML = '<tr><td colspan="4" class="py-6 text-center text-slate-500">No history recorded yet.</td></tr>';
96
- } else {
97
- tbody.innerHTML = history.map(h => {
98
- const m = h.mode || 'NORMAL';
99
- const signals = (h.signals || '').toString().replace(/</g, '&lt;');
100
- const score = h.score != null ? Number(h.score).toFixed(2) : '—';
101
- return `<tr class="text-slate-300">
102
- <td class="py-2 pr-4 font-mono text-xs">${formatTime(h.timestamp)}</td>
103
- <td class="py-2 pr-4">${modeBadge(m)}</td>
104
- <td class="py-2 pr-4 font-mono text-sm">${score}</td>
105
- <td class="py-2 text-slate-400 text-sm">${signals || '—'}</td>
106
- </tr>`;
107
- }).join('');
108
- }
109
- })
110
- .catch(err => {
111
- document.getElementById('history').innerHTML =
112
- `<tr><td colspan="4" class="py-4 text-center text-red-400 text-xs">Failed to load: ${err.message}</td></tr>`;
113
- });
114
- }
115
-
116
- loadData();
117
- </script>
118
- {% endblock %}
@@ -1,133 +0,0 @@
1
- {% extends "base.html" %}
2
-
3
- {% block title %}Artifact Registry{% endblock %}
4
- {% block page_title %}Artifact Registry{% endblock %}
5
-
6
- {% block content %}
7
- <div class="space-y-5">
8
- <!-- Filter bar -->
9
- <div class="flex items-center gap-2 flex-wrap">
10
- <span class="text-xs text-slate-500">Kind:</span>
11
- <button onclick="filterKind('all')" class="kind-btn active px-2.5 py-1 rounded-md text-xs bg-slate-800 text-slate-300 hover:bg-slate-700 transition-colors" data-kind="all">All</button>
12
- <div id="kind-filters" class="flex items-center gap-2 flex-wrap"></div>
13
- <div class="flex-1"></div>
14
- <input type="text" id="artifact-search" placeholder="Search artifacts..." class="px-3 py-1.5 rounded-lg bg-slate-800/50 border border-slate-700/50 text-xs text-slate-200 placeholder-slate-600 focus:outline-none focus:ring-1 focus:ring-violet-500 w-48" oninput="searchArtifacts(this.value)">
15
- <span class="text-xs font-mono text-slate-500" id="artifact-count">--</span>
16
- </div>
17
-
18
- <!-- Artifact grid -->
19
- <div class="grid grid-cols-3 gap-4" id="artifacts-grid">
20
- <div class="text-xs text-slate-600 py-8 text-center col-span-3">loading...</div>
21
- </div>
22
- </div>
23
- {% endblock %}
24
-
25
- {% block scripts %}
26
- <script>
27
- let allArtifacts = [];
28
- let currentKind = 'all';
29
-
30
- const KIND_ICONS = {
31
- script: '<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4"/></svg>',
32
- service: '<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2"/></svg>',
33
- app: '<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"/></svg>',
34
- database: '<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4"/></svg>',
35
- config: '<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"/><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/></svg>',
36
- };
37
- const KIND_COLORS = {
38
- script: 'text-violet-400', service: 'text-emerald-400', app: 'text-blue-400',
39
- database: 'text-pink-400', config: 'text-amber-400',
40
- };
41
- const STATE_STYLES = {
42
- running: 'bg-emerald-500/10 text-emerald-400', active: 'bg-emerald-500/10 text-emerald-400',
43
- stopped: 'bg-red-500/10 text-red-400', draft: 'bg-slate-500/10 text-slate-400',
44
- deployed: 'bg-blue-500/10 text-blue-400', archived: 'bg-slate-500/10 text-slate-500',
45
- };
46
-
47
- function filterKind(kind) {
48
- currentKind = kind;
49
- document.querySelectorAll('.kind-btn').forEach(b => {
50
- b.classList.toggle('active', b.dataset.kind === kind);
51
- b.classList.toggle('bg-slate-800', b.dataset.kind === kind);
52
- b.classList.toggle('text-slate-300', b.dataset.kind === kind);
53
- b.classList.toggle('bg-slate-800/50', b.dataset.kind !== kind);
54
- b.classList.toggle('text-slate-400', b.dataset.kind !== kind);
55
- });
56
- renderGrid();
57
- }
58
-
59
- function searchArtifacts(query) {
60
- const q = query.toLowerCase();
61
- document.querySelectorAll('#artifacts-grid .artifact-card').forEach(el => {
62
- el.style.display = el.textContent.toLowerCase().includes(q) ? '' : 'none';
63
- });
64
- }
65
-
66
- function renderGrid() {
67
- const container = document.getElementById('artifacts-grid');
68
- const artifacts = currentKind === 'all' ? allArtifacts : allArtifacts.filter(a => a.kind === currentKind);
69
- document.getElementById('artifact-count').textContent = artifacts.length + ' artifacts';
70
-
71
- if (!artifacts.length) {
72
- container.innerHTML = '<div class="col-span-3 text-xs text-slate-600 py-8 text-center">No artifacts found</div>';
73
- return;
74
- }
75
-
76
- container.innerHTML = artifacts.map(a => {
77
- const kind = a.kind || 'script';
78
- const icon = KIND_ICONS[kind] || KIND_ICONS.script;
79
- const kindColor = KIND_COLORS[kind] || 'text-slate-400';
80
- const state = a.state || 'draft';
81
- const stateStyle = STATE_STYLES[state] || STATE_STYLES.draft;
82
- const expanded = a._expanded;
83
-
84
- return `<div class="artifact-card bg-slate-900/50 border border-slate-800/50 rounded-xl p-5 card">
85
- <div class="flex items-start gap-3 mb-3">
86
- <div class="${kindColor} mt-0.5">${icon}</div>
87
- <div class="flex-1 min-w-0">
88
- <div class="text-sm font-display font-medium text-slate-200 truncate">${escapeHtml(a.canonical_name || '--')}</div>
89
- <div class="flex items-center gap-2 mt-1">
90
- <span class="text-[10px] px-1.5 py-0.5 rounded ${stateStyle}">${escapeHtml(state)}</span>
91
- <span class="text-[10px] text-slate-500">${escapeHtml(kind)}</span>
92
- </div>
93
- </div>
94
- </div>
95
- ${a.description ? `<p class="text-xs text-slate-400 leading-relaxed mb-3">${escapeHtml(a.description)}</p>` : ''}
96
- ${a.uri ? `<a href="${escapeHtml(a.uri)}" target="_blank" class="text-xs text-violet-400 hover:text-violet-300 truncate block mb-2">${escapeHtml(a.uri)}</a>` : ''}
97
- <button onclick="toggleDetail(this)" class="text-[10px] text-slate-500 hover:text-slate-300 transition-colors">Details +</button>
98
- <div class="detail-panel hidden mt-3 pt-3 border-t border-slate-800/50 space-y-1.5">
99
- ${a.ports ? `<div class="text-[10px]"><span class="text-slate-500">Ports:</span> <span class="text-slate-300 font-mono">${escapeHtml(String(a.ports))}</span></div>` : ''}
100
- ${a.paths ? `<div class="text-[10px]"><span class="text-slate-500">Paths:</span> <span class="text-slate-300 font-mono">${escapeHtml(String(a.paths))}</span></div>` : ''}
101
- ${a.run_cmd ? `<div class="text-[10px]"><span class="text-slate-500">Run:</span> <code class="text-slate-300 font-mono bg-slate-800/50 px-1.5 py-0.5 rounded">${escapeHtml(a.run_cmd)}</code></div>` : ''}
102
- </div>
103
- </div>`;
104
- }).join('');
105
- }
106
-
107
- function toggleDetail(btn) {
108
- const panel = btn.nextElementSibling;
109
- panel.classList.toggle('hidden');
110
- btn.textContent = panel.classList.contains('hidden') ? 'Details +' : 'Details -';
111
- }
112
-
113
- async function loadArtifacts() {
114
- const data = await fetchJSON('/api/artifacts');
115
- if (!data) return;
116
-
117
- allArtifacts = data.artifacts || [];
118
- const kinds = data.kinds || [...new Set(allArtifacts.map(a => a.kind).filter(Boolean))];
119
-
120
- // Render kind filters
121
- const kindContainer = document.getElementById('kind-filters');
122
- kindContainer.innerHTML = kinds.map(k => {
123
- const color = KIND_COLORS[k] || 'text-slate-400';
124
- return `<button onclick="filterKind('${escapeHtml(k)}')" class="kind-btn px-2.5 py-1 rounded-md text-xs bg-slate-800/50 text-slate-400 hover:bg-slate-700 transition-colors" data-kind="${escapeHtml(k)}">${escapeHtml(k)}</button>`;
125
- }).join('');
126
-
127
- renderGrid();
128
- }
129
-
130
- loadArtifacts();
131
- setInterval(loadArtifacts, 60000);
132
- </script>
133
- {% endblock %}
@@ -1,136 +0,0 @@
1
- {% extends "base.html" %}
2
-
3
- {% block title %}Backup Monitor{% endblock %}
4
- {% block page_title %}Backup Monitor{% endblock %}
5
-
6
- {% block content %}
7
- <div class="space-y-5">
8
- <!-- DB size cards -->
9
- <div class="grid grid-cols-4 gap-4" id="db-cards">
10
- <div class="text-xs text-slate-600 py-4 text-center col-span-4">loading...</div>
11
- </div>
12
-
13
- <!-- Backup list -->
14
- <div class="bg-slate-900/50 border border-slate-800/50 rounded-xl p-5 card">
15
- <div class="flex items-center justify-between mb-4">
16
- <div class="text-xs uppercase tracking-wider text-slate-400 font-medium">Backup Files</div>
17
- <div class="flex items-center gap-3 text-[10px] text-slate-500">
18
- <span class="flex items-center gap-1"><span class="w-2 h-2 rounded-full bg-emerald-500"></span>&lt;24h</span>
19
- <span class="flex items-center gap-1"><span class="w-2 h-2 rounded-full bg-amber-500"></span>&lt;72h</span>
20
- <span class="flex items-center gap-1"><span class="w-2 h-2 rounded-full bg-red-500"></span>&gt;72h</span>
21
- </div>
22
- </div>
23
- <div class="overflow-x-auto">
24
- <table class="w-full text-left">
25
- <thead>
26
- <tr class="border-b border-slate-800/50">
27
- <th class="text-[10px] uppercase tracking-wider text-slate-500 font-medium pb-2 pr-4">Freshness</th>
28
- <th class="text-[10px] uppercase tracking-wider text-slate-500 font-medium pb-2 pr-4">Name</th>
29
- <th class="text-[10px] uppercase tracking-wider text-slate-500 font-medium pb-2 pr-4">Size</th>
30
- <th class="text-[10px] uppercase tracking-wider text-slate-500 font-medium pb-2 pr-4">Type</th>
31
- <th class="text-[10px] uppercase tracking-wider text-slate-500 font-medium pb-2 text-right">Modified</th>
32
- </tr>
33
- </thead>
34
- <tbody id="backup-table" class="divide-y divide-slate-800/30">
35
- <tr><td colspan="5" class="text-xs text-slate-600 py-8 text-center">loading...</td></tr>
36
- </tbody>
37
- </table>
38
- </div>
39
- </div>
40
- </div>
41
- {% endblock %}
42
-
43
- {% block scripts %}
44
- <script>
45
- function getFreshness(modified) {
46
- if (!modified) return { color: 'bg-slate-600', label: 'unknown', class: '' };
47
- const now = Date.now();
48
- const mod = new Date(modified).getTime();
49
- const hoursAgo = (now - mod) / (1000 * 60 * 60);
50
-
51
- if (hoursAgo < 24) return { color: 'bg-emerald-500', label: 'fresh', class: 'text-emerald-400' };
52
- if (hoursAgo < 72) return { color: 'bg-amber-500', label: 'aging', class: 'text-amber-400' };
53
- return { color: 'bg-red-500', label: 'stale', class: 'text-red-400' };
54
- }
55
-
56
- function formatSize(mb) {
57
- if (mb == null) return '--';
58
- if (mb < 1) return (mb * 1024).toFixed(0) + ' KB';
59
- if (mb >= 1024) return (mb / 1024).toFixed(1) + ' GB';
60
- return mb.toFixed(1) + ' MB';
61
- }
62
-
63
- function renderDBCards(dbSizes) {
64
- const container = document.getElementById('db-cards');
65
- const entries = Object.entries(dbSizes || {});
66
-
67
- if (!entries.length) {
68
- container.innerHTML = '<div class="col-span-4 text-xs text-slate-600 py-4 text-center">No database size info</div>';
69
- return;
70
- }
71
-
72
- container.innerHTML = entries.map(([name, mb]) => {
73
- const size = typeof mb === 'number' ? mb : parseFloat(mb) || 0;
74
- return `<div class="bg-slate-900/50 border border-slate-800/50 rounded-xl p-4 card">
75
- <div class="flex items-center gap-2 mb-2">
76
- <svg class="w-4 h-4 text-violet-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4"/></svg>
77
- <span class="text-xs uppercase tracking-wider text-slate-400 font-medium truncate">${escapeHtml(name)}</span>
78
- </div>
79
- <div class="text-xl font-mono font-semibold text-slate-200">${formatSize(size)}</div>
80
- </div>`;
81
- }).join('');
82
- }
83
-
84
- function renderBackups(backups) {
85
- const tbody = document.getElementById('backup-table');
86
- if (!backups || !backups.length) {
87
- tbody.innerHTML = '<tr><td colspan="5" class="text-xs text-slate-600 py-8 text-center">No backups found</td></tr>';
88
- return;
89
- }
90
-
91
- // Sort by modified descending
92
- const sorted = [...backups].sort((a, b) => {
93
- const ta = new Date(a.modified || 0).getTime();
94
- const tb = new Date(b.modified || 0).getTime();
95
- return tb - ta;
96
- });
97
-
98
- tbody.innerHTML = sorted.map(b => {
99
- const freshness = getFreshness(b.modified);
100
- const isDir = b.is_dir;
101
- const icon = isDir
102
- ? '<svg class="w-3.5 h-3.5 text-slate-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"/></svg>'
103
- : '<svg class="w-3.5 h-3.5 text-slate-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/></svg>';
104
-
105
- return `<tr class="hover:bg-slate-800/20 transition-colors">
106
- <td class="py-2.5 pr-4">
107
- <div class="flex items-center gap-1.5">
108
- <span class="w-2 h-2 rounded-full ${freshness.color} flex-shrink-0"></span>
109
- <span class="text-[10px] ${freshness.class}">${freshness.label}</span>
110
- </div>
111
- </td>
112
- <td class="py-2.5 pr-4">
113
- <div class="flex items-center gap-2">
114
- ${icon}
115
- <span class="text-xs text-slate-300 font-mono truncate">${escapeHtml(b.name || '--')}</span>
116
- </div>
117
- </td>
118
- <td class="py-2.5 pr-4 text-xs text-slate-400 font-mono">${b.size_mb != null ? formatSize(b.size_mb) : '--'}</td>
119
- <td class="py-2.5 pr-4 text-xs text-slate-500">${isDir ? 'directory' : 'file'}</td>
120
- <td class="py-2.5 text-xs text-slate-500 text-right whitespace-nowrap">${b.modified ? relativeTime(b.modified) : '--'}</td>
121
- </tr>`;
122
- }).join('');
123
- }
124
-
125
- async function loadBackups() {
126
- const data = await fetchJSON('/api/backups');
127
- if (!data) return;
128
-
129
- renderDBCards(data.db_sizes || {});
130
- renderBackups(data.backups || []);
131
- }
132
-
133
- loadBackups();
134
- setInterval(loadBackups, 60000);
135
- </script>
136
- {% endblock %}