nexo-brain 2.3.2 → 2.5.0
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/README.md +77 -8
- package/bin/nexo-brain.js +230 -22
- package/bin/nexo.js +55 -0
- package/community/skills/.gitkeep +1 -0
- package/package.json +5 -2
- package/src/auto_update.py +158 -8
- package/src/cli.py +605 -0
- package/src/cognitive/_ingest.py +1 -1
- package/src/cognitive/_memory.py +4 -4
- package/src/crons/manifest.json +8 -0
- package/src/dashboard/app.py +709 -37
- package/src/dashboard/templates/adaptive.html +112 -218
- package/src/dashboard/templates/artifacts.html +133 -0
- package/src/dashboard/templates/backups.html +136 -0
- package/src/dashboard/templates/base.html +413 -0
- package/src/dashboard/templates/calendar.html +523 -652
- package/src/dashboard/templates/chat.html +356 -0
- package/src/dashboard/templates/claims.html +259 -0
- package/src/dashboard/templates/cortex.html +262 -0
- package/src/dashboard/templates/credentials.html +128 -0
- package/src/dashboard/templates/crons.html +370 -0
- package/src/dashboard/templates/dashboard.html +384 -572
- package/src/dashboard/templates/dreams.html +252 -0
- package/src/dashboard/templates/email.html +160 -0
- package/src/dashboard/templates/evolution.html +189 -0
- package/src/dashboard/templates/feed.html +249 -0
- package/src/dashboard/templates/followup_health.html +170 -0
- package/src/dashboard/templates/graph.html +191 -269
- package/src/dashboard/templates/guard.html +259 -0
- package/src/dashboard/templates/inbox.html +220 -336
- package/src/dashboard/templates/memory.html +317 -197
- package/src/dashboard/templates/operations.html +498 -652
- package/src/dashboard/templates/plugins.html +185 -0
- package/src/dashboard/templates/rules.html +246 -0
- package/src/dashboard/templates/sentiment.html +247 -0
- package/src/dashboard/templates/sessions.html +215 -171
- package/src/dashboard/templates/skills.html +329 -0
- package/src/dashboard/templates/somatic.html +68 -172
- package/src/dashboard/templates/triggers.html +133 -0
- package/src/dashboard/templates/trust.html +360 -0
- package/src/db/__init__.py +5 -0
- package/src/db/_schema.py +25 -1
- package/src/db/_sessions.py +22 -0
- package/src/db/_skills.py +983 -252
- package/src/doctor/__init__.py +1 -0
- package/src/doctor/formatters.py +52 -0
- package/src/doctor/models.py +44 -0
- package/src/doctor/orchestrator.py +42 -0
- package/src/doctor/providers/__init__.py +1 -0
- package/src/doctor/providers/boot.py +206 -0
- package/src/doctor/providers/deep.py +292 -0
- package/src/doctor/providers/runtime.py +686 -0
- package/src/hooks/capture-tool-logs.sh +18 -4
- package/src/hooks/post-compact.sh +5 -1
- package/src/hooks/pre-compact.sh +1 -1
- package/src/plugin_loader.py +14 -0
- package/src/plugins/doctor.py +36 -0
- package/src/plugins/evolution.py +2 -1
- package/src/plugins/skills.py +135 -175
- package/src/requirements.txt +1 -0
- package/src/script_registry.py +322 -0
- package/src/scripts/deep-sleep/apply_findings.py +63 -33
- package/src/scripts/deep-sleep/collect.py +38 -9
- package/src/scripts/deep-sleep/extract-prompt.md +14 -0
- package/src/scripts/deep-sleep/synthesize-prompt.md +36 -0
- package/src/scripts/deep-sleep/synthesize.py +37 -1
- package/src/scripts/nexo-dashboard.sh +29 -0
- package/src/scripts/nexo-day-orchestrator.sh +139 -0
- package/src/scripts/nexo-evolution-run.py +2 -1
- package/src/scripts/nexo-learning-housekeep.py +1 -1
- package/src/scripts/nexo-watchdog.sh +1 -1
- package/src/server.py +9 -5
- package/src/skills/run-runtime-doctor/guide.md +12 -0
- package/src/skills/run-runtime-doctor/script.py +21 -0
- package/src/skills/run-runtime-doctor/skill.json +25 -0
- package/src/skills_runtime.py +347 -0
- package/src/tools_menu.py +3 -2
- package/src/tools_sessions.py +126 -0
- package/src/user_context.py +46 -0
- package/templates/nexo_helper.py +45 -0
- package/templates/script-template.py +44 -0
- package/templates/skill-script-template.py +39 -0
- package/templates/skill-template.md +33 -0
|
@@ -1,543 +1,376 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
<
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
<a href="/calendar" title="Calendar" class="w-9 h-9 rounded-lg flex items-center justify-center text-slate-500 hover:bg-slate-800 hover:text-slate-300 transition-colors">
|
|
69
|
-
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round">
|
|
70
|
-
<rect x="3" y="4" width="18" height="18" rx="2"/>
|
|
71
|
-
<path d="M16 2v4M8 2v4M3 10h18"/>
|
|
72
|
-
</svg>
|
|
73
|
-
</a>
|
|
74
|
-
|
|
75
|
-
<!-- Inbox -->
|
|
76
|
-
<a href="/inbox" title="Inbox" class="relative w-9 h-9 rounded-lg flex items-center justify-center text-slate-500 hover:bg-slate-800 hover:text-slate-300 transition-colors">
|
|
77
|
-
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round">
|
|
78
|
-
<path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"/>
|
|
79
|
-
<polyline points="22,6 12,13 2,6"/>
|
|
80
|
-
</svg>
|
|
81
|
-
<span id="inbox-badge" class="hidden absolute -top-0.5 -right-0.5 w-3.5 h-3.5 rounded-full bg-red-500 text-xs font-mono text-white flex items-center justify-center leading-none">0</span>
|
|
82
|
-
</a>
|
|
83
|
-
|
|
84
|
-
<div class="w-6 h-px bg-slate-800 my-1"></div>
|
|
85
|
-
|
|
86
|
-
<!-- Memory -->
|
|
87
|
-
<a href="/memory" title="Memory" class="w-9 h-9 rounded-lg flex items-center justify-center text-slate-500 hover:bg-slate-800 hover:text-slate-300 transition-colors">
|
|
88
|
-
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round">
|
|
89
|
-
<ellipse cx="12" cy="5" rx="9" ry="3"/>
|
|
90
|
-
<path d="M3 5v14c0 1.66 4.03 3 9 3s9-1.34 9-3V5"/>
|
|
91
|
-
<path d="M3 12c0 1.66 4.03 3 9 3s9-1.34 9-3"/>
|
|
92
|
-
</svg>
|
|
93
|
-
</a>
|
|
94
|
-
|
|
95
|
-
<!-- Graph -->
|
|
96
|
-
<a href="/graph" title="Graph" class="w-9 h-9 rounded-lg flex items-center justify-center text-slate-500 hover:bg-slate-800 hover:text-slate-300 transition-colors">
|
|
97
|
-
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round">
|
|
98
|
-
<circle cx="12" cy="12" r="3"/>
|
|
99
|
-
<circle cx="4" cy="6" r="2"/>
|
|
100
|
-
<circle cx="20" cy="6" r="2"/>
|
|
101
|
-
<circle cx="4" cy="18" r="2"/>
|
|
102
|
-
<circle cx="20" cy="18" r="2"/>
|
|
103
|
-
<path d="M6 6.5l4 4M14 13.5l4 4M6 17.5l4-4M14 10.5l4-4"/>
|
|
104
|
-
</svg>
|
|
105
|
-
</a>
|
|
106
|
-
|
|
107
|
-
<!-- Sessions -->
|
|
108
|
-
<a href="/sessions" title="Sessions" class="w-9 h-9 rounded-lg flex items-center justify-center text-slate-500 hover:bg-slate-800 hover:text-slate-300 transition-colors">
|
|
109
|
-
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round">
|
|
110
|
-
<polyline points="23 4 23 10 17 10"/>
|
|
111
|
-
<polyline points="1 20 1 14 7 14"/>
|
|
112
|
-
<path d="M3.51 9a9 9 0 0114.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0020.49 15"/>
|
|
113
|
-
</svg>
|
|
114
|
-
</a>
|
|
115
|
-
|
|
116
|
-
<!-- Somatic -->
|
|
117
|
-
<a href="/somatic" title="Somatic" class="w-9 h-9 rounded-lg flex items-center justify-center text-slate-500 hover:bg-slate-800 hover:text-slate-300 transition-colors">
|
|
118
|
-
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round">
|
|
119
|
-
<path d="M20.84 4.61a5.5 5.5 0 00-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 00-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 000-7.78z"/>
|
|
120
|
-
</svg>
|
|
121
|
-
</a>
|
|
122
|
-
|
|
123
|
-
<!-- Adaptive -->
|
|
124
|
-
<a href="/adaptive" title="Adaptive" class="w-9 h-9 rounded-lg flex items-center justify-center text-slate-500 hover:bg-slate-800 hover:text-slate-300 transition-colors">
|
|
125
|
-
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round">
|
|
126
|
-
<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/>
|
|
127
|
-
</svg>
|
|
128
|
-
</a>
|
|
129
|
-
</nav>
|
|
130
|
-
|
|
131
|
-
<!-- Trust score -->
|
|
132
|
-
<div class="flex flex-col items-center gap-0.5 mt-2">
|
|
133
|
-
<span class="text-xs uppercase tracking-widest text-slate-600 font-mono">trust</span>
|
|
134
|
-
<span id="sidebar-trust" class="text-xs font-mono font-medium text-slate-400">--</span>
|
|
1
|
+
{% extends "base.html" %}
|
|
2
|
+
|
|
3
|
+
{% block title %}Operations{% endblock %}
|
|
4
|
+
{% block page_title %}Operations{% endblock %}
|
|
5
|
+
|
|
6
|
+
{% block head %}
|
|
7
|
+
<style>
|
|
8
|
+
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
|
|
9
|
+
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
|
|
10
|
+
.toast-enter { animation: slideIn 0.2s ease-out; }
|
|
11
|
+
.modal-backdrop { backdrop-filter: blur(4px); }
|
|
12
|
+
</style>
|
|
13
|
+
{% endblock %}
|
|
14
|
+
|
|
15
|
+
{% block header_actions %}
|
|
16
|
+
<input
|
|
17
|
+
type="text"
|
|
18
|
+
id="ops-search"
|
|
19
|
+
placeholder="Search..."
|
|
20
|
+
oninput="filterOps()"
|
|
21
|
+
class="bg-slate-800 border border-slate-700 rounded-lg px-3 py-1 text-xs text-slate-200 w-48 focus:outline-none focus:ring-1 focus:ring-violet-500 placeholder-slate-500"
|
|
22
|
+
>
|
|
23
|
+
<select
|
|
24
|
+
id="ops-status"
|
|
25
|
+
onchange="loadOpsData()"
|
|
26
|
+
class="bg-slate-800 border border-slate-700 rounded-lg px-2 py-1 text-xs text-slate-200 focus:outline-none focus:ring-1 focus:ring-violet-500"
|
|
27
|
+
>
|
|
28
|
+
<option value="PENDING">Pending</option>
|
|
29
|
+
<option value="all">All</option>
|
|
30
|
+
<option value="COMPLETED">Completed</option>
|
|
31
|
+
</select>
|
|
32
|
+
{% endblock %}
|
|
33
|
+
|
|
34
|
+
{% block content %}
|
|
35
|
+
<div class="grid grid-cols-2 gap-6">
|
|
36
|
+
|
|
37
|
+
<!-- LEFT: User's Items (Reminders) -->
|
|
38
|
+
<div>
|
|
39
|
+
<div class="flex items-center justify-between mb-3">
|
|
40
|
+
<div class="flex items-center gap-2">
|
|
41
|
+
<div class="w-2 h-2 rounded-full bg-violet-400"></div>
|
|
42
|
+
<h2 class="text-sm font-display font-semibold text-slate-100">User</h2>
|
|
43
|
+
<span id="reminder-count" class="text-xs px-1.5 py-0.5 rounded-full bg-violet-500/20 text-violet-400 font-mono">0</span>
|
|
44
|
+
</div>
|
|
45
|
+
<button onclick="openCreate('reminder')" class="text-xs px-2 py-1 rounded-md bg-slate-800 text-slate-400 hover:bg-slate-700 hover:text-slate-200 transition-colors">
|
|
46
|
+
+ Add
|
|
47
|
+
</button>
|
|
48
|
+
</div>
|
|
49
|
+
<div id="reminders-list" class="space-y-2">
|
|
50
|
+
<div class="text-xs text-slate-600 font-mono py-4 text-center">Loading...</div>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
<!-- RIGHT: NEXO's Items (Followups) -->
|
|
55
|
+
<div>
|
|
56
|
+
<div class="flex items-center justify-between mb-3">
|
|
57
|
+
<div class="flex items-center gap-2">
|
|
58
|
+
<div class="w-2 h-2 rounded-full bg-pink-400"></div>
|
|
59
|
+
<h2 class="text-sm font-display font-semibold text-slate-100">NEXO</h2>
|
|
60
|
+
<span id="followup-count" class="text-xs px-1.5 py-0.5 rounded-full bg-pink-500/20 text-pink-400 font-mono">0</span>
|
|
61
|
+
</div>
|
|
62
|
+
<button onclick="openCreate('followup')" class="text-xs px-2 py-1 rounded-md bg-slate-800 text-slate-400 hover:bg-slate-700 hover:text-slate-200 transition-colors">
|
|
63
|
+
+ Add
|
|
64
|
+
</button>
|
|
65
|
+
</div>
|
|
66
|
+
<div id="followups-list" class="space-y-2">
|
|
67
|
+
<div class="text-xs text-slate-600 font-mono py-4 text-center">Loading...</div>
|
|
135
68
|
</div>
|
|
136
|
-
</
|
|
69
|
+
</div>
|
|
137
70
|
|
|
138
|
-
|
|
139
|
-
<main class="ml-14 min-h-screen bg-gray-950 text-slate-200">
|
|
71
|
+
</div>
|
|
140
72
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
73
|
+
<!-- CREATE/EDIT MODAL -->
|
|
74
|
+
<div id="ops-modal" class="hidden fixed inset-0 z-50 flex items-center justify-center">
|
|
75
|
+
<div class="absolute inset-0 bg-black/60 modal-backdrop" onclick="closeModal()"></div>
|
|
76
|
+
<div class="relative bg-slate-900 border border-slate-700/50 rounded-xl shadow-2xl w-full max-w-md mx-4">
|
|
77
|
+
<div class="flex items-center justify-between px-5 py-4 border-b border-slate-800">
|
|
78
|
+
<h2 id="modal-title" class="text-sm font-display font-semibold text-slate-100">New Item</h2>
|
|
79
|
+
<button onclick="closeModal()" class="w-6 h-6 rounded-md flex items-center justify-center text-slate-500 hover:bg-slate-800 hover:text-slate-300 transition-colors text-lg leading-none">×</button>
|
|
80
|
+
</div>
|
|
81
|
+
<form id="modal-form" onsubmit="submitForm(event)" class="px-5 py-4 space-y-4">
|
|
82
|
+
<div>
|
|
83
|
+
<label class="block text-xs text-slate-400 mb-1.5 font-medium">Description</label>
|
|
84
|
+
<textarea
|
|
85
|
+
name="description"
|
|
86
|
+
rows="3"
|
|
87
|
+
required
|
|
88
|
+
class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-slate-200 focus:outline-none focus:ring-1 focus:ring-violet-500 resize-none placeholder-slate-500"
|
|
89
|
+
placeholder="Describe the item..."
|
|
90
|
+
></textarea>
|
|
91
|
+
</div>
|
|
92
|
+
<div>
|
|
93
|
+
<label class="block text-xs text-slate-400 mb-1.5 font-medium">Date <span class="text-slate-600">(optional)</span></label>
|
|
145
94
|
<input
|
|
146
|
-
type="
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
oninput="filterOps()"
|
|
150
|
-
class="bg-slate-800 border border-slate-700 rounded-lg px-3 py-1 text-xs text-slate-200 w-48 focus:outline-none focus:ring-1 focus:ring-violet-500 placeholder-slate-500"
|
|
151
|
-
>
|
|
152
|
-
<select
|
|
153
|
-
id="ops-status"
|
|
154
|
-
onchange="loadOpsData()"
|
|
155
|
-
class="bg-slate-800 border border-slate-700 rounded-lg px-2 py-1 text-xs text-slate-200 focus:outline-none focus:ring-1 focus:ring-violet-500"
|
|
95
|
+
type="date"
|
|
96
|
+
name="date"
|
|
97
|
+
class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-slate-200 focus:outline-none focus:ring-1 focus:ring-violet-500"
|
|
156
98
|
>
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
99
|
+
</div>
|
|
100
|
+
<div id="category-group" class="hidden">
|
|
101
|
+
<label class="block text-xs text-slate-400 mb-1.5 font-medium">Category</label>
|
|
102
|
+
<select name="category" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-slate-200 focus:outline-none focus:ring-1 focus:ring-violet-500">
|
|
103
|
+
<option value="general">General</option>
|
|
104
|
+
<option value="ideas">Ideas</option>
|
|
105
|
+
<option value="my-project">My Project</option>
|
|
106
|
+
<option value="project-a">Project A</option>
|
|
107
|
+
<option value="server">Server</option>
|
|
160
108
|
</select>
|
|
161
109
|
</div>
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
<div class="flex items-center justify-between mb-3">
|
|
171
|
-
<div class="flex items-center gap-2">
|
|
172
|
-
<div class="w-2 h-2 rounded-full bg-violet-400"></div>
|
|
173
|
-
<h2 class="text-sm font-display font-semibold text-slate-100">User</h2>
|
|
174
|
-
<span id="reminder-count" class="text-xs px-1.5 py-0.5 rounded-full bg-violet-500/20 text-violet-400 font-mono">0</span>
|
|
175
|
-
</div>
|
|
176
|
-
<button onclick="openCreate('reminder')" class="text-xs px-2 py-1 rounded-md bg-slate-800 text-slate-400 hover:bg-slate-700 hover:text-slate-200 transition-colors">
|
|
177
|
-
+ Add
|
|
178
|
-
</button>
|
|
179
|
-
</div>
|
|
180
|
-
<div id="reminders-list" class="space-y-2">
|
|
181
|
-
<div class="text-xs text-slate-600 font-mono py-4 text-center">Loading...</div>
|
|
182
|
-
</div>
|
|
183
|
-
</div>
|
|
184
|
-
|
|
185
|
-
<!-- RIGHT: NEXO's Items (Followups) -->
|
|
186
|
-
<div>
|
|
187
|
-
<div class="flex items-center justify-between mb-3">
|
|
188
|
-
<div class="flex items-center gap-2">
|
|
189
|
-
<div class="w-2 h-2 rounded-full bg-pink-400"></div>
|
|
190
|
-
<h2 class="text-sm font-display font-semibold text-slate-100">NEXO</h2>
|
|
191
|
-
<span id="followup-count" class="text-xs px-1.5 py-0.5 rounded-full bg-pink-500/20 text-pink-400 font-mono">0</span>
|
|
192
|
-
</div>
|
|
193
|
-
<button onclick="openCreate('followup')" class="text-xs px-2 py-1 rounded-md bg-slate-800 text-slate-400 hover:bg-slate-700 hover:text-slate-200 transition-colors">
|
|
194
|
-
+ Add
|
|
195
|
-
</button>
|
|
196
|
-
</div>
|
|
197
|
-
<div id="followups-list" class="space-y-2">
|
|
198
|
-
<div class="text-xs text-slate-600 font-mono py-4 text-center">Loading...</div>
|
|
199
|
-
</div>
|
|
200
|
-
</div>
|
|
201
|
-
|
|
110
|
+
<div id="verification-group" class="hidden">
|
|
111
|
+
<label class="block text-xs text-slate-400 mb-1.5 font-medium">Verification</label>
|
|
112
|
+
<textarea
|
|
113
|
+
name="verification"
|
|
114
|
+
rows="2"
|
|
115
|
+
class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-slate-200 focus:outline-none focus:ring-1 focus:ring-violet-500 resize-none placeholder-slate-500"
|
|
116
|
+
placeholder="How to verify this is done..."
|
|
117
|
+
></textarea>
|
|
202
118
|
</div>
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
<h2 id="modal-title" class="text-sm font-display font-semibold text-slate-100">New Item</h2>
|
|
212
|
-
<button onclick="closeModal()" class="w-6 h-6 rounded-md flex items-center justify-center text-slate-500 hover:bg-slate-800 hover:text-slate-300 transition-colors text-lg leading-none">×</button>
|
|
119
|
+
<div id="reasoning-group" class="hidden">
|
|
120
|
+
<label class="block text-xs text-slate-400 mb-1.5 font-medium">Reasoning</label>
|
|
121
|
+
<textarea
|
|
122
|
+
name="reasoning"
|
|
123
|
+
rows="2"
|
|
124
|
+
class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-slate-200 focus:outline-none focus:ring-1 focus:ring-violet-500 resize-none placeholder-slate-500"
|
|
125
|
+
placeholder="Why this followup exists..."
|
|
126
|
+
></textarea>
|
|
213
127
|
</div>
|
|
214
|
-
<
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
></textarea>
|
|
224
|
-
</div>
|
|
225
|
-
<div>
|
|
226
|
-
<label class="block text-xs text-slate-400 mb-1.5 font-medium">Date <span class="text-slate-600">(optional)</span></label>
|
|
227
|
-
<input
|
|
228
|
-
type="date"
|
|
229
|
-
name="date"
|
|
230
|
-
class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-slate-200 focus:outline-none focus:ring-1 focus:ring-violet-500"
|
|
231
|
-
>
|
|
232
|
-
</div>
|
|
233
|
-
<div id="category-group" class="hidden">
|
|
234
|
-
<label class="block text-xs text-slate-400 mb-1.5 font-medium">Category</label>
|
|
235
|
-
<select name="category" class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-slate-200 focus:outline-none focus:ring-1 focus:ring-violet-500">
|
|
236
|
-
<option value="general">General</option>
|
|
237
|
-
<option value="ideas">Ideas</option>
|
|
238
|
-
<option value="my-project">My Project</option>
|
|
239
|
-
<option value="project-a">Project A</option>
|
|
240
|
-
<option value="server">Server</option>
|
|
241
|
-
</select>
|
|
242
|
-
</div>
|
|
243
|
-
<div id="verification-group" class="hidden">
|
|
244
|
-
<label class="block text-xs text-slate-400 mb-1.5 font-medium">Verification</label>
|
|
245
|
-
<textarea
|
|
246
|
-
name="verification"
|
|
247
|
-
rows="2"
|
|
248
|
-
class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-slate-200 focus:outline-none focus:ring-1 focus:ring-violet-500 resize-none placeholder-slate-500"
|
|
249
|
-
placeholder="How to verify this is done..."
|
|
250
|
-
></textarea>
|
|
251
|
-
</div>
|
|
252
|
-
<div id="reasoning-group" class="hidden">
|
|
253
|
-
<label class="block text-xs text-slate-400 mb-1.5 font-medium">Reasoning</label>
|
|
254
|
-
<textarea
|
|
255
|
-
name="reasoning"
|
|
256
|
-
rows="2"
|
|
257
|
-
class="w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-xs text-slate-200 focus:outline-none focus:ring-1 focus:ring-violet-500 resize-none placeholder-slate-500"
|
|
258
|
-
placeholder="Why this followup exists..."
|
|
259
|
-
></textarea>
|
|
260
|
-
</div>
|
|
261
|
-
<input type="hidden" name="type" id="modal-type">
|
|
262
|
-
<input type="hidden" name="edit_id" id="modal-edit-id">
|
|
263
|
-
<div class="flex items-center justify-end gap-2 pt-1">
|
|
264
|
-
<button type="button" onclick="closeModal()" class="text-xs px-3 py-1.5 rounded-lg bg-slate-800 text-slate-400 hover:bg-slate-700 hover:text-slate-200 transition-colors">
|
|
265
|
-
Cancel
|
|
266
|
-
</button>
|
|
267
|
-
<button type="submit" id="modal-submit-btn" class="text-xs px-3 py-1.5 rounded-lg bg-violet-600 text-white hover:bg-violet-500 transition-colors font-medium">
|
|
268
|
-
Create
|
|
269
|
-
</button>
|
|
270
|
-
</div>
|
|
271
|
-
</form>
|
|
272
|
-
</div>
|
|
273
|
-
</div>
|
|
274
|
-
|
|
275
|
-
<!-- CONFIRM MODAL -->
|
|
276
|
-
<div id="confirm-modal" class="hidden fixed inset-0 z-50 flex items-center justify-center">
|
|
277
|
-
<div class="absolute inset-0 bg-black/60 modal-backdrop" onclick="closeConfirm()"></div>
|
|
278
|
-
<div class="relative bg-slate-900 border border-slate-700/50 rounded-xl shadow-2xl w-full max-w-sm mx-4">
|
|
279
|
-
<div class="flex items-center justify-between px-5 py-4 border-b border-slate-800">
|
|
280
|
-
<h2 class="text-sm font-display font-semibold text-slate-100">Confirm</h2>
|
|
281
|
-
<button onclick="closeConfirm()" class="w-6 h-6 rounded-md flex items-center justify-center text-slate-500 hover:bg-slate-800 hover:text-slate-300 transition-colors text-lg leading-none">×</button>
|
|
128
|
+
<input type="hidden" name="type" id="modal-type">
|
|
129
|
+
<input type="hidden" name="edit_id" id="modal-edit-id">
|
|
130
|
+
<div class="flex items-center justify-end gap-2 pt-1">
|
|
131
|
+
<button type="button" onclick="closeModal()" class="text-xs px-3 py-1.5 rounded-lg bg-slate-800 text-slate-400 hover:bg-slate-700 hover:text-slate-200 transition-colors">
|
|
132
|
+
Cancel
|
|
133
|
+
</button>
|
|
134
|
+
<button type="submit" id="modal-submit-btn" class="text-xs px-3 py-1.5 rounded-lg bg-violet-600 text-white hover:bg-violet-500 transition-colors font-medium">
|
|
135
|
+
Create
|
|
136
|
+
</button>
|
|
282
137
|
</div>
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
138
|
+
</form>
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
141
|
+
|
|
142
|
+
<!-- CONFIRM MODAL -->
|
|
143
|
+
<div id="confirm-modal" class="hidden fixed inset-0 z-50 flex items-center justify-center">
|
|
144
|
+
<div class="absolute inset-0 bg-black/60 modal-backdrop" onclick="closeConfirm()"></div>
|
|
145
|
+
<div class="relative bg-slate-900 border border-slate-700/50 rounded-xl shadow-2xl w-full max-w-sm mx-4">
|
|
146
|
+
<div class="flex items-center justify-between px-5 py-4 border-b border-slate-800">
|
|
147
|
+
<h2 class="text-sm font-display font-semibold text-slate-100">Confirm</h2>
|
|
148
|
+
<button onclick="closeConfirm()" class="w-6 h-6 rounded-md flex items-center justify-center text-slate-500 hover:bg-slate-800 hover:text-slate-300 transition-colors text-lg leading-none">×</button>
|
|
149
|
+
</div>
|
|
150
|
+
<div class="px-5 py-4">
|
|
151
|
+
<p id="confirm-message" class="text-xs text-slate-300 mb-4">Are you sure?</p>
|
|
152
|
+
<div class="flex items-center justify-end gap-2">
|
|
153
|
+
<button onclick="closeConfirm()" class="text-xs px-3 py-1.5 rounded-lg bg-slate-800 text-slate-400 hover:bg-slate-700 hover:text-slate-200 transition-colors">
|
|
154
|
+
Cancel
|
|
155
|
+
</button>
|
|
156
|
+
<button id="confirm-btn" onclick="confirmAction()" class="text-xs px-3 py-1.5 rounded-lg bg-red-600 text-white hover:bg-red-500 transition-colors font-medium">
|
|
157
|
+
Delete
|
|
158
|
+
</button>
|
|
293
159
|
</div>
|
|
294
160
|
</div>
|
|
295
161
|
</div>
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
return `
|
|
418
|
-
<div class="bg-slate-900/50 border border-slate-800/50 rounded-lg p-4 group hover:border-slate-700 transition-colors ${completedOpacity}" data-id="${idLabel}">
|
|
419
|
-
<div class="flex items-start gap-2">
|
|
420
|
-
<div class="w-2 h-2 rounded-full mt-1.5 flex-shrink-0 ${dotColor}"></div>
|
|
421
|
-
<div class="flex-1 min-w-0">
|
|
422
|
-
<p class="text-sm text-slate-200 leading-relaxed line-clamp-2">${desc}</p>
|
|
423
|
-
<div class="flex items-center gap-2 mt-1.5 flex-wrap">
|
|
424
|
-
<span class="text-xs font-mono text-slate-600">${idLabel}</span>
|
|
425
|
-
${dateLabel ? `<span class="text-xs font-mono ${dateClass}">${dateLabel}</span>` : ''}
|
|
426
|
-
${category ? `<span class="text-xs px-1.5 py-0.5 rounded bg-slate-800 text-slate-500">${category}</span>` : ''}
|
|
427
|
-
${isCompleted ? `<span class="text-xs px-1.5 py-0.5 rounded bg-emerald-500/10 text-emerald-500">done</span>` : ''}
|
|
428
|
-
</div>
|
|
162
|
+
</div>
|
|
163
|
+
|
|
164
|
+
<!-- OPS TOAST (separate from base toast) -->
|
|
165
|
+
<div id="ops-toast" class="hidden fixed bottom-6 right-6 z-50 flex items-center gap-2.5 px-4 py-3 rounded-xl border shadow-lg text-xs font-medium toast-enter max-w-xs">
|
|
166
|
+
<span id="ops-toast-icon" class="flex-shrink-0"></span>
|
|
167
|
+
<span id="ops-toast-message"></span>
|
|
168
|
+
</div>
|
|
169
|
+
{% endblock %}
|
|
170
|
+
|
|
171
|
+
{% block scripts %}
|
|
172
|
+
<script>
|
|
173
|
+
// -----------------------------------------------------------------------
|
|
174
|
+
// State
|
|
175
|
+
// -----------------------------------------------------------------------
|
|
176
|
+
let allReminders = [];
|
|
177
|
+
let allFollowups = [];
|
|
178
|
+
let pendingConfirmAction = null;
|
|
179
|
+
|
|
180
|
+
// -----------------------------------------------------------------------
|
|
181
|
+
// Ops Toast (uses its own element to avoid conflict with base toast)
|
|
182
|
+
// -----------------------------------------------------------------------
|
|
183
|
+
function opsToast(message, type = 'success') {
|
|
184
|
+
const toast = document.getElementById('ops-toast');
|
|
185
|
+
const msg = document.getElementById('ops-toast-message');
|
|
186
|
+
const icon = document.getElementById('ops-toast-icon');
|
|
187
|
+
msg.textContent = message;
|
|
188
|
+
|
|
189
|
+
const styles = {
|
|
190
|
+
success: { bg: 'bg-slate-800', border: 'border-emerald-500/30', text: 'text-emerald-400', iconSvg: '\u2713' },
|
|
191
|
+
error: { bg: 'bg-slate-800', border: 'border-red-500/30', text: 'text-red-400', iconSvg: '\u2715' },
|
|
192
|
+
info: { bg: 'bg-slate-800', border: 'border-violet-500/30', text: 'text-violet-400', iconSvg: '\u00b7' },
|
|
193
|
+
};
|
|
194
|
+
const s = styles[type] || styles.info;
|
|
195
|
+
toast.className = `fixed bottom-6 right-6 z-50 flex items-center gap-2.5 px-4 py-3 rounded-xl border shadow-lg text-xs font-medium toast-enter max-w-xs ${s.bg} ${s.border}`;
|
|
196
|
+
icon.className = s.text;
|
|
197
|
+
icon.textContent = s.iconSvg;
|
|
198
|
+
msg.className = 'text-slate-200';
|
|
199
|
+
toast.classList.remove('hidden');
|
|
200
|
+
clearTimeout(toast._timer);
|
|
201
|
+
toast._timer = setTimeout(() => { toast.classList.add('hidden'); }, 3000);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// -----------------------------------------------------------------------
|
|
205
|
+
// Helpers
|
|
206
|
+
// -----------------------------------------------------------------------
|
|
207
|
+
function getToday() {
|
|
208
|
+
return new Date().toISOString().split('T')[0];
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function getWeekEnd() {
|
|
212
|
+
const d = new Date();
|
|
213
|
+
d.setDate(d.getDate() + 7);
|
|
214
|
+
return d.toISOString().split('T')[0];
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function opsRelativeDate(dateStr) {
|
|
218
|
+
if (!dateStr) return '';
|
|
219
|
+
const d = new Date(dateStr + 'T00:00:00'), now = new Date();
|
|
220
|
+
now.setHours(0,0,0,0);
|
|
221
|
+
const diff = Math.round((d - now) / 86400000);
|
|
222
|
+
if (diff < -1) return Math.abs(diff) + 'd ago';
|
|
223
|
+
if (diff === -1) return 'yesterday';
|
|
224
|
+
if (diff === 0) return 'today';
|
|
225
|
+
if (diff === 1) return 'tomorrow';
|
|
226
|
+
if (diff <= 7) return diff + 'd';
|
|
227
|
+
return d.toLocaleDateString('en', { month: 'short', day: 'numeric' });
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// -----------------------------------------------------------------------
|
|
231
|
+
// Grouping
|
|
232
|
+
// -----------------------------------------------------------------------
|
|
233
|
+
function groupItems(items) {
|
|
234
|
+
const today = getToday();
|
|
235
|
+
const weekEnd = getWeekEnd();
|
|
236
|
+
return {
|
|
237
|
+
overdue: items.filter(i => i.date && i.date < today && i.status !== 'COMPLETED'),
|
|
238
|
+
today: items.filter(i => i.date === today),
|
|
239
|
+
week: items.filter(i => i.date && i.date > today && i.date <= weekEnd),
|
|
240
|
+
upcoming: items.filter(i => i.date && i.date > weekEnd),
|
|
241
|
+
noDate: items.filter(i => !i.date),
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// -----------------------------------------------------------------------
|
|
246
|
+
// Rendering
|
|
247
|
+
// -----------------------------------------------------------------------
|
|
248
|
+
function renderItem(item, type) {
|
|
249
|
+
const today = getToday();
|
|
250
|
+
const isOverdue = item.date && item.date < today && item.status !== 'COMPLETED';
|
|
251
|
+
const isToday = item.date === today;
|
|
252
|
+
const isCompleted = item.status === 'COMPLETED';
|
|
253
|
+
|
|
254
|
+
const dotColor = isCompleted ? 'bg-emerald-400' : isOverdue ? 'bg-red-400' : isToday ? 'bg-amber-400' : 'bg-slate-500';
|
|
255
|
+
const dateLabel = opsRelativeDate(item.date);
|
|
256
|
+
const dateClass = isOverdue ? 'text-red-400' : isToday ? 'text-amber-400' : 'text-slate-500';
|
|
257
|
+
|
|
258
|
+
const desc = escapeHtml(item.description || '');
|
|
259
|
+
const idLabel = escapeHtml(item.id || '');
|
|
260
|
+
const category = type === 'reminder' && item.category ? escapeHtml(item.category) : '';
|
|
261
|
+
|
|
262
|
+
const moveLabel = type === 'reminder' ? '\u2192 NEXO' : '\u2190 User';
|
|
263
|
+
const moveDir = type === 'reminder' ? 'to_followup' : 'to_reminder';
|
|
264
|
+
|
|
265
|
+
const runBtn = type === 'followup'
|
|
266
|
+
? `<button onclick="executeItem('${item.id}')" class="text-xs px-2.5 py-1 rounded bg-pink-500/10 text-pink-400 hover:bg-pink-500/20 transition-colors">\u25b6 Run</button>`
|
|
267
|
+
: '';
|
|
268
|
+
|
|
269
|
+
const completedOpacity = isCompleted ? 'opacity-50' : '';
|
|
270
|
+
|
|
271
|
+
return `
|
|
272
|
+
<div class="bg-slate-900/50 border border-slate-800/50 rounded-lg p-4 group hover:border-slate-700 transition-colors ${completedOpacity}" data-id="${idLabel}">
|
|
273
|
+
<div class="flex items-start gap-2">
|
|
274
|
+
<div class="w-2 h-2 rounded-full mt-1.5 flex-shrink-0 ${dotColor}"></div>
|
|
275
|
+
<div class="flex-1 min-w-0">
|
|
276
|
+
<p class="text-sm text-slate-200 leading-relaxed line-clamp-2">${desc}</p>
|
|
277
|
+
<div class="flex items-center gap-2 mt-1.5 flex-wrap">
|
|
278
|
+
<span class="text-xs font-mono text-slate-600">${idLabel}</span>
|
|
279
|
+
${dateLabel ? `<span class="text-xs font-mono ${dateClass}">${dateLabel}</span>` : ''}
|
|
280
|
+
${category ? `<span class="text-xs px-1.5 py-0.5 rounded bg-slate-800 text-slate-500">${category}</span>` : ''}
|
|
281
|
+
${isCompleted ? `<span class="text-xs px-1.5 py-0.5 rounded bg-emerald-500/10 text-emerald-500">done</span>` : ''}
|
|
429
282
|
</div>
|
|
430
283
|
</div>
|
|
431
|
-
<div class="flex items-center gap-1 mt-2 opacity-0 group-hover:opacity-100 transition-opacity">
|
|
432
|
-
${!isCompleted ? `<button onclick="completeItem('${item.id}','${type}')" class="text-xs px-2.5 py-1 rounded bg-emerald-500/10 text-emerald-400 hover:bg-emerald-500/20 transition-colors">Done</button>` : ''}
|
|
433
|
-
<button onclick="editItem('${item.id}','${type}')" class="text-xs px-2.5 py-1 rounded bg-slate-800 text-slate-400 hover:bg-slate-700 transition-colors">Edit</button>
|
|
434
|
-
<button onclick="moveItem('${item.id}','${moveDir}')" class="text-xs px-2.5 py-1 rounded bg-violet-500/10 text-violet-400 hover:bg-violet-500/20 transition-colors">${moveLabel}</button>
|
|
435
|
-
${runBtn}
|
|
436
|
-
<button onclick="deleteItem('${item.id}','${type}')" class="text-xs px-2.5 py-1 rounded text-red-400/60 hover:bg-red-500/10 hover:text-red-400 transition-colors ml-auto">✕</button>
|
|
437
|
-
</div>
|
|
438
284
|
</div>
|
|
439
|
-
|
|
440
|
-
|
|
285
|
+
<div class="flex items-center gap-1 mt-2 opacity-0 group-hover:opacity-100 transition-opacity">
|
|
286
|
+
${!isCompleted ? `<button onclick="completeItem('${item.id}','${type}')" class="text-xs px-2.5 py-1 rounded bg-emerald-500/10 text-emerald-400 hover:bg-emerald-500/20 transition-colors">Done</button>` : ''}
|
|
287
|
+
<button onclick="editItem('${item.id}','${type}')" class="text-xs px-2.5 py-1 rounded bg-slate-800 text-slate-400 hover:bg-slate-700 transition-colors">Edit</button>
|
|
288
|
+
<button onclick="moveItem('${item.id}','${moveDir}')" class="text-xs px-2.5 py-1 rounded bg-violet-500/10 text-violet-400 hover:bg-violet-500/20 transition-colors">${moveLabel}</button>
|
|
289
|
+
${runBtn}
|
|
290
|
+
<button onclick="deleteItem('${item.id}','${type}')" class="text-xs px-2.5 py-1 rounded text-red-400/60 hover:bg-red-500/10 hover:text-red-400 transition-colors ml-auto">\u2715</button>
|
|
291
|
+
</div>
|
|
292
|
+
</div>
|
|
293
|
+
`;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
function renderGroupedItems(items, type, containerId) {
|
|
297
|
+
const container = document.getElementById(containerId);
|
|
298
|
+
const g = groupItems(items);
|
|
299
|
+
|
|
300
|
+
const groups = [
|
|
301
|
+
{ key: 'overdue', label: 'Overdue', color: 'text-red-400' },
|
|
302
|
+
{ key: 'today', label: 'Today', color: 'text-amber-400' },
|
|
303
|
+
{ key: 'week', label: 'This Week', color: 'text-violet-400' },
|
|
304
|
+
{ key: 'upcoming', label: 'Upcoming', color: 'text-slate-400' },
|
|
305
|
+
{ key: 'noDate', label: 'No Date', color: 'text-slate-600' },
|
|
306
|
+
];
|
|
307
|
+
|
|
308
|
+
let html = '';
|
|
309
|
+
let first = true;
|
|
310
|
+
groups.forEach(({ key, label, color }) => {
|
|
311
|
+
const list = g[key];
|
|
312
|
+
if (!list || list.length === 0) return;
|
|
313
|
+
const marginClass = first ? '' : 'mt-4';
|
|
314
|
+
html += `<div class="text-xs uppercase tracking-wider ${color} font-medium mb-2 ${marginClass}">${label} <span class="opacity-50">(${list.length})</span></div>`;
|
|
315
|
+
html += '<div class="space-y-2">' + list.map(i => renderItem(i, type)).join('') + '</div>';
|
|
316
|
+
first = false;
|
|
317
|
+
});
|
|
441
318
|
|
|
442
|
-
|
|
443
|
-
|
|
319
|
+
if (!html) {
|
|
320
|
+
html = '<div class="text-xs text-slate-600 font-mono py-8 text-center">No items</div>';
|
|
444
321
|
}
|
|
445
322
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
const g = groupItems(items);
|
|
449
|
-
|
|
450
|
-
const groups = [
|
|
451
|
-
{ key: 'overdue', label: 'Overdue', color: 'text-red-400' },
|
|
452
|
-
{ key: 'today', label: 'Today', color: 'text-amber-400' },
|
|
453
|
-
{ key: 'week', label: 'This Week', color: 'text-violet-400' },
|
|
454
|
-
{ key: 'upcoming', label: 'Upcoming', color: 'text-slate-400' },
|
|
455
|
-
{ key: 'noDate', label: 'No Date', color: 'text-slate-600' },
|
|
456
|
-
];
|
|
457
|
-
|
|
458
|
-
let html = '';
|
|
459
|
-
let first = true;
|
|
460
|
-
groups.forEach(({ key, label, color }) => {
|
|
461
|
-
const list = g[key];
|
|
462
|
-
if (!list || list.length === 0) return;
|
|
463
|
-
const marginClass = first ? '' : 'mt-4';
|
|
464
|
-
html += `<div class="text-xs uppercase tracking-wider ${color} font-medium mb-2 ${marginClass}">${label} <span class="opacity-50">(${list.length})</span></div>`;
|
|
465
|
-
html += '<div class="space-y-2">' + list.map(i => renderItem(i, type)).join('') + '</div>';
|
|
466
|
-
first = false;
|
|
467
|
-
});
|
|
468
|
-
|
|
469
|
-
if (!html) {
|
|
470
|
-
html = '<div class="text-xs text-slate-600 font-mono py-8 text-center">No items</div>';
|
|
471
|
-
}
|
|
323
|
+
container.innerHTML = html;
|
|
324
|
+
}
|
|
472
325
|
|
|
473
|
-
|
|
474
|
-
|
|
326
|
+
// -----------------------------------------------------------------------
|
|
327
|
+
// Data loading
|
|
328
|
+
// -----------------------------------------------------------------------
|
|
329
|
+
async function loadOpsData() {
|
|
330
|
+
const status = document.getElementById('ops-status').value;
|
|
331
|
+
const statusParam = status !== 'all' ? '?status=' + status : '';
|
|
475
332
|
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
const status = document.getElementById('ops-status').value;
|
|
481
|
-
const statusParam = status !== 'all' ? '?status=' + status : '';
|
|
482
|
-
|
|
483
|
-
const [remData, fupData, trustData, inboxData] = await Promise.all([
|
|
484
|
-
fetchJSON('/api/reminders' + statusParam),
|
|
485
|
-
fetchJSON('/api/followups' + statusParam),
|
|
486
|
-
fetchJSON('/api/trust'),
|
|
487
|
-
fetchJSON('/api/inbox/unread'),
|
|
488
|
-
]);
|
|
489
|
-
|
|
490
|
-
if (remData) {
|
|
491
|
-
allReminders = remData.reminders || [];
|
|
492
|
-
document.getElementById('reminder-count').textContent = allReminders.length;
|
|
493
|
-
}
|
|
494
|
-
if (fupData) {
|
|
495
|
-
allFollowups = fupData.followups || [];
|
|
496
|
-
document.getElementById('followup-count').textContent = allFollowups.length;
|
|
497
|
-
}
|
|
498
|
-
if (trustData) {
|
|
499
|
-
const score = (trustData.current_score ?? 0).toFixed(1);
|
|
500
|
-
document.getElementById('sidebar-trust').textContent = score;
|
|
501
|
-
}
|
|
502
|
-
if (inboxData) {
|
|
503
|
-
const total = inboxData.total || 0;
|
|
504
|
-
const badge = document.getElementById('inbox-badge');
|
|
505
|
-
if (total > 0) {
|
|
506
|
-
badge.textContent = total > 99 ? '99' : total;
|
|
507
|
-
badge.classList.remove('hidden');
|
|
508
|
-
badge.classList.add('flex');
|
|
509
|
-
} else {
|
|
510
|
-
badge.classList.add('hidden');
|
|
511
|
-
badge.classList.remove('flex');
|
|
512
|
-
}
|
|
513
|
-
}
|
|
333
|
+
const [remData, fupData] = await Promise.all([
|
|
334
|
+
fetchJSON('/api/reminders' + statusParam),
|
|
335
|
+
fetchJSON('/api/followups' + statusParam),
|
|
336
|
+
]);
|
|
514
337
|
|
|
515
|
-
|
|
338
|
+
if (remData) {
|
|
339
|
+
allReminders = remData.reminders || [];
|
|
340
|
+
document.getElementById('reminder-count').textContent = allReminders.length;
|
|
516
341
|
}
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
const filteredReminders = allReminders.filter(r =>
|
|
522
|
-
!search ||
|
|
523
|
-
(r.description || '').toLowerCase().includes(search) ||
|
|
524
|
-
(r.id || '').toLowerCase().includes(search) ||
|
|
525
|
-
(r.category || '').toLowerCase().includes(search)
|
|
526
|
-
);
|
|
527
|
-
const filteredFollowups = allFollowups.filter(f =>
|
|
528
|
-
!search ||
|
|
529
|
-
(f.description || '').toLowerCase().includes(search) ||
|
|
530
|
-
(f.id || '').toLowerCase().includes(search)
|
|
531
|
-
);
|
|
532
|
-
|
|
533
|
-
renderGroupedItems(filteredReminders, 'reminder', 'reminders-list');
|
|
534
|
-
renderGroupedItems(filteredFollowups, 'followup', 'followups-list');
|
|
342
|
+
if (fupData) {
|
|
343
|
+
allFollowups = fupData.followups || [];
|
|
344
|
+
document.getElementById('followup-count').textContent = allFollowups.length;
|
|
535
345
|
}
|
|
536
346
|
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
347
|
+
filterOps();
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
function filterOps() {
|
|
351
|
+
const search = (document.getElementById('ops-search').value || '').toLowerCase();
|
|
352
|
+
|
|
353
|
+
const filteredReminders = allReminders.filter(r =>
|
|
354
|
+
!search ||
|
|
355
|
+
(r.description || '').toLowerCase().includes(search) ||
|
|
356
|
+
(r.id || '').toLowerCase().includes(search) ||
|
|
357
|
+
(r.category || '').toLowerCase().includes(search)
|
|
358
|
+
);
|
|
359
|
+
const filteredFollowups = allFollowups.filter(f =>
|
|
360
|
+
!search ||
|
|
361
|
+
(f.description || '').toLowerCase().includes(search) ||
|
|
362
|
+
(f.id || '').toLowerCase().includes(search)
|
|
363
|
+
);
|
|
364
|
+
|
|
365
|
+
renderGroupedItems(filteredReminders, 'reminder', 'reminders-list');
|
|
366
|
+
renderGroupedItems(filteredFollowups, 'followup', 'followups-list');
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
// -----------------------------------------------------------------------
|
|
370
|
+
// Actions
|
|
371
|
+
// -----------------------------------------------------------------------
|
|
372
|
+
async function completeItem(id, type) {
|
|
373
|
+
try {
|
|
541
374
|
const url = type === 'reminder' ? '/api/reminders/' + id : '/api/followups/' + id;
|
|
542
375
|
const res = await fetch(url, {
|
|
543
376
|
method: 'PUT',
|
|
@@ -546,14 +379,18 @@
|
|
|
546
379
|
});
|
|
547
380
|
const data = await res.json();
|
|
548
381
|
if (data.success) {
|
|
549
|
-
|
|
382
|
+
opsToast('Completed ' + id);
|
|
550
383
|
loadOpsData();
|
|
551
384
|
} else {
|
|
552
|
-
|
|
385
|
+
opsToast(data.error || data.detail || 'Complete failed (HTTP ' + res.status + ')', 'error');
|
|
553
386
|
}
|
|
387
|
+
} catch (err) {
|
|
388
|
+
opsToast('Complete error: ' + err.message, 'error');
|
|
554
389
|
}
|
|
390
|
+
}
|
|
555
391
|
|
|
556
|
-
|
|
392
|
+
async function moveItem(id, direction) {
|
|
393
|
+
try {
|
|
557
394
|
const res = await fetch('/api/ops/move', {
|
|
558
395
|
method: 'POST',
|
|
559
396
|
headers: { 'Content-Type': 'application/json' },
|
|
@@ -561,165 +398,174 @@
|
|
|
561
398
|
});
|
|
562
399
|
const data = await res.json();
|
|
563
400
|
if (data.success) {
|
|
564
|
-
|
|
401
|
+
opsToast('Moved ' + id + ' to ' + (direction === 'to_followup' ? 'NEXO' : 'User'));
|
|
565
402
|
loadOpsData();
|
|
566
403
|
} else {
|
|
567
|
-
|
|
404
|
+
opsToast(data.error || data.detail || 'Move failed (HTTP ' + res.status + ')', 'error');
|
|
568
405
|
}
|
|
406
|
+
} catch (err) {
|
|
407
|
+
opsToast('Move error: ' + err.message, 'error');
|
|
569
408
|
}
|
|
409
|
+
}
|
|
570
410
|
|
|
571
|
-
|
|
411
|
+
async function executeItem(id) {
|
|
412
|
+
try {
|
|
572
413
|
const res = await fetch('/api/ops/execute/' + id, { method: 'POST' });
|
|
573
414
|
const data = await res.json();
|
|
574
415
|
if (data.success) {
|
|
575
|
-
|
|
416
|
+
opsToast('Executing ' + id, 'info');
|
|
576
417
|
} else {
|
|
577
|
-
|
|
418
|
+
opsToast(data.error || data.detail || 'Execute failed (HTTP ' + res.status + ')', 'error');
|
|
578
419
|
}
|
|
420
|
+
} catch (err) {
|
|
421
|
+
opsToast('Execute error: ' + err.message, 'error');
|
|
579
422
|
}
|
|
423
|
+
}
|
|
580
424
|
|
|
581
|
-
|
|
582
|
-
|
|
425
|
+
function deleteItem(id, type) {
|
|
426
|
+
pendingConfirmAction = async () => {
|
|
427
|
+
try {
|
|
583
428
|
const url = type === 'reminder' ? '/api/reminders/' + id : '/api/followups/' + id;
|
|
584
429
|
const res = await fetch(url, { method: 'DELETE' });
|
|
585
430
|
const data = await res.json();
|
|
586
431
|
if (data.success) {
|
|
587
|
-
|
|
432
|
+
opsToast('Deleted ' + id);
|
|
588
433
|
loadOpsData();
|
|
589
434
|
} else {
|
|
590
|
-
|
|
435
|
+
opsToast(data.error || data.detail || 'Delete failed (HTTP ' + res.status + ')', 'error');
|
|
591
436
|
}
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
437
|
+
} catch (err) {
|
|
438
|
+
opsToast('Delete error: ' + err.message, 'error');
|
|
439
|
+
}
|
|
440
|
+
};
|
|
441
|
+
document.getElementById('confirm-message').textContent = 'Delete ' + id + '? This cannot be undone.';
|
|
442
|
+
document.getElementById('confirm-modal').classList.remove('hidden');
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
function closeConfirm() {
|
|
446
|
+
document.getElementById('confirm-modal').classList.add('hidden');
|
|
447
|
+
pendingConfirmAction = null;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
function confirmAction() {
|
|
451
|
+
if (pendingConfirmAction) pendingConfirmAction();
|
|
452
|
+
closeConfirm();
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
// -----------------------------------------------------------------------
|
|
456
|
+
// Modal
|
|
457
|
+
// -----------------------------------------------------------------------
|
|
458
|
+
function openCreate(type) {
|
|
459
|
+
const form = document.getElementById('modal-form');
|
|
460
|
+
form.reset();
|
|
461
|
+
document.getElementById('modal-type').value = type;
|
|
462
|
+
document.getElementById('modal-edit-id').value = '';
|
|
463
|
+
document.getElementById('modal-title').textContent = type === 'reminder' ? 'New Reminder' : 'New Followup';
|
|
464
|
+
document.getElementById('modal-submit-btn').textContent = 'Create';
|
|
465
|
+
document.getElementById('category-group').classList.toggle('hidden', type !== 'reminder');
|
|
466
|
+
document.getElementById('verification-group').classList.toggle('hidden', type !== 'followup');
|
|
467
|
+
document.getElementById('reasoning-group').classList.toggle('hidden', type !== 'followup');
|
|
468
|
+
document.getElementById('ops-modal').classList.remove('hidden');
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
function editItem(id, type) {
|
|
472
|
+
const source = type === 'reminder' ? allReminders : allFollowups;
|
|
473
|
+
const item = source.find(i => i.id === id);
|
|
474
|
+
if (!item) return;
|
|
475
|
+
|
|
476
|
+
const form = document.getElementById('modal-form');
|
|
477
|
+
form.reset();
|
|
478
|
+
document.getElementById('modal-type').value = type;
|
|
479
|
+
document.getElementById('modal-edit-id').value = id;
|
|
480
|
+
document.getElementById('modal-title').textContent = 'Edit ' + id;
|
|
481
|
+
document.getElementById('modal-submit-btn').textContent = 'Save';
|
|
482
|
+
document.getElementById('category-group').classList.toggle('hidden', type !== 'reminder');
|
|
483
|
+
document.getElementById('verification-group').classList.toggle('hidden', type !== 'followup');
|
|
484
|
+
document.getElementById('reasoning-group').classList.toggle('hidden', type !== 'followup');
|
|
485
|
+
|
|
486
|
+
form.elements.description.value = item.description || '';
|
|
487
|
+
form.elements.date.value = item.date || '';
|
|
488
|
+
if (type === 'reminder' && item.category) {
|
|
489
|
+
form.elements.category.value = item.category;
|
|
600
490
|
}
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
closeConfirm();
|
|
491
|
+
if (type === 'followup') {
|
|
492
|
+
form.elements.verification.value = item.verification || '';
|
|
493
|
+
form.elements.reasoning.value = item.reasoning || '';
|
|
605
494
|
}
|
|
606
495
|
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
496
|
+
document.getElementById('ops-modal').classList.remove('hidden');
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
function closeModal() {
|
|
500
|
+
document.getElementById('ops-modal').classList.add('hidden');
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
async function submitForm(e) {
|
|
504
|
+
e.preventDefault();
|
|
505
|
+
const form = document.getElementById('modal-form');
|
|
506
|
+
const fd = new FormData(form);
|
|
507
|
+
const type = fd.get('type');
|
|
508
|
+
const editId = fd.get('edit_id');
|
|
509
|
+
const isEdit = !!editId;
|
|
510
|
+
|
|
511
|
+
let url, method, body;
|
|
512
|
+
|
|
513
|
+
if (type === 'reminder') {
|
|
514
|
+
url = isEdit ? '/api/reminders/' + editId : '/api/reminders';
|
|
515
|
+
method = isEdit ? 'PUT' : 'POST';
|
|
516
|
+
body = {
|
|
517
|
+
description: fd.get('description'),
|
|
518
|
+
date: fd.get('date') || null,
|
|
519
|
+
category: fd.get('category') || 'general'
|
|
520
|
+
};
|
|
521
|
+
} else {
|
|
522
|
+
url = isEdit ? '/api/followups/' + editId : '/api/followups';
|
|
523
|
+
method = isEdit ? 'PUT' : 'POST';
|
|
524
|
+
body = {
|
|
525
|
+
description: fd.get('description'),
|
|
526
|
+
date: fd.get('date') || null,
|
|
527
|
+
verification: fd.get('verification') || null,
|
|
528
|
+
reasoning: fd.get('reasoning') || null
|
|
529
|
+
};
|
|
621
530
|
}
|
|
622
531
|
|
|
623
|
-
|
|
624
|
-
const
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
document.getElementById('reasoning-group').classList.toggle('hidden', type !== 'followup');
|
|
637
|
-
|
|
638
|
-
form.elements.description.value = item.description || '';
|
|
639
|
-
form.elements.date.value = item.date || '';
|
|
640
|
-
if (type === 'reminder' && item.category) {
|
|
641
|
-
form.elements.category.value = item.category;
|
|
642
|
-
}
|
|
643
|
-
if (type === 'followup') {
|
|
644
|
-
form.elements.verification.value = item.verification || '';
|
|
645
|
-
form.elements.reasoning.value = item.reasoning || '';
|
|
532
|
+
try {
|
|
533
|
+
const res = await fetch(url, {
|
|
534
|
+
method,
|
|
535
|
+
headers: { 'Content-Type': 'application/json' },
|
|
536
|
+
body: JSON.stringify(body)
|
|
537
|
+
});
|
|
538
|
+
const data = await res.json();
|
|
539
|
+
if (data.success) {
|
|
540
|
+
opsToast(isEdit ? 'Updated ' + editId : 'Created successfully');
|
|
541
|
+
closeModal();
|
|
542
|
+
loadOpsData();
|
|
543
|
+
} else {
|
|
544
|
+
opsToast(data.error || data.detail || 'Save failed (HTTP ' + res.status + ')', 'error');
|
|
646
545
|
}
|
|
647
|
-
|
|
648
|
-
|
|
546
|
+
} catch (err) {
|
|
547
|
+
opsToast('Save error: ' + err.message, 'error');
|
|
649
548
|
}
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
// -----------------------------------------------------------------------
|
|
552
|
+
// Keyboard shortcuts
|
|
553
|
+
// -----------------------------------------------------------------------
|
|
554
|
+
document.addEventListener('keydown', function(e) {
|
|
555
|
+
if (e.key === 'Escape') {
|
|
556
|
+
closeModal();
|
|
557
|
+
closeConfirm();
|
|
653
558
|
}
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
e.
|
|
657
|
-
const form = document.getElementById('modal-form');
|
|
658
|
-
const fd = new FormData(form);
|
|
659
|
-
const type = fd.get('type');
|
|
660
|
-
const editId = fd.get('edit_id');
|
|
661
|
-
const isEdit = !!editId;
|
|
662
|
-
|
|
663
|
-
let url, method, body;
|
|
664
|
-
|
|
665
|
-
if (type === 'reminder') {
|
|
666
|
-
url = isEdit ? '/api/reminders/' + editId : '/api/reminders';
|
|
667
|
-
method = isEdit ? 'PUT' : 'POST';
|
|
668
|
-
body = {
|
|
669
|
-
description: fd.get('description'),
|
|
670
|
-
date: fd.get('date') || null,
|
|
671
|
-
category: fd.get('category') || 'general'
|
|
672
|
-
};
|
|
673
|
-
} else {
|
|
674
|
-
url = isEdit ? '/api/followups/' + editId : '/api/followups';
|
|
675
|
-
method = isEdit ? 'PUT' : 'POST';
|
|
676
|
-
body = {
|
|
677
|
-
description: fd.get('description'),
|
|
678
|
-
date: fd.get('date') || null,
|
|
679
|
-
verification: fd.get('verification') || null,
|
|
680
|
-
reasoning: fd.get('reasoning') || null
|
|
681
|
-
};
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
try {
|
|
685
|
-
const res = await fetch(url, {
|
|
686
|
-
method,
|
|
687
|
-
headers: { 'Content-Type': 'application/json' },
|
|
688
|
-
body: JSON.stringify(body)
|
|
689
|
-
});
|
|
690
|
-
const data = await res.json();
|
|
691
|
-
if (data.success) {
|
|
692
|
-
showToast(isEdit ? 'Updated ' + editId : 'Created successfully');
|
|
693
|
-
closeModal();
|
|
694
|
-
loadOpsData();
|
|
695
|
-
} else {
|
|
696
|
-
showToast(data.error || 'Failed', 'error');
|
|
697
|
-
}
|
|
698
|
-
} catch (err) {
|
|
699
|
-
showToast('Error: ' + err.message, 'error');
|
|
700
|
-
}
|
|
559
|
+
if (e.target.tagName !== 'INPUT' && e.target.tagName !== 'TEXTAREA' && e.target.tagName !== 'SELECT') {
|
|
560
|
+
if (e.key === 'r') openCreate('reminder');
|
|
561
|
+
if (e.key === 'f') openCreate('followup');
|
|
701
562
|
}
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
// R = new reminder, F = new followup (when not in input)
|
|
712
|
-
if (e.target.tagName !== 'INPUT' && e.target.tagName !== 'TEXTAREA' && e.target.tagName !== 'SELECT') {
|
|
713
|
-
if (e.key === 'r') openCreate('reminder');
|
|
714
|
-
if (e.key === 'f') openCreate('followup');
|
|
715
|
-
}
|
|
716
|
-
});
|
|
717
|
-
|
|
718
|
-
// -----------------------------------------------------------------------
|
|
719
|
-
// Init
|
|
720
|
-
// -----------------------------------------------------------------------
|
|
721
|
-
loadOpsData();
|
|
722
|
-
setInterval(loadOpsData, 60000);
|
|
723
|
-
</script>
|
|
724
|
-
</body>
|
|
725
|
-
</html>
|
|
563
|
+
});
|
|
564
|
+
|
|
565
|
+
// -----------------------------------------------------------------------
|
|
566
|
+
// Init
|
|
567
|
+
// -----------------------------------------------------------------------
|
|
568
|
+
loadOpsData();
|
|
569
|
+
setInterval(loadOpsData, 60000);
|
|
570
|
+
</script>
|
|
571
|
+
{% endblock %}
|