nexo-brain 2.7.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/README.md +66 -12
  3. package/hooks/hooks.json +79 -0
  4. package/package.json +1 -1
  5. package/src/agent_runner.py +295 -7
  6. package/src/cli.py +111 -0
  7. package/src/client_preferences.py +99 -1
  8. package/src/client_sync.py +207 -3
  9. package/src/cognitive/__init__.py +1 -1
  10. package/src/cognitive/_search.py +39 -19
  11. package/src/dashboard/app.py +141 -1
  12. package/src/dashboard/templates/base.html +4 -0
  13. package/src/dashboard/templates/protocol.html +199 -0
  14. package/src/db/__init__.py +23 -1
  15. package/src/db/_learnings.py +31 -4
  16. package/src/db/_personal_scripts.py +12 -0
  17. package/src/db/_protocol.py +303 -0
  18. package/src/db/_schema.py +248 -0
  19. package/src/db/_watchers.py +173 -0
  20. package/src/db/_workflow.py +952 -0
  21. package/src/doctor/providers/boot.py +45 -19
  22. package/src/doctor/providers/runtime.py +923 -8
  23. package/src/evolution_cycle.py +62 -0
  24. package/src/hook_guardrails.py +308 -0
  25. package/src/hooks/protocol-guardrail.sh +10 -0
  26. package/src/nexo_sdk.py +103 -0
  27. package/src/plugins/cognitive_memory.py +18 -0
  28. package/src/plugins/cortex.py +55 -35
  29. package/src/plugins/guard.py +132 -16
  30. package/src/plugins/protocol.py +911 -0
  31. package/src/plugins/schedule.py +40 -6
  32. package/src/plugins/simple_api.py +103 -0
  33. package/src/plugins/skills.py +67 -0
  34. package/src/plugins/state_watchers.py +79 -0
  35. package/src/plugins/workflow.py +588 -0
  36. package/src/public_contribution.py +86 -12
  37. package/src/requirements.txt +1 -0
  38. package/src/script_registry.py +142 -0
  39. package/src/scripts/deep-sleep/apply_findings.py +204 -0
  40. package/src/scripts/deep-sleep/collect.py +49 -4
  41. package/src/scripts/nexo-agent-run.py +2 -0
  42. package/src/scripts/nexo-daily-self-audit.py +843 -5
  43. package/src/scripts/nexo-evolution-run.py +343 -1
  44. package/src/server.py +92 -6
  45. package/src/skills_runtime.py +151 -0
  46. package/src/state_watchers_runtime.py +334 -0
  47. package/src/tools_learnings.py +345 -7
  48. package/src/tools_sessions.py +183 -0
  49. package/templates/CLAUDE.md.template +9 -1
  50. package/templates/CODEX.AGENTS.md.template +10 -2
@@ -148,37 +148,63 @@ def check_python_runtime() -> DoctorCheck:
148
148
  )
149
149
 
150
150
 
151
+ CRITICAL_CONFIG_FILES = (
152
+ ("schedule.json", ("config", "schedule.json")),
153
+ ("optionals.json", ("config", "optionals.json")),
154
+ ("crons/manifest.json", ("crons", "manifest.json")),
155
+ )
156
+
157
+
151
158
  def check_config_parse() -> DoctorCheck:
152
- """Check schedule.json parses correctly if present."""
153
- schedule_file = NEXO_HOME / "config" / "schedule.json"
154
- if not schedule_file.exists():
159
+ """Validate that critical JSON config files parse correctly."""
160
+ import json
161
+
162
+ errors: list[str] = []
163
+ checked: list[str] = []
164
+
165
+ for label, relative in CRITICAL_CONFIG_FILES:
166
+ path = NEXO_HOME.joinpath(*relative)
167
+ if not path.exists():
168
+ continue
169
+ try:
170
+ data = json.loads(path.read_text())
171
+ except Exception as exc:
172
+ errors.append(f"{label}: {exc}")
173
+ continue
174
+ if not isinstance(data, dict):
175
+ errors.append(f"{label}: expected JSON object, got {type(data).__name__}")
176
+ continue
177
+ checked.append(label)
178
+
179
+ if errors:
155
180
  return DoctorCheck(
156
181
  id="boot.config_parse",
157
182
  tier="boot",
158
- status="healthy",
159
- severity="info",
160
- summary="No schedule.json (using defaults)",
183
+ status="degraded",
184
+ severity="warn",
185
+ summary=f"{len(errors)} config file parse error" + ("s" if len(errors) != 1 else ""),
186
+ evidence=errors,
187
+ repair_plan=["Fix JSON syntax in the listed config files, or delete them to fall back to defaults"],
161
188
  )
162
- try:
163
- import json
164
- json.loads(schedule_file.read_text())
189
+
190
+ if not checked:
165
191
  return DoctorCheck(
166
192
  id="boot.config_parse",
167
193
  tier="boot",
168
194
  status="healthy",
169
195
  severity="info",
170
- summary="schedule.json parses OK",
171
- )
172
- except Exception as e:
173
- return DoctorCheck(
174
- id="boot.config_parse",
175
- tier="boot",
176
- status="degraded",
177
- severity="warn",
178
- summary=f"schedule.json parse error: {e}",
179
- repair_plan=["Fix JSON syntax in schedule.json or delete to use defaults"],
196
+ summary="No config files present (using defaults)",
180
197
  )
181
198
 
199
+ return DoctorCheck(
200
+ id="boot.config_parse",
201
+ tier="boot",
202
+ status="healthy",
203
+ severity="info",
204
+ summary=f"{len(checked)} config file" + ("s" if len(checked) != 1 else "") + " parse OK",
205
+ evidence=checked,
206
+ )
207
+
182
208
 
183
209
  def run_boot_checks(fix: bool = False) -> list[DoctorCheck]:
184
210
  """Run all boot-tier checks."""