superlocalmemory 3.7.1 → 3.7.3

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 (32) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +16 -8
  3. package/package.json +1 -1
  4. package/plugin/.claude-plugin/plugin.json +1 -1
  5. package/plugin/requirements.txt +1 -1
  6. package/plugin/scripts/slm-launch +11 -3
  7. package/plugin/scripts/slm-launch.bat +8 -2
  8. package/plugin-src/manifest.json +1 -1
  9. package/plugin-src/requirements.txt +1 -1
  10. package/plugin-src/scripts/slm-launch +11 -3
  11. package/plugin-src/scripts/slm-launch.bat +8 -2
  12. package/pyproject.toml +1 -1
  13. package/src/superlocalmemory/__init__.py +1 -1
  14. package/src/superlocalmemory/cli/main.py +2 -2
  15. package/src/superlocalmemory/cli/scale_engine_cmd.py +13 -1
  16. package/src/superlocalmemory/core/backend_orchestrator.py +15 -0
  17. package/src/superlocalmemory/core/embedding_worker.py +7 -1
  18. package/src/superlocalmemory/core/embeddings.py +8 -0
  19. package/src/superlocalmemory/core/engine.py +1 -3
  20. package/src/superlocalmemory/core/engine_wiring.py +0 -5
  21. package/src/superlocalmemory/core/ram_lock.py +42 -4
  22. package/src/superlocalmemory/core/scale_engine.py +450 -35
  23. package/src/superlocalmemory/evolution/budget.py +43 -8
  24. package/src/superlocalmemory/hooks/claude_code_hooks.py +2 -1
  25. package/src/superlocalmemory/hooks/context_payload.py +2 -1
  26. package/src/superlocalmemory/mcp/http_transport.py +2 -1
  27. package/src/superlocalmemory/mcp/tools_core.py +46 -29
  28. package/src/superlocalmemory/mesh/broker.py +111 -61
  29. package/src/superlocalmemory/optimize/proxy/server.py +2 -1
  30. package/src/superlocalmemory/retrieval/spreading_activation.py +53 -3
  31. package/src/superlocalmemory/server/routes/brain.py +2 -1
  32. package/src/superlocalmemory/server/unified_daemon.py +24 -7
@@ -2138,18 +2138,33 @@ def _register_daemon_routes(application: FastAPI) -> None:
2138
2138
  ))
2139
2139
 
2140
2140
  result = command.materialize(receipt.operation_id) if wait else receipt
2141
- if result.state is IngestionState.FAILED:
2142
- raise RuntimeError(result.last_error or "materialization failed")
2143
-
2144
2141
  fact_ids = list(result.fact_ids)
2142
+ # The queryable write is a separate durable transaction. A cold
2143
+ # optional enrichment dependency (most often the local embedding
2144
+ # worker) may need its bounded retry window, but must not turn an
2145
+ # already-admitted fact into an HTTP 500. Keep the operation's
2146
+ # failed state truthful so the daemon materializer retries it; the
2147
+ # response communicates that the fact is queryable, not complete.
2148
+ enrichment_deferred = (
2149
+ result.state is IngestionState.FAILED and bool(fact_ids)
2150
+ )
2151
+ if result.state is IngestionState.FAILED and not enrichment_deferred:
2152
+ raise RuntimeError(result.last_error or "materialization failed")
2153
+ completed = result.state is IngestionState.COMPLETE
2145
2154
  _emit_event(
2146
- "memory.stored" if wait else "memory.queued",
2155
+ "memory.stored" if completed else "memory.queued",
2147
2156
  payload={
2148
2157
  "operation_id": result.operation_id,
2149
2158
  "fact_ids": fact_ids,
2150
2159
  "tags": req.tags or "",
2151
2160
  "content_preview": req.content[:120],
2152
- "path": "remember_sync" if wait else "remember_queryable",
2161
+ "path": (
2162
+ "remember_sync"
2163
+ if completed
2164
+ else "remember_sync_deferred"
2165
+ if enrichment_deferred
2166
+ else "remember_queryable"
2167
+ ),
2153
2168
  },
2154
2169
  )
2155
2170
  return {
@@ -2160,11 +2175,13 @@ def _register_daemon_routes(application: FastAPI) -> None:
2160
2175
  # One-release compatibility alias. The durable operation ID is
2161
2176
  # opaque and replaces the integer pending.db row identifier.
2162
2177
  "pending_id": result.operation_id,
2163
- "status": "stored" if wait else "queryable",
2178
+ "status": "stored" if completed else "queryable",
2164
2179
  "materialization_state": result.state.value,
2165
2180
  "note": (
2166
2181
  "canonical ingestion complete"
2167
- if wait
2182
+ if completed
2183
+ else "queryable now; canonical enrichment will retry"
2184
+ if enrichment_deferred
2168
2185
  else "queryable now; canonical enrichment pending"
2169
2186
  ),
2170
2187
  }