nexo-brain 7.31.3 → 7.31.5
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/README.md +2 -2
- package/package.json +1 -1
- package/src/db/_memory_v2.py +27 -0
- package/src/managed_mcp/lock.json +3 -3
- package/src/memory_retrieval.py +40 -0
- package/src/provider_circuit_breaker.py +20 -1
- package/src/scripts/nexo-email-monitor.py +47 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nexo-brain",
|
|
3
|
-
"version": "7.31.
|
|
3
|
+
"version": "7.31.5",
|
|
4
4
|
"description": "Local cognitive runtime for Claude Code \u2014 persistent memory, overnight learning, doctor diagnostics, personal scripts, recovery-aware jobs, startup preflight, and optional dashboard/power helper.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "NEXO Brain",
|
package/README.md
CHANGED
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
|
|
19
19
|
[Watch the overview video](https://nexo-brain.com/watch/) · [Watch on YouTube](https://www.youtube.com/watch?v=i2lkGhKyVqI) · [Open the infographic](https://nexo-brain.com/assets/nexo-brain-infographic-v5.png)
|
|
20
20
|
|
|
21
|
-
Version `7.31.
|
|
21
|
+
Version `7.31.5` is the current packaged-runtime line. Patch release over v7.31.4 - the breaker resume notice exists: when a notified engine pause recovers, the operator gets exactly one resume email in their language, signed by their agent.
|
|
22
22
|
|
|
23
|
-
Previously in `7.31.
|
|
23
|
+
Previously in `7.31.4`: patch release over v7.31.3 - memory recall honours absolute time ranges (ISO dates, start..end ranges, datetimes, epochs) and enforces the window in SQL, so asking about a specific past day returns that day.
|
|
24
24
|
|
|
25
25
|
Previously in `7.30.33`: patch release over v7.30.32 - personal agent/script status now keeps the newest real run between manual executions and cron history, so a successful manual agent run cannot be hidden behind an older scheduled failure.
|
|
26
26
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nexo-brain",
|
|
3
|
-
"version": "7.31.
|
|
3
|
+
"version": "7.31.5",
|
|
4
4
|
"mcpName": "io.github.wazionapps/nexo",
|
|
5
5
|
"description": "NEXO Brain — Shared brain for AI agents. Persistent memory, semantic RAG, natural forgetting, metacognitive guard, trust scoring, 150+ MCP tools. Works with Claude Code, Codex, Claude Desktop & any MCP client. 100% local, free.",
|
|
6
6
|
"homepage": "https://nexo-brain.com",
|
package/src/db/_memory_v2.py
CHANGED
|
@@ -750,12 +750,23 @@ def list_memory_events(
|
|
|
750
750
|
session_id: str = "",
|
|
751
751
|
project_key: str = "",
|
|
752
752
|
limit: int = 20,
|
|
753
|
+
start_ts: float | None = None,
|
|
754
|
+
end_ts: float | None = None,
|
|
753
755
|
) -> list[dict]:
|
|
754
756
|
conn = _core().get_db()
|
|
755
757
|
if not _table_exists(conn, "memory_events"):
|
|
756
758
|
return []
|
|
757
759
|
clauses = ["1=1"]
|
|
758
760
|
params: list[Any] = []
|
|
761
|
+
# time_range push-down (ff78ff94): bounds must constrain the SQL fetch
|
|
762
|
+
# itself — Python-side filtering after a recency-truncated fetch made old
|
|
763
|
+
# windows return nothing.
|
|
764
|
+
if start_ts is not None:
|
|
765
|
+
clauses.append("created_at >= ?")
|
|
766
|
+
params.append(float(start_ts))
|
|
767
|
+
if end_ts is not None:
|
|
768
|
+
clauses.append("created_at < ?")
|
|
769
|
+
params.append(float(end_ts))
|
|
759
770
|
if event_type.strip():
|
|
760
771
|
clauses.append("event_type = ?")
|
|
761
772
|
params.append(event_type.strip().lower())
|
|
@@ -798,12 +809,20 @@ def list_memory_observations(
|
|
|
798
809
|
project_key: str = "",
|
|
799
810
|
status: str = "",
|
|
800
811
|
limit: int = 20,
|
|
812
|
+
start_ts: float | None = None,
|
|
813
|
+
end_ts: float | None = None,
|
|
801
814
|
) -> list[dict]:
|
|
802
815
|
conn = _core().get_db()
|
|
803
816
|
if not _table_exists(conn, "memory_observations"):
|
|
804
817
|
return []
|
|
805
818
|
clauses = ["1=1"]
|
|
806
819
|
params: list[Any] = []
|
|
820
|
+
if start_ts is not None:
|
|
821
|
+
clauses.append("created_at >= ?")
|
|
822
|
+
params.append(float(start_ts))
|
|
823
|
+
if end_ts is not None:
|
|
824
|
+
clauses.append("created_at < ?")
|
|
825
|
+
params.append(float(end_ts))
|
|
807
826
|
if observation_type.strip():
|
|
808
827
|
clauses.append("observation_type = ?")
|
|
809
828
|
params.append(observation_type.strip().lower())
|
|
@@ -845,6 +864,8 @@ def search_memory_observations_fts(
|
|
|
845
864
|
*,
|
|
846
865
|
project_key: str = "",
|
|
847
866
|
limit: int = 20,
|
|
867
|
+
start_ts: float | None = None,
|
|
868
|
+
end_ts: float | None = None,
|
|
848
869
|
) -> list[dict]:
|
|
849
870
|
conn = _core().get_db()
|
|
850
871
|
if not _table_exists(conn, "memory_observations_fts"):
|
|
@@ -859,6 +880,12 @@ def search_memory_observations_fts(
|
|
|
859
880
|
WHERE memory_observations_fts MATCH ?
|
|
860
881
|
"""
|
|
861
882
|
params: list[Any] = [fts]
|
|
883
|
+
if start_ts is not None:
|
|
884
|
+
sql += " AND o.created_at >= ?"
|
|
885
|
+
params.append(float(start_ts))
|
|
886
|
+
if end_ts is not None:
|
|
887
|
+
sql += " AND o.created_at < ?"
|
|
888
|
+
params.append(float(end_ts))
|
|
862
889
|
if project_key.strip():
|
|
863
890
|
sql += " AND o.project_key = ?"
|
|
864
891
|
params.append(project_key.strip())
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
"open-computer-use": {
|
|
40
40
|
"source_type": "npm",
|
|
41
41
|
"package": "open-computer-use",
|
|
42
|
-
"version": "0.1.
|
|
43
|
-
"integrity": "sha512-
|
|
44
|
-
"tarball": "https://registry.npmjs.org/open-computer-use/-/open-computer-use-0.1.
|
|
42
|
+
"version": "0.1.53",
|
|
43
|
+
"integrity": "sha512-5qwCPl7Gm4Wk2i/wFkq2dVLN2SzNRQSJTd95zXdGF+u5ZsUXkFx1IFVdNbYelWOpc4fgy8Z8/gYrbacj/2chig==",
|
|
44
|
+
"tarball": "https://registry.npmjs.org/open-computer-use/-/open-computer-use-0.1.53.tgz",
|
|
45
45
|
"bin": "open-computer-use-mcp",
|
|
46
46
|
"engines": {}
|
|
47
47
|
},
|
package/src/memory_retrieval.py
CHANGED
|
@@ -82,6 +82,40 @@ def _parse_time_range(value: str = "") -> tuple[float | None, float | None, str]
|
|
|
82
82
|
unit = match.group(2)
|
|
83
83
|
delta = timedelta(hours=amount) if unit.startswith("h") else timedelta(days=amount)
|
|
84
84
|
return (now - delta).timestamp(), now.timestamp(), clean
|
|
85
|
+
|
|
86
|
+
# Operator bug (session ff78ff94, 11-jun): absolute values silently fell
|
|
87
|
+
# through to (None, None, "") which DISABLED the filter — asking for a
|
|
88
|
+
# specific past day returned the most recent events instead. Support ISO
|
|
89
|
+
# dates, ISO ranges (date end is inclusive: bound = next midnight), ISO
|
|
90
|
+
# datetimes, and epoch seconds / epoch ranges.
|
|
91
|
+
def _point(text, *, end_of_day=False):
|
|
92
|
+
text = text.strip()
|
|
93
|
+
if re.fullmatch(r"\d{9,}(\.\d+)?", text):
|
|
94
|
+
return float(text), False
|
|
95
|
+
try:
|
|
96
|
+
if re.fullmatch(r"\d{4}-\d{2}-\d{2}", text):
|
|
97
|
+
day = datetime.fromisoformat(text)
|
|
98
|
+
if end_of_day:
|
|
99
|
+
return (day + timedelta(days=1)).timestamp(), True
|
|
100
|
+
return day.timestamp(), True
|
|
101
|
+
return datetime.fromisoformat(text).timestamp(), False
|
|
102
|
+
except ValueError:
|
|
103
|
+
return None, False
|
|
104
|
+
|
|
105
|
+
if ".." in clean:
|
|
106
|
+
left, _, right = clean.partition("..")
|
|
107
|
+
start_ts, _ = _point(left)
|
|
108
|
+
end_ts, _ = _point(right, end_of_day=True)
|
|
109
|
+
if start_ts is not None and end_ts is not None and end_ts > start_ts:
|
|
110
|
+
return start_ts, end_ts, f"range:{clean}"
|
|
111
|
+
return None, None, ""
|
|
112
|
+
|
|
113
|
+
point_ts, is_date = _point(clean)
|
|
114
|
+
if point_ts is not None:
|
|
115
|
+
if is_date:
|
|
116
|
+
return point_ts, point_ts + 86400, f"day:{clean}"
|
|
117
|
+
# Single datetime/epoch: a one-hour window centred forward.
|
|
118
|
+
return point_ts, point_ts + 3600, f"at:{clean}"
|
|
85
119
|
return None, None, ""
|
|
86
120
|
|
|
87
121
|
|
|
@@ -177,6 +211,8 @@ def memory_search(
|
|
|
177
211
|
clean_query,
|
|
178
212
|
project_key="",
|
|
179
213
|
limit=max_items * 3,
|
|
214
|
+
start_ts=start,
|
|
215
|
+
end_ts=end,
|
|
180
216
|
):
|
|
181
217
|
uid = item.get("observation_uid") or f"id:{item.get('id')}"
|
|
182
218
|
observations_by_uid[uid] = item
|
|
@@ -184,6 +220,8 @@ def memory_search(
|
|
|
184
220
|
query=clean_query,
|
|
185
221
|
project_key="",
|
|
186
222
|
limit=max_items * 3,
|
|
223
|
+
start_ts=start,
|
|
224
|
+
end_ts=end,
|
|
187
225
|
):
|
|
188
226
|
uid = item.get("observation_uid") or f"id:{item.get('id')}"
|
|
189
227
|
observations_by_uid.setdefault(uid, item)
|
|
@@ -192,6 +230,8 @@ def memory_search(
|
|
|
192
230
|
query=clean_query,
|
|
193
231
|
project_key="",
|
|
194
232
|
limit=max_items * 3,
|
|
233
|
+
start_ts=start,
|
|
234
|
+
end_ts=end,
|
|
195
235
|
)
|
|
196
236
|
|
|
197
237
|
candidates = [
|
|
@@ -51,7 +51,8 @@ DEFAULT_RETRY_AFTER_S = {
|
|
|
51
51
|
_FAILURE_PATTERNS = (
|
|
52
52
|
("credits", re.compile(
|
|
53
53
|
r"credit balance is too low|insufficient[_ ]quota|exceeded your current quota"
|
|
54
|
-
r"|billing hard limit|out of credits|usage limit reached|
|
|
54
|
+
r"|billing hard limit|out of credits|usage limit reached|hit your usage limit"
|
|
55
|
+
r"|purchase more credits|plan limits",
|
|
55
56
|
re.I)),
|
|
56
57
|
("rate_limit", re.compile(
|
|
57
58
|
r"rate[_ -]?limit|too many requests|\b429\b|overloaded[_ ]error|\b529\b"
|
|
@@ -189,6 +190,9 @@ def record_session_outcome(
|
|
|
189
190
|
"consecutive_failures": 0,
|
|
190
191
|
"closed_at": _now(),
|
|
191
192
|
"recovered_from": entry.get("reason") if was_open else None,
|
|
193
|
+
# The pause email promises "another notice when work resumes":
|
|
194
|
+
# arm that notice only when the OPENING was actually notified.
|
|
195
|
+
"resume_notice_pending": bool(was_open and entry.get("operator_notified_at")),
|
|
192
196
|
}
|
|
193
197
|
_save_state(state)
|
|
194
198
|
return state[backend]
|
|
@@ -212,6 +216,21 @@ def record_session_outcome(
|
|
|
212
216
|
return entry
|
|
213
217
|
|
|
214
218
|
|
|
219
|
+
def should_notify_operator_resumed(backend: str) -> bool:
|
|
220
|
+
"""True exactly once after a notified opening closes (engine resumed).
|
|
221
|
+
|
|
222
|
+
The pause notice tells the operator "you will get another notice when
|
|
223
|
+
work resumes" — this is that notice's gate. Clears the flag on read.
|
|
224
|
+
"""
|
|
225
|
+
state = _load_state()
|
|
226
|
+
entry = _entry(state, backend)
|
|
227
|
+
if entry.get("state") == "closed" and entry.get("resume_notice_pending"):
|
|
228
|
+
entry["resume_notice_pending"] = False
|
|
229
|
+
_save_state(state)
|
|
230
|
+
return True
|
|
231
|
+
return False
|
|
232
|
+
|
|
233
|
+
|
|
215
234
|
def should_notify_operator(backend: str) -> bool:
|
|
216
235
|
"""True exactly once per opening — callers use it to send ONE notice."""
|
|
217
236
|
state = _load_state()
|
|
@@ -2443,6 +2443,52 @@ def _decrement_attempts(email_ids):
|
|
|
2443
2443
|
log.warning(f"Failed to decrement attempts: {e}")
|
|
2444
2444
|
|
|
2445
2445
|
|
|
2446
|
+
def _notify_provider_breaker_resumed_once():
|
|
2447
|
+
"""Send the resume notice the pause email promises — once per recovery."""
|
|
2448
|
+
try:
|
|
2449
|
+
from provider_circuit_breaker import should_notify_operator_resumed
|
|
2450
|
+
for backend in ("claude_code", "codex"):
|
|
2451
|
+
if not should_notify_operator_resumed(backend):
|
|
2452
|
+
continue
|
|
2453
|
+
operator_name, assistant_name, operator_language = _get_operator_info()
|
|
2454
|
+
config = load_config()
|
|
2455
|
+
operator_email = config.get("operator_email", "") if config else ""
|
|
2456
|
+
if not operator_email:
|
|
2457
|
+
return
|
|
2458
|
+
if _uses_spanish(operator_language):
|
|
2459
|
+
subject = f"[{assistant_name}] Motor {backend} reanudado"
|
|
2460
|
+
body = (
|
|
2461
|
+
f"Hola {operator_name},\n\n"
|
|
2462
|
+
f"El motor {backend} vuelve a estar disponible y he reanudado las automatizaciones.\n\n"
|
|
2463
|
+
"La cola pendiente se está procesando ya, en orden. No tienes que hacer nada.\n\n"
|
|
2464
|
+
f"— {assistant_name}"
|
|
2465
|
+
)
|
|
2466
|
+
else:
|
|
2467
|
+
subject = f"[{assistant_name}] Engine {backend} resumed"
|
|
2468
|
+
body = (
|
|
2469
|
+
f"Hello {operator_name},\n\n"
|
|
2470
|
+
f"The {backend} engine is available again and I have resumed the automations.\n\n"
|
|
2471
|
+
"The pending queue is being processed now, in order. Nothing is needed from you.\n\n"
|
|
2472
|
+
f"— {assistant_name}"
|
|
2473
|
+
)
|
|
2474
|
+
body_file = BASE_DIR / ".breaker-resume-body.txt"
|
|
2475
|
+
body_file.write_text(body, encoding="utf-8")
|
|
2476
|
+
send_script = get_send_reply_script_path(local_script_dir=_script_dir)
|
|
2477
|
+
subprocess.run(
|
|
2478
|
+
[
|
|
2479
|
+
sys.executable, str(send_script),
|
|
2480
|
+
"--to", f"{operator_name} <{operator_email}>",
|
|
2481
|
+
"--subject", subject,
|
|
2482
|
+
"--body-file", str(body_file),
|
|
2483
|
+
],
|
|
2484
|
+
timeout=30,
|
|
2485
|
+
capture_output=True,
|
|
2486
|
+
)
|
|
2487
|
+
log.info(f"Breaker resume notice sent for {backend}")
|
|
2488
|
+
except Exception as e:
|
|
2489
|
+
log.warning(f"Breaker resume notice failed: {e}")
|
|
2490
|
+
|
|
2491
|
+
|
|
2446
2492
|
def _notify_provider_breaker_open_once(error):
|
|
2447
2493
|
"""Fase 1.6 — ONE operator notice per breaker opening, in their language.
|
|
2448
2494
|
|
|
@@ -2675,6 +2721,7 @@ def main():
|
|
|
2675
2721
|
backoff_state = load_empty_inbox_backoff_state()
|
|
2676
2722
|
debt_block = scan_debt()
|
|
2677
2723
|
|
|
2724
|
+
_notify_provider_breaker_resumed_once()
|
|
2678
2725
|
reconcile_orphaned_seen(config, hours=24)
|
|
2679
2726
|
reconcile_terminal_unseen(config, hours=48)
|
|
2680
2727
|
# Recovery window widened from 24h to 7 days (168h): a single email can
|