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.
- package/.claude-plugin/plugin.json +1 -1
- package/package.json +1 -1
- package/src/hook_guardrails.py +44 -0
- package/src/server.py +3 -0
- package/src/tools_sessions.py +6 -1
- package/src/dashboard/static/favicon 2.svg +0 -32
- package/src/dashboard/static/nexo-logo 2.png +0 -0
- package/src/dashboard/static/nexo-logo 2.svg +0 -40
- package/src/dashboard/static/style 2.css +0 -2458
- package/src/dashboard/templates/adaptive 2.html +0 -118
- package/src/dashboard/templates/artifacts 2.html +0 -133
- package/src/dashboard/templates/backups 2.html +0 -136
- package/src/dashboard/templates/base 2.html +0 -417
- package/src/dashboard/templates/calendar 2.html +0 -591
- package/src/dashboard/templates/chat 2.html +0 -356
- package/src/dashboard/templates/claims 2.html +0 -259
- package/src/dashboard/templates/cortex 2.html +0 -321
- package/src/dashboard/templates/credentials 2.html +0 -128
- package/src/dashboard/templates/crons 2.html +0 -370
- package/src/dashboard/templates/dashboard 2.html +0 -494
- package/src/dashboard/templates/dreams 2.html +0 -252
- package/src/dashboard/templates/email 2.html +0 -160
- package/src/dashboard/templates/evolution 2.html +0 -189
- package/src/dashboard/templates/feed 2.html +0 -249
- package/src/dashboard/templates/followup_health 2.html +0 -170
- package/src/dashboard/templates/graph 2.html +0 -201
- package/src/dashboard/templates/guard 2.html +0 -259
- package/src/dashboard/templates/inbox 2.html +0 -251
- package/src/dashboard/templates/memory 2.html +0 -420
- package/src/dashboard/templates/operations 2.html +0 -608
- package/src/dashboard/templates/plugins 2.html +0 -185
- package/src/dashboard/templates/protocol 2.html +0 -199
- package/src/dashboard/templates/rules 2.html +0 -246
- package/src/dashboard/templates/sentiment 2.html +0 -247
- package/src/dashboard/templates/sessions 2.html +0 -218
- package/src/dashboard/templates/skills 2.html +0 -329
- package/src/dashboard/templates/somatic 2.html +0 -73
- package/src/dashboard/templates/triggers 2.html +0 -133
- package/src/dashboard/templates/trust 2.html +0 -360
- package/src/db/__init__ 2.py +0 -259
- package/src/db/_core 2.py +0 -437
- package/src/db/_credentials 2.py +0 -124
- package/src/db/_episodic 2.py +0 -762
- package/src/db/_evolution 2.py +0 -54
- package/src/db/_fts 2.py +0 -406
- package/src/db/_goal_profiles 2.py +0 -376
- package/src/db/_hot_context 2.py +0 -660
- package/src/db/_outcomes 2.py +0 -800
- package/src/db/_personal_scripts 2.py +0 -582
- package/src/db/_sessions 2.py +0 -330
- package/src/db/_tasks 2.py +0 -91
- package/src/db/_watchers 2.py +0 -173
- package/src/doctor/formatters 2.py +0 -52
- package/src/doctor/models 2.py +0 -69
- package/src/doctor/planes 2.py +0 -87
- package/src/doctor/providers/__init__ 2.py +0 -1
- package/src/doctor/providers/deep 2.py +0 -367
- package/src/evolution_cycle 2.py +0 -519
- package/src/hooks/auto_capture 2.py +0 -208
- package/src/hooks/caffeinate-guard 2.sh +0 -8
- package/src/hooks/capture-session 2.sh +0 -21
- package/src/hooks/capture-tool-logs 2.sh +0 -158
- package/src/hooks/daily-briefing-check 2.sh +0 -33
- package/src/hooks/heartbeat-enforcement 2.py +0 -90
- package/src/hooks/heartbeat-posttool 2.sh +0 -18
- package/src/hooks/inbox-hook 2.sh +0 -76
- package/src/hooks/post-compact 2.sh +0 -152
- package/src/hooks/pre-compact 2.sh +0 -169
- package/src/hooks/protocol-guardrail 2.sh +0 -10
- package/src/hooks/protocol-pretool-guardrail 2.sh +0 -9
- package/src/hooks/session-stop 2.sh +0 -52
- package/src/kg_populate 2.py +0 -292
- package/src/maintenance 2.py +0 -53
- package/src/memory_backends 2.py +0 -71
- package/src/migrate_embeddings 2.py +0 -124
- package/src/nexo_sdk 2.py +0 -103
- package/src/observability 2.py +0 -199
- package/src/plugin_loader 2.py +0 -217
- package/src/plugins/__init__ 2.py +0 -0
- package/src/plugins/artifact_registry 2.py +0 -450
- package/src/plugins/backup 2.py +0 -127
- package/src/plugins/claims_tools 2.py +0 -119
- package/src/plugins/cognitive_memory 2.py +0 -609
- package/src/plugins/core_rules 2.py +0 -252
- package/src/plugins/cortex 2.py +0 -1155
- package/src/plugins/entities 2.py +0 -67
- package/src/plugins/episodic_memory 2.py +0 -560
- package/src/plugins/evolution 2.py +0 -167
- package/src/plugins/goal_engine 2.py +0 -142
- package/src/plugins/guard 2.py +0 -862
- package/src/plugins/impact 2.py +0 -29
- package/src/plugins/knowledge_graph_tools 2.py +0 -137
- package/src/plugins/media_memory_tools 2.py +0 -98
- package/src/plugins/memory_export 2.py +0 -196
- package/src/plugins/outcomes 2.py +0 -130
- package/src/plugins/personal_scripts 2.py +0 -117
- package/src/plugins/preferences 2.py +0 -47
- package/src/plugins/protocol 2.py +0 -1449
- package/src/plugins/simple_api 2.py +0 -106
- package/src/plugins/skills 2.py +0 -341
- package/src/plugins/state_watchers 2.py +0 -79
- package/src/plugins/update 2.py +0 -986
- package/src/plugins/user_state_tools 2.py +0 -43
- package/src/plugins/workflow 2.py +0 -588
- package/src/protocol_settings 2.py +0 -59
- package/src/public_contribution 2.py +0 -466
- package/src/public_evolution_queue 2.py +0 -241
- package/src/requirements 2.txt +0 -14
- package/src/retroactive_learnings 2.py +0 -373
- package/src/rules/__init__ 2.py +0 -0
- package/src/rules/core-rules 2.json +0 -331
- package/src/rules/migrate 2.py +0 -207
- package/src/runtime_power 2.py +0 -874
- package/src/script_registry 2.py +0 -1559
- package/src/scripts/check-context 2.py +0 -272
- package/src/scripts/deep-sleep/apply_findings 2.py +0 -2327
- package/src/scripts/deep-sleep/collect 2.py +0 -928
- package/src/scripts/deep-sleep/extract 2.py +0 -330
- package/src/scripts/deep-sleep/extract-prompt 2.md +0 -285
- package/src/scripts/deep-sleep/synthesize 2.py +0 -312
- package/src/scripts/deep-sleep/synthesize-prompt 2.md +0 -336
- package/src/scripts/nexo-agent-run 2.py +0 -75
- package/src/scripts/nexo-auto-update 2.py +0 -6
- package/src/scripts/nexo-backup 2.sh +0 -25
- package/src/scripts/nexo-brain-activation 2.sh +0 -140
- package/src/scripts/nexo-catchup 2.py +0 -300
- package/src/scripts/nexo-cognitive-decay 2.py +0 -257
- package/src/scripts/nexo-cortex-cycle 2.py +0 -293
- package/src/scripts/nexo-cron-wrapper 2.sh +0 -53
- package/src/scripts/nexo-daily-self-audit 2.py +0 -2161
- package/src/scripts/nexo-dashboard 2.sh +0 -29
- package/src/scripts/nexo-deep-sleep 2.sh +0 -86
- package/src/scripts/nexo-evolution-run 2.py +0 -1664
- package/src/scripts/nexo-followup-hygiene 2.py +0 -139
- package/src/scripts/nexo-hook-record 2.py +0 -42
- package/src/scripts/nexo-immune 2.py +0 -936
- package/src/scripts/nexo-impact-scorer 2.py +0 -117
- package/src/scripts/nexo-inbox-hook 2.sh +0 -74
- package/src/scripts/nexo-install 2.py +0 -6
- package/src/scripts/nexo-learning-housekeep 2.py +0 -401
- package/src/scripts/nexo-learning-validator 2.py +0 -266
- package/src/scripts/nexo-migrate 2.py +0 -260
- package/src/scripts/nexo-outcome-checker 2.py +0 -127
- package/src/scripts/nexo-postmortem-consolidator 2.py +0 -456
- package/src/scripts/nexo-pre-commit 2.py +0 -120
- package/src/scripts/nexo-prevent-sleep 2.sh +0 -35
- package/src/scripts/nexo-proactive-dashboard 2.py +0 -354
- package/src/scripts/nexo-reflection 2.py +0 -256
- package/src/scripts/nexo-runtime-preflight 2.py +0 -274
- package/src/scripts/nexo-sleep 2.py +0 -631
- package/src/scripts/nexo-snapshot-restore 2.sh +0 -35
- package/src/scripts/nexo-sync-clients 2.py +0 -16
- package/src/scripts/nexo-synthesis 2.py +0 -475
- package/src/scripts/nexo-tcc-approve 2.sh +0 -79
- package/src/scripts/nexo-update 2.sh +0 -306
- package/src/scripts/nexo-watchdog 2.sh +0 -1207
- package/src/scripts/nexo-watchdog-smoke 2.py +0 -119
- package/src/scripts/rehydrate_learnings_from_archive 2.py +0 -245
- package/src/server 2.py +0 -1296
- package/src/skills/run-nexo-audit-phase/guide 2.md +0 -43
- package/src/skills/run-nexo-audit-phase/skill 2.json +0 -59
- package/src/skills/run-nexo-core-fix-cycle/guide 2.md +0 -17
- package/src/skills/run-nexo-core-fix-cycle/script 2.py +0 -276
- package/src/skills/run-nexo-core-fix-cycle/skill 2.json +0 -58
- package/src/skills/run-release-final-audit/guide 2.md +0 -16
- package/src/skills/run-release-final-audit/script 2.py +0 -259
- package/src/skills/run-release-final-audit/skill 2.json +0 -77
- package/src/skills/run-runtime-doctor/guide 2.md +0 -12
- package/src/skills/run-runtime-doctor/script 2.py +0 -21
- package/src/skills/run-runtime-doctor/skill 2.json +0 -25
- package/src/skills_runtime 2.py +0 -932
- package/src/state_watchers_runtime 2.py +0 -475
- package/src/storage_router 2.py +0 -32
- package/src/system_catalog 2.py +0 -786
- package/src/tools_coordination 2.py +0 -103
- package/src/tools_credentials 2.py +0 -68
- package/src/tools_drive 2.py +0 -487
- package/src/tools_hot_context 2.py +0 -163
- package/src/tools_learnings 2.py +0 -612
- package/src/tools_menu 2.py +0 -229
- package/src/tools_reminders 2.py +0 -88
- package/src/tools_reminders_crud 2.py +0 -363
- package/src/tools_sessions 2.py +0 -1054
- package/src/tools_system_catalog 2.py +0 -19
- package/src/tools_task_history 2.py +0 -57
- package/src/tools_transcripts 2.py +0 -98
- package/src/transcript_utils 2.py +0 -412
- package/src/user_context 2.py +0 -46
- package/src/user_data_portability 2.py +0 -328
- package/src/user_state_model 2.py +0 -170
- package/templates/CLAUDE.md 2.template +0 -108
- package/templates/CODEX.AGENTS.md 2.template +0 -66
- package/templates/launchagents/README 2.md +0 -132
- package/templates/launchagents/com.nexo.auto-close-sessions 2.plist +0 -39
- package/templates/launchagents/com.nexo.catchup 2.plist +0 -39
- package/templates/launchagents/com.nexo.cognitive-decay 2.plist +0 -40
- package/templates/launchagents/com.nexo.dashboard 2.plist +0 -43
- package/templates/launchagents/com.nexo.deep-sleep 2.plist +0 -43
- package/templates/launchagents/com.nexo.evolution 2.plist +0 -44
- package/templates/launchagents/com.nexo.followup-hygiene 2.plist +0 -45
- package/templates/launchagents/com.nexo.immune 2.plist +0 -41
- package/templates/launchagents/com.nexo.postmortem 2.plist +0 -45
- package/templates/launchagents/com.nexo.self-audit 2.plist +0 -47
- package/templates/launchagents/com.nexo.synthesis 2.plist +0 -45
- package/templates/launchagents/com.nexo.watchdog 2.plist +0 -37
- package/templates/nexo_helper 2.py +0 -301
- package/templates/openclaw 2.json +0 -13
- package/templates/plugin-template 2.py +0 -40
- package/templates/script-template 2.py +0 -59
- package/templates/script-template 2.sh +0 -13
- package/templates/skill-script-template 2.py +0 -48
- package/templates/skill-template 2.md +0 -33
|
@@ -1,370 +0,0 @@
|
|
|
1
|
-
{% extends "base.html" %}
|
|
2
|
-
|
|
3
|
-
{% block title %}Crons Control{% endblock %}
|
|
4
|
-
{% block page_title %}Crons Control Center{% endblock %}
|
|
5
|
-
{% block page_subtitle %}
|
|
6
|
-
<span class="text-xs text-slate-500 font-mono ml-2" id="crons-updated">--</span>
|
|
7
|
-
{% endblock %}
|
|
8
|
-
|
|
9
|
-
{% block header_actions %}
|
|
10
|
-
<div class="flex items-center gap-1.5">
|
|
11
|
-
<button onclick="setTimeRange('24h')" data-range="24h" class="range-btn active text-[10px] px-2.5 py-1 rounded-md transition-all">24h</button>
|
|
12
|
-
<button onclick="setTimeRange('48h')" data-range="48h" class="range-btn text-[10px] px-2.5 py-1 rounded-md transition-all">48h</button>
|
|
13
|
-
<button onclick="setTimeRange('7d')" data-range="7d" class="range-btn text-[10px] px-2.5 py-1 rounded-md transition-all">7d</button>
|
|
14
|
-
</div>
|
|
15
|
-
<button onclick="loadAll()" class="text-xs text-slate-400 hover:text-slate-200 bg-slate-800/50 border border-slate-700/50 rounded-lg px-3 py-1.5 transition-colors flex items-center gap-1.5 ml-2">
|
|
16
|
-
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/></svg>
|
|
17
|
-
Refresh
|
|
18
|
-
</button>
|
|
19
|
-
{% endblock %}
|
|
20
|
-
|
|
21
|
-
{% block content %}
|
|
22
|
-
<!-- Summary cards -->
|
|
23
|
-
<div class="grid grid-cols-4 gap-4 mb-6">
|
|
24
|
-
<div class="card bg-slate-900/50 border border-slate-800/50 rounded-xl p-5">
|
|
25
|
-
<div class="text-xs uppercase tracking-wider text-slate-500 font-semibold mb-2">Total Runs</div>
|
|
26
|
-
<div class="text-2xl font-mono font-bold text-slate-200" id="stat-total">--</div>
|
|
27
|
-
<div class="text-xs text-slate-500 mt-1" id="stat-total-label">last 24h</div>
|
|
28
|
-
</div>
|
|
29
|
-
<div class="card bg-slate-900/50 border border-slate-800/50 rounded-xl p-5">
|
|
30
|
-
<div class="text-xs uppercase tracking-wider text-slate-500 font-semibold mb-2">Success Rate</div>
|
|
31
|
-
<div class="text-2xl font-mono font-bold" id="stat-success">--</div>
|
|
32
|
-
<div class="flex items-center gap-1.5 mt-2">
|
|
33
|
-
<div class="flex-1 h-1.5 bg-slate-800 rounded-full overflow-hidden">
|
|
34
|
-
<div class="h-full bg-emerald-500 rounded-full transition-all duration-700" id="stat-success-bar" style="width: 0%"></div>
|
|
35
|
-
</div>
|
|
36
|
-
</div>
|
|
37
|
-
</div>
|
|
38
|
-
<div class="card bg-slate-900/50 border border-slate-800/50 rounded-xl p-5">
|
|
39
|
-
<div class="text-xs uppercase tracking-wider text-slate-500 font-semibold mb-2">Avg Duration</div>
|
|
40
|
-
<div class="text-2xl font-mono font-bold text-slate-200" id="stat-duration">--</div>
|
|
41
|
-
<div class="text-xs text-slate-500 mt-1">seconds per run</div>
|
|
42
|
-
</div>
|
|
43
|
-
<div class="card bg-slate-900/50 border border-slate-800/50 rounded-xl p-5">
|
|
44
|
-
<div class="text-xs uppercase tracking-wider text-slate-500 font-semibold mb-2">Active Crons</div>
|
|
45
|
-
<div class="text-2xl font-mono font-bold text-nexo-400" id="stat-active">--</div>
|
|
46
|
-
<div class="flex items-center gap-1.5 mt-2">
|
|
47
|
-
<div class="w-1.5 h-1.5 rounded-full bg-emerald-400 glow-dot" style="color: #34d399;"></div>
|
|
48
|
-
<span class="text-[10px] text-slate-500">scheduling active</span>
|
|
49
|
-
</div>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
|
|
53
|
-
<!-- Timeline visualization -->
|
|
54
|
-
<div class="card bg-slate-900/50 border border-slate-800/50 rounded-xl p-5 mb-6">
|
|
55
|
-
<div class="flex items-center justify-between mb-4">
|
|
56
|
-
<h2 class="text-xs uppercase tracking-wider text-slate-500 font-semibold">Timeline</h2>
|
|
57
|
-
<div class="flex items-center gap-3 text-[10px] text-slate-500">
|
|
58
|
-
<span class="flex items-center gap-1"><span class="w-2 h-2 rounded-full bg-emerald-400 inline-block"></span> success</span>
|
|
59
|
-
<span class="flex items-center gap-1"><span class="w-2 h-2 rounded-full bg-red-400 inline-block"></span> failure</span>
|
|
60
|
-
</div>
|
|
61
|
-
</div>
|
|
62
|
-
<div id="timeline-container" class="space-y-2 min-h-[60px]">
|
|
63
|
-
<div class="text-xs text-slate-600 text-center py-6">Loading timeline...</div>
|
|
64
|
-
</div>
|
|
65
|
-
<!-- Time axis -->
|
|
66
|
-
<div class="flex justify-between mt-3 text-[9px] text-slate-600 font-mono" id="time-axis">
|
|
67
|
-
<span>-24h</span><span>-18h</span><span>-12h</span><span>-6h</span><span>now</span>
|
|
68
|
-
</div>
|
|
69
|
-
</div>
|
|
70
|
-
|
|
71
|
-
<!-- Cron summary table -->
|
|
72
|
-
<div class="card bg-slate-900/50 border border-slate-800/50 rounded-xl overflow-hidden">
|
|
73
|
-
<div class="px-5 py-4 border-b border-slate-800/50">
|
|
74
|
-
<h2 class="text-xs uppercase tracking-wider text-slate-500 font-semibold">Cron Jobs</h2>
|
|
75
|
-
</div>
|
|
76
|
-
<div id="cron-table" class="divide-y divide-slate-800/30">
|
|
77
|
-
<!-- Loading skeleton -->
|
|
78
|
-
<div id="table-skeleton" class="p-5 space-y-3">
|
|
79
|
-
<div class="h-8 bg-slate-800/30 rounded animate-pulse"></div>
|
|
80
|
-
<div class="h-8 bg-slate-800/30 rounded animate-pulse"></div>
|
|
81
|
-
<div class="h-8 bg-slate-800/30 rounded animate-pulse"></div>
|
|
82
|
-
</div>
|
|
83
|
-
</div>
|
|
84
|
-
</div>
|
|
85
|
-
|
|
86
|
-
<style>
|
|
87
|
-
.range-btn {
|
|
88
|
-
background: rgba(30, 41, 59, 0.5);
|
|
89
|
-
border: 1px solid rgba(51, 65, 85, 0.3);
|
|
90
|
-
color: #64748b;
|
|
91
|
-
}
|
|
92
|
-
.range-btn:hover { color: #e2e8f0; background: rgba(51, 65, 85, 0.5); }
|
|
93
|
-
.range-btn.active {
|
|
94
|
-
background: rgba(124, 58, 237, 0.15);
|
|
95
|
-
border-color: rgba(124, 58, 237, 0.4);
|
|
96
|
-
color: #a78bfa;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.timeline-row {
|
|
100
|
-
display: flex;
|
|
101
|
-
align-items: center;
|
|
102
|
-
gap: 8px;
|
|
103
|
-
}
|
|
104
|
-
.timeline-label {
|
|
105
|
-
width: 120px;
|
|
106
|
-
flex-shrink: 0;
|
|
107
|
-
font-size: 11px;
|
|
108
|
-
font-family: 'JetBrains Mono', monospace;
|
|
109
|
-
color: #94a3b8;
|
|
110
|
-
text-align: right;
|
|
111
|
-
overflow: hidden;
|
|
112
|
-
text-overflow: ellipsis;
|
|
113
|
-
white-space: nowrap;
|
|
114
|
-
}
|
|
115
|
-
.timeline-track {
|
|
116
|
-
flex: 1;
|
|
117
|
-
height: 20px;
|
|
118
|
-
background: rgba(15, 23, 42, 0.5);
|
|
119
|
-
border-radius: 4px;
|
|
120
|
-
position: relative;
|
|
121
|
-
overflow: hidden;
|
|
122
|
-
}
|
|
123
|
-
.timeline-dot {
|
|
124
|
-
position: absolute;
|
|
125
|
-
width: 8px;
|
|
126
|
-
height: 8px;
|
|
127
|
-
border-radius: 50%;
|
|
128
|
-
top: 50%;
|
|
129
|
-
transform: translate(-50%, -50%);
|
|
130
|
-
transition: transform 0.15s, box-shadow 0.15s;
|
|
131
|
-
cursor: pointer;
|
|
132
|
-
}
|
|
133
|
-
.timeline-dot:hover {
|
|
134
|
-
transform: translate(-50%, -50%) scale(1.6);
|
|
135
|
-
box-shadow: 0 0 8px currentColor;
|
|
136
|
-
z-index: 10;
|
|
137
|
-
}
|
|
138
|
-
.timeline-dot.success { background: #34d399; color: #34d399; }
|
|
139
|
-
.timeline-dot.failure { background: #f87171; color: #f87171; }
|
|
140
|
-
|
|
141
|
-
.cron-row {
|
|
142
|
-
transition: background-color 0.15s;
|
|
143
|
-
}
|
|
144
|
-
.cron-row:hover { background: rgba(51, 65, 85, 0.15); }
|
|
145
|
-
|
|
146
|
-
.cron-runs {
|
|
147
|
-
max-height: 0;
|
|
148
|
-
overflow: hidden;
|
|
149
|
-
transition: max-height 0.3s ease;
|
|
150
|
-
}
|
|
151
|
-
.cron-runs.open { max-height: 400px; overflow-y: auto; }
|
|
152
|
-
|
|
153
|
-
.status-dot {
|
|
154
|
-
width: 6px; height: 6px; border-radius: 50%;
|
|
155
|
-
}
|
|
156
|
-
.status-ok { background: #34d399; box-shadow: 0 0 6px rgba(52, 211, 153, 0.4); }
|
|
157
|
-
.status-warn { background: #fbbf24; box-shadow: 0 0 6px rgba(251, 191, 36, 0.4); }
|
|
158
|
-
.status-error { background: #f87171; box-shadow: 0 0 6px rgba(248, 113, 113, 0.4); }
|
|
159
|
-
|
|
160
|
-
@keyframes barGrow {
|
|
161
|
-
from { transform: scaleX(0); }
|
|
162
|
-
to { transform: scaleX(1); }
|
|
163
|
-
}
|
|
164
|
-
</style>
|
|
165
|
-
{% endblock %}
|
|
166
|
-
|
|
167
|
-
{% block scripts %}
|
|
168
|
-
<script>
|
|
169
|
-
let cronData = null;
|
|
170
|
-
let timelineData = null;
|
|
171
|
-
let currentRange = '24h';
|
|
172
|
-
|
|
173
|
-
function setTimeRange(range) {
|
|
174
|
-
currentRange = range;
|
|
175
|
-
document.querySelectorAll('.range-btn').forEach(b => b.classList.toggle('active', b.dataset.range === range));
|
|
176
|
-
|
|
177
|
-
// Update axis labels
|
|
178
|
-
const axis = document.getElementById('time-axis');
|
|
179
|
-
if (range === '24h') axis.innerHTML = '<span>-24h</span><span>-18h</span><span>-12h</span><span>-6h</span><span>now</span>';
|
|
180
|
-
else if (range === '48h') axis.innerHTML = '<span>-48h</span><span>-36h</span><span>-24h</span><span>-12h</span><span>now</span>';
|
|
181
|
-
else axis.innerHTML = '<span>-7d</span><span>-5d</span><span>-3d</span><span>-1d</span><span>now</span>';
|
|
182
|
-
|
|
183
|
-
loadAll();
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
function getRangeHours() {
|
|
187
|
-
if (currentRange === '48h') return 48;
|
|
188
|
-
if (currentRange === '7d') return 168;
|
|
189
|
-
return 24;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
function getStatusClass(successRate) {
|
|
193
|
-
if (successRate >= 95) return 'status-ok';
|
|
194
|
-
if (successRate >= 70) return 'status-warn';
|
|
195
|
-
return 'status-error';
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
function getSuccessColor(rate) {
|
|
199
|
-
if (rate >= 95) return 'text-emerald-400';
|
|
200
|
-
if (rate >= 70) return 'text-amber-400';
|
|
201
|
-
return 'text-red-400';
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
function renderSummary(summary) {
|
|
205
|
-
let totalRuns = 0, totalSuccess = 0, totalFail = 0, totalDuration = 0, cronCount = 0, durationCount = 0;
|
|
206
|
-
|
|
207
|
-
for (const [, s] of Object.entries(summary)) {
|
|
208
|
-
totalRuns += (s.total || 0);
|
|
209
|
-
totalSuccess += (s.success || 0);
|
|
210
|
-
totalFail += (s.fail || 0);
|
|
211
|
-
if (s.avg_duration) { totalDuration += s.avg_duration; durationCount++; }
|
|
212
|
-
cronCount++;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
const rate = totalRuns > 0 ? Math.round((totalSuccess / totalRuns) * 100) : 0;
|
|
216
|
-
const avgDur = durationCount > 0 ? (totalDuration / durationCount).toFixed(1) : '--';
|
|
217
|
-
|
|
218
|
-
document.getElementById('stat-total').textContent = formatNumber(totalRuns);
|
|
219
|
-
document.getElementById('stat-total-label').textContent = `last ${currentRange}`;
|
|
220
|
-
|
|
221
|
-
const successEl = document.getElementById('stat-success');
|
|
222
|
-
successEl.textContent = rate + '%';
|
|
223
|
-
successEl.className = `text-2xl font-mono font-bold ${getSuccessColor(rate)}`;
|
|
224
|
-
document.getElementById('stat-success-bar').style.width = rate + '%';
|
|
225
|
-
|
|
226
|
-
document.getElementById('stat-duration').textContent = avgDur + 's';
|
|
227
|
-
document.getElementById('stat-active').textContent = cronCount;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
function renderTimeline(timeline) {
|
|
231
|
-
const container = document.getElementById('timeline-container');
|
|
232
|
-
if (!timeline || timeline.length === 0) {
|
|
233
|
-
container.innerHTML = '<div class="text-xs text-slate-600 text-center py-6">No timeline data</div>';
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
const rangeHours = getRangeHours();
|
|
238
|
-
const now = Date.now();
|
|
239
|
-
const rangeMs = rangeHours * 3600000;
|
|
240
|
-
|
|
241
|
-
// Group by cron_id
|
|
242
|
-
const groups = {};
|
|
243
|
-
timeline.forEach(t => {
|
|
244
|
-
if (!groups[t.cron_id]) groups[t.cron_id] = [];
|
|
245
|
-
groups[t.cron_id].push(t);
|
|
246
|
-
});
|
|
247
|
-
|
|
248
|
-
container.innerHTML = Object.entries(groups).map(([cronId, runs]) => {
|
|
249
|
-
const dots = runs.map(r => {
|
|
250
|
-
const ts = new Date(r.started_at).getTime();
|
|
251
|
-
const pct = Math.max(0, Math.min(100, ((ts - (now - rangeMs)) / rangeMs) * 100));
|
|
252
|
-
const isSuccess = r.exit_code === 0;
|
|
253
|
-
const dur = r.duration_secs != null ? r.duration_secs.toFixed(1) + 's' : '?';
|
|
254
|
-
return `<div class="timeline-dot ${isSuccess ? 'success' : 'failure'}" style="left: ${pct}%" title="${cronId} - ${isSuccess ? 'OK' : 'FAIL'} (${dur}) - ${new Date(r.started_at).toLocaleTimeString('en-GB')}"></div>`;
|
|
255
|
-
}).join('');
|
|
256
|
-
|
|
257
|
-
return `
|
|
258
|
-
<div class="timeline-row">
|
|
259
|
-
<div class="timeline-label" title="${escapeHtml(cronId)}">${escapeHtml(cronId)}</div>
|
|
260
|
-
<div class="timeline-track">${dots}</div>
|
|
261
|
-
</div>
|
|
262
|
-
`;
|
|
263
|
-
}).join('');
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
function renderTable(summary, runs) {
|
|
267
|
-
const table = document.getElementById('cron-table');
|
|
268
|
-
const skeleton = document.getElementById('table-skeleton');
|
|
269
|
-
if (skeleton) skeleton.remove();
|
|
270
|
-
|
|
271
|
-
const entries = Object.entries(summary);
|
|
272
|
-
if (entries.length === 0) {
|
|
273
|
-
table.innerHTML = '<div class="p-5 text-xs text-slate-600 text-center">No cron data available</div>';
|
|
274
|
-
return;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
// Group runs by cron_id for expandable rows
|
|
278
|
-
const runsByCron = {};
|
|
279
|
-
if (runs) {
|
|
280
|
-
runs.forEach(r => {
|
|
281
|
-
const key = r.cron_id || r.name || 'unknown';
|
|
282
|
-
if (!runsByCron[key]) runsByCron[key] = [];
|
|
283
|
-
runsByCron[key].push(r);
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
table.innerHTML = `
|
|
288
|
-
<div class="grid grid-cols-[1fr_80px_120px_90px_120px_40px] gap-2 px-5 py-2.5 text-[10px] uppercase tracking-wider text-slate-600 font-semibold border-b border-slate-800/30">
|
|
289
|
-
<span>Name</span><span class="text-center">Runs</span><span class="text-center">Success / Fail</span><span class="text-center">Avg Duration</span><span class="text-center">Last Run</span><span></span>
|
|
290
|
-
</div>
|
|
291
|
-
${entries.map(([cronId, s]) => {
|
|
292
|
-
const rate = s.total > 0 ? Math.round((s.success / s.total) * 100) : 0;
|
|
293
|
-
const cronRuns = runsByCron[cronId] || [];
|
|
294
|
-
const lastRun = cronRuns.length > 0 ? relativeTime(cronRuns[0].started_at || cronRuns[0].created_at) : '--';
|
|
295
|
-
return `
|
|
296
|
-
<div class="cron-row">
|
|
297
|
-
<div class="grid grid-cols-[1fr_80px_120px_90px_120px_40px] gap-2 px-5 py-3 items-center cursor-pointer" onclick="toggleCronRuns(this)">
|
|
298
|
-
<div class="flex items-center gap-2">
|
|
299
|
-
<div class="status-dot ${getStatusClass(rate)}"></div>
|
|
300
|
-
<span class="text-sm text-slate-200 font-mono truncate">${escapeHtml(cronId)}</span>
|
|
301
|
-
</div>
|
|
302
|
-
<span class="text-center text-xs font-mono text-slate-400">${s.total || 0}</span>
|
|
303
|
-
<div class="flex items-center justify-center gap-1.5">
|
|
304
|
-
<span class="text-xs font-mono text-emerald-400">${s.success || 0}</span>
|
|
305
|
-
<span class="text-slate-700">/</span>
|
|
306
|
-
<span class="text-xs font-mono ${s.fail > 0 ? 'text-red-400' : 'text-slate-600'}">${s.fail || 0}</span>
|
|
307
|
-
</div>
|
|
308
|
-
<span class="text-center text-xs font-mono text-slate-400">${s.avg_duration ? s.avg_duration.toFixed(1) + 's' : '--'}</span>
|
|
309
|
-
<span class="text-center text-xs text-slate-500">${lastRun}</span>
|
|
310
|
-
<svg class="w-4 h-4 text-slate-600 mx-auto transition-transform duration-200 expand-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"/></svg>
|
|
311
|
-
</div>
|
|
312
|
-
<div class="cron-runs">
|
|
313
|
-
${cronRuns.length > 0 ? `
|
|
314
|
-
<div class="px-5 pb-3">
|
|
315
|
-
<div class="bg-slate-950/50 rounded-lg border border-slate-800/30 overflow-hidden">
|
|
316
|
-
<div class="grid grid-cols-[1fr_80px_90px_120px] gap-2 px-4 py-2 text-[9px] uppercase tracking-wider text-slate-600 border-b border-slate-800/30">
|
|
317
|
-
<span>Started</span><span>Exit Code</span><span>Duration</span><span>Status</span>
|
|
318
|
-
</div>
|
|
319
|
-
${cronRuns.slice(0, 10).map(r => `
|
|
320
|
-
<div class="grid grid-cols-[1fr_80px_90px_120px] gap-2 px-4 py-2 text-xs border-b border-slate-800/10 last:border-0">
|
|
321
|
-
<span class="font-mono text-slate-400">${r.started_at ? new Date(r.started_at).toLocaleString('en-GB', {month:'short',day:'numeric',hour:'2-digit',minute:'2-digit'}) : '--'}</span>
|
|
322
|
-
<span class="font-mono ${r.exit_code === 0 ? 'text-emerald-400' : 'text-red-400'}">${r.exit_code != null ? r.exit_code : '--'}</span>
|
|
323
|
-
<span class="font-mono text-slate-400">${r.duration_secs != null ? r.duration_secs.toFixed(1) + 's' : '--'}</span>
|
|
324
|
-
<span class="text-[10px] ${r.exit_code === 0 ? 'text-emerald-400' : 'text-red-400'}">${r.exit_code === 0 ? 'Success' : 'Failed'}</span>
|
|
325
|
-
</div>
|
|
326
|
-
`).join('')}
|
|
327
|
-
</div>
|
|
328
|
-
</div>
|
|
329
|
-
` : '<div class="px-5 pb-3 text-xs text-slate-600">No recent runs</div>'}
|
|
330
|
-
</div>
|
|
331
|
-
</div>
|
|
332
|
-
`;
|
|
333
|
-
}).join('')}
|
|
334
|
-
`;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
function toggleCronRuns(el) {
|
|
338
|
-
const runs = el.nextElementSibling;
|
|
339
|
-
const icon = el.querySelector('.expand-icon');
|
|
340
|
-
runs.classList.toggle('open');
|
|
341
|
-
icon.style.transform = runs.classList.contains('open') ? 'rotate(180deg)' : '';
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
async function loadAll() {
|
|
345
|
-
const range = currentRange;
|
|
346
|
-
const [cronsRes, timelineRes] = await Promise.all([
|
|
347
|
-
fetchJSON(`/api/crons?range=${range}`),
|
|
348
|
-
fetchJSON(`/api/crons/timeline?range=${range}`)
|
|
349
|
-
]);
|
|
350
|
-
|
|
351
|
-
if (cronsRes) {
|
|
352
|
-
cronData = cronsRes;
|
|
353
|
-
renderSummary(cronsRes.summary || {});
|
|
354
|
-
renderTable(cronsRes.summary || {}, cronsRes.runs || []);
|
|
355
|
-
}
|
|
356
|
-
if (timelineRes) {
|
|
357
|
-
timelineData = timelineRes;
|
|
358
|
-
renderTimeline(timelineRes.timeline || []);
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
document.getElementById('crons-updated').textContent = 'updated ' + new Date().toLocaleTimeString('en-GB', { hour: '2-digit', minute: '2-digit' });
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
// Initial load
|
|
365
|
-
loadAll();
|
|
366
|
-
|
|
367
|
-
// Auto-refresh every 60s
|
|
368
|
-
setInterval(loadAll, 60000);
|
|
369
|
-
</script>
|
|
370
|
-
{% endblock %}
|