25 lines
836 B
Lua
25 lines
836 B
Lua
|
|
-- Notification queue uses memory keys "notif.0".."notif.N" (rolling, max 30).
|
||
|
|
-- Producers (scheduler/macros/llm fallback) call jarvis.memory.remember "notif.<ts>" elsewhere.
|
||
|
|
-- Here we just enumerate and speak.
|
||
|
|
local all = jarvis.memory.all()
|
||
|
|
local notifs = {}
|
||
|
|
for _, rec in ipairs(all) do
|
||
|
|
if rec.key:sub(1, 6) == "notif." then
|
||
|
|
table.insert(notifs, { ts = rec.last_used_at or 0, key = rec.key, value = rec.value })
|
||
|
|
end
|
||
|
|
end
|
||
|
|
|
||
|
|
if #notifs == 0 then
|
||
|
|
return jarvis.cmd.ok("Ничего не пропустил.")
|
||
|
|
end
|
||
|
|
|
||
|
|
-- Sort by timestamp desc
|
||
|
|
table.sort(notifs, function(a, b) return a.ts > b.ts end)
|
||
|
|
|
||
|
|
local sample = math.min(#notifs, 5)
|
||
|
|
local line = string.format("Пропущено %d уведомлений. ", #notifs)
|
||
|
|
for i = 1, sample do
|
||
|
|
line = line .. notifs[i].value .. ". "
|
||
|
|
end
|
||
|
|
return jarvis.cmd.ok(line)
|