superlocalmemory 4.1.13 → 4.1.15
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/marketplace.json +2 -2
- package/CHANGELOG.md +103 -0
- package/README.md +3 -3
- package/package.json +1 -8
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/CLAUDE.md +3 -3
- package/plugin/agents/slm-governance-advisor.md +1 -1
- package/plugin/agents/slm-loop-runner.md +1 -1
- package/plugin/agents/slm-memory-advisor.md +1 -1
- package/plugin/agents/slm-optimize-advisor.md +1 -1
- package/plugin/requirements.txt +1 -1
- package/plugin/skills/slm-cache/SKILL.md +1 -1
- package/plugin/skills/slm-compress/SKILL.md +1 -1
- package/plugin/skills/slm-governance/SKILL.md +1 -1
- package/plugin/skills/slm-graph/SKILL.md +1 -1
- package/plugin/skills/slm-loop/SKILL.md +1 -1
- package/plugin/skills/slm-mesh/SKILL.md +1 -1
- package/plugin/skills/slm-profile/SKILL.md +1 -1
- package/plugin/skills/slm-recall/SKILL.md +1 -1
- package/plugin/skills/slm-remember/SKILL.md +1 -1
- package/plugin/skills/slm-scope/SKILL.md +1 -1
- package/plugin/skills/slm-session/SKILL.md +1 -1
- package/plugin/skills/slm-status/SKILL.md +1 -1
- package/plugin-src/agents/slm-memory-advisor.md +1 -1
- package/plugin-src/agents/slm-optimize-advisor.md +1 -1
- package/plugin-src/rules/AGENTS.md +1 -1
- package/plugin-src/skills/slm-cache/SKILL.md +1 -1
- package/plugin-src/skills/slm-compress/SKILL.md +1 -1
- package/plugin-src/skills/slm-governance/SKILL.md +1 -1
- package/plugin-src/skills/slm-graph/SKILL.md +1 -1
- package/plugin-src/skills/slm-loop/SKILL.md +1 -1
- package/plugin-src/skills/slm-mesh/SKILL.md +1 -1
- package/plugin-src/skills/slm-profile/SKILL.md +1 -1
- package/plugin-src/skills/slm-recall/SKILL.md +1 -1
- package/plugin-src/skills/slm-remember/SKILL.md +1 -1
- package/plugin-src/skills/slm-scope/SKILL.md +1 -1
- package/plugin-src/skills/slm-session/SKILL.md +1 -1
- package/plugin-src/skills/slm-status/SKILL.md +1 -1
- package/scripts/postinstall.js +71 -2
- package/pyproject.toml +0 -250
- package/src/superlocalmemory/__init__.py +0 -82
- package/src/superlocalmemory/access/__init__.py +0 -3
- package/src/superlocalmemory/access/rbac.py +0 -575
- package/src/superlocalmemory/attribution/__init__.py +0 -9
- package/src/superlocalmemory/attribution/signer.py +0 -173
- package/src/superlocalmemory/attribution/watermark.py +0 -189
- package/src/superlocalmemory/brain/__init__.py +0 -5
- package/src/superlocalmemory/brain/truth.py +0 -418
- package/src/superlocalmemory/cli/__init__.py +0 -5
- package/src/superlocalmemory/cli/__main__.py +0 -17
- package/src/superlocalmemory/cli/_lazy_init.py +0 -115
- package/src/superlocalmemory/cli/cache_cmd.py +0 -198
- package/src/superlocalmemory/cli/commands.py +0 -4710
- package/src/superlocalmemory/cli/compress_cmd.py +0 -151
- package/src/superlocalmemory/cli/context_commands.py +0 -193
- package/src/superlocalmemory/cli/daemon.py +0 -909
- package/src/superlocalmemory/cli/db_migrate.py +0 -150
- package/src/superlocalmemory/cli/diagnostics_cmd.py +0 -101
- package/src/superlocalmemory/cli/escape_hatch.py +0 -220
- package/src/superlocalmemory/cli/evidence_cmd.py +0 -103
- package/src/superlocalmemory/cli/gdpr_cmd.py +0 -792
- package/src/superlocalmemory/cli/gdpr_io.py +0 -109
- package/src/superlocalmemory/cli/help_cmd.py +0 -197
- package/src/superlocalmemory/cli/host_upgrades.py +0 -189
- package/src/superlocalmemory/cli/ingest_cmd.py +0 -327
- package/src/superlocalmemory/cli/json_output.py +0 -81
- package/src/superlocalmemory/cli/loop_cmd.py +0 -187
- package/src/superlocalmemory/cli/main.py +0 -1145
- package/src/superlocalmemory/cli/mesh_cmd.py +0 -38
- package/src/superlocalmemory/cli/migrate_cmd.py +0 -55
- package/src/superlocalmemory/cli/ops_cmd.py +0 -281
- package/src/superlocalmemory/cli/optimize_cmd.py +0 -179
- package/src/superlocalmemory/cli/optimize_constants.py +0 -31
- package/src/superlocalmemory/cli/pending_store.py +0 -296
- package/src/superlocalmemory/cli/proxy_cmd.py +0 -108
- package/src/superlocalmemory/cli/scale_engine_cmd.py +0 -56
- package/src/superlocalmemory/cli/service_installer.py +0 -373
- package/src/superlocalmemory/cli/setup_wizard.py +0 -1162
- package/src/superlocalmemory/cli/summary_cmd.py +0 -215
- package/src/superlocalmemory/cli/version_banner.py +0 -202
- package/src/superlocalmemory/cli/wizard_v3426_options.py +0 -129
- package/src/superlocalmemory/code_graph/__init__.py +0 -46
- package/src/superlocalmemory/code_graph/blast_radius.py +0 -177
- package/src/superlocalmemory/code_graph/bridge/__init__.py +0 -36
- package/src/superlocalmemory/code_graph/bridge/entity_resolver.py +0 -490
- package/src/superlocalmemory/code_graph/bridge/event_listeners.py +0 -206
- package/src/superlocalmemory/code_graph/bridge/fact_enricher.py +0 -159
- package/src/superlocalmemory/code_graph/bridge/hebbian_linker.py +0 -170
- package/src/superlocalmemory/code_graph/bridge/maintenance.py +0 -220
- package/src/superlocalmemory/code_graph/bridge/temporal_checker.py +0 -152
- package/src/superlocalmemory/code_graph/changes.py +0 -363
- package/src/superlocalmemory/code_graph/communities.py +0 -299
- package/src/superlocalmemory/code_graph/config.py +0 -154
- package/src/superlocalmemory/code_graph/database.py +0 -526
- package/src/superlocalmemory/code_graph/extractors/__init__.py +0 -95
- package/src/superlocalmemory/code_graph/extractors/python.py +0 -413
- package/src/superlocalmemory/code_graph/extractors/typescript.py +0 -556
- package/src/superlocalmemory/code_graph/flows.py +0 -350
- package/src/superlocalmemory/code_graph/git_hooks.py +0 -226
- package/src/superlocalmemory/code_graph/graph_engine.py +0 -295
- package/src/superlocalmemory/code_graph/graph_store.py +0 -335
- package/src/superlocalmemory/code_graph/incremental.py +0 -200
- package/src/superlocalmemory/code_graph/models.py +0 -130
- package/src/superlocalmemory/code_graph/parser.py +0 -687
- package/src/superlocalmemory/code_graph/resolver.py +0 -321
- package/src/superlocalmemory/code_graph/search.py +0 -460
- package/src/superlocalmemory/code_graph/service.py +0 -95
- package/src/superlocalmemory/code_graph/watcher.py +0 -207
- package/src/superlocalmemory/compliance/__init__.py +0 -0
- package/src/superlocalmemory/compliance/abac.py +0 -204
- package/src/superlocalmemory/compliance/audit.py +0 -385
- package/src/superlocalmemory/compliance/eu_ai_act.py +0 -101
- package/src/superlocalmemory/compliance/gdpr.py +0 -1479
- package/src/superlocalmemory/compliance/lifecycle.py +0 -158
- package/src/superlocalmemory/compliance/retention.py +0 -415
- package/src/superlocalmemory/compliance/scheduler.py +0 -217
- package/src/superlocalmemory/contracts/__init__.py +0 -1
- package/src/superlocalmemory/contracts/schemas/agent-experience-v1.schema.json +0 -92
- package/src/superlocalmemory/contracts/schemas/agent-integration-contract-v2.schema.json +0 -46
- package/src/superlocalmemory/contracts/schemas/cognitive-turn-receipt-v1.schema.json +0 -59
- package/src/superlocalmemory/contracts/v402.py +0 -62
- package/src/superlocalmemory/core/__init__.py +0 -0
- package/src/superlocalmemory/core/actor_context.py +0 -166
- package/src/superlocalmemory/core/admission.py +0 -769
- package/src/superlocalmemory/core/backend_orchestrator.py +0 -637
- package/src/superlocalmemory/core/block_hygiene.py +0 -147
- package/src/superlocalmemory/core/community_summary.py +0 -267
- package/src/superlocalmemory/core/component_healer.py +0 -144
- package/src/superlocalmemory/core/component_registry.py +0 -514
- package/src/superlocalmemory/core/config.py +0 -2204
- package/src/superlocalmemory/core/consolidation_engine.py +0 -983
- package/src/superlocalmemory/core/context_cache.py +0 -574
- package/src/superlocalmemory/core/derivation_lineage.py +0 -246
- package/src/superlocalmemory/core/embedding_worker.py +0 -208
- package/src/superlocalmemory/core/embeddings.py +0 -1052
- package/src/superlocalmemory/core/engine.py +0 -1395
- package/src/superlocalmemory/core/engine_capabilities.py +0 -24
- package/src/superlocalmemory/core/engine_ingestion.py +0 -983
- package/src/superlocalmemory/core/engine_lock.py +0 -75
- package/src/superlocalmemory/core/engine_wiring.py +0 -776
- package/src/superlocalmemory/core/entity_community.py +0 -178
- package/src/superlocalmemory/core/error_envelope.py +0 -60
- package/src/superlocalmemory/core/evidence_bundle.py +0 -528
- package/src/superlocalmemory/core/fact_consolidator.py +0 -812
- package/src/superlocalmemory/core/file_lock.py +0 -92
- package/src/superlocalmemory/core/graph_analyzer.py +0 -456
- package/src/superlocalmemory/core/graph_metrics.py +0 -597
- package/src/superlocalmemory/core/graph_pruner.py +0 -939
- package/src/superlocalmemory/core/health_monitor.py +0 -338
- package/src/superlocalmemory/core/hooks.py +0 -65
- package/src/superlocalmemory/core/ingest_gate.py +0 -133
- package/src/superlocalmemory/core/ingest_policy.py +0 -38
- package/src/superlocalmemory/core/ingestion_command.py +0 -1042
- package/src/superlocalmemory/core/injection.py +0 -434
- package/src/superlocalmemory/core/install_detector.py +0 -131
- package/src/superlocalmemory/core/key_expander.py +0 -138
- package/src/superlocalmemory/core/lifecycle_state.py +0 -153
- package/src/superlocalmemory/core/maintenance.py +0 -777
- package/src/superlocalmemory/core/maintenance_scheduler.py +0 -507
- package/src/superlocalmemory/core/materialization_control.py +0 -20
- package/src/superlocalmemory/core/mcp_embedder_proxy.py +0 -89
- package/src/superlocalmemory/core/memory_health.py +0 -266
- package/src/superlocalmemory/core/mode_capability.py +0 -111
- package/src/superlocalmemory/core/modes.py +0 -168
- package/src/superlocalmemory/core/mutations.py +0 -688
- package/src/superlocalmemory/core/ollama_embedder.py +0 -266
- package/src/superlocalmemory/core/ollama_validator.py +0 -315
- package/src/superlocalmemory/core/operation_policy.py +0 -92
- package/src/superlocalmemory/core/operation_policy_registry.py +0 -542
- package/src/superlocalmemory/core/operation_request.py +0 -127
- package/src/superlocalmemory/core/ops_remediation.py +0 -542
- package/src/superlocalmemory/core/pii.py +0 -105
- package/src/superlocalmemory/core/platform_utils.py +0 -138
- package/src/superlocalmemory/core/profiles.py +0 -234
- package/src/superlocalmemory/core/progressive_abstraction.py +0 -208
- package/src/superlocalmemory/core/projection_drain.py +0 -380
- package/src/superlocalmemory/core/queue_consumer.py +0 -168
- package/src/superlocalmemory/core/ram_lock.py +0 -160
- package/src/superlocalmemory/core/rate_limit.py +0 -151
- package/src/superlocalmemory/core/recall_gate.py +0 -95
- package/src/superlocalmemory/core/recall_pipeline.py +0 -1337
- package/src/superlocalmemory/core/recall_queue.py +0 -377
- package/src/superlocalmemory/core/recall_worker.py +0 -414
- package/src/superlocalmemory/core/registry.py +0 -121
- package/src/superlocalmemory/core/remember_admission.py +0 -161
- package/src/superlocalmemory/core/remember_runtime.py +0 -1190
- package/src/superlocalmemory/core/remote_mode.py +0 -214
- package/src/superlocalmemory/core/reranker_worker.py +0 -338
- package/src/superlocalmemory/core/safe_fs.py +0 -108
- package/src/superlocalmemory/core/scale_autopromote.py +0 -196
- package/src/superlocalmemory/core/scale_engine.py +0 -915
- package/src/superlocalmemory/core/score_contract.py +0 -82
- package/src/superlocalmemory/core/security_primitives.py +0 -672
- package/src/superlocalmemory/core/session_identity.py +0 -98
- package/src/superlocalmemory/core/shadow_router.py +0 -319
- package/src/superlocalmemory/core/slm_disabled.py +0 -85
- package/src/superlocalmemory/core/status_contract.py +0 -108
- package/src/superlocalmemory/core/store_pipeline.py +0 -1404
- package/src/superlocalmemory/core/summarizer.py +0 -200
- package/src/superlocalmemory/core/tier_manager.py +0 -461
- package/src/superlocalmemory/core/topic_signature.py +0 -156
- package/src/superlocalmemory/core/transactions/__init__.py +0 -78
- package/src/superlocalmemory/core/transactions/concrete_owners.py +0 -604
- package/src/superlocalmemory/core/transactions/erasure.py +0 -825
- package/src/superlocalmemory/core/transactions/manifest.py +0 -255
- package/src/superlocalmemory/core/transactions/manifest_key.py +0 -155
- package/src/superlocalmemory/core/transactions/obligations.py +0 -272
- package/src/superlocalmemory/core/transactions/owners.py +0 -114
- package/src/superlocalmemory/core/transactions/reconciler.py +0 -285
- package/src/superlocalmemory/core/transactions/service.py +0 -330
- package/src/superlocalmemory/core/worker_pool.py +0 -377
- package/src/superlocalmemory/core/working_memory.py +0 -288
- package/src/superlocalmemory/dynamics/__init__.py +0 -0
- package/src/superlocalmemory/dynamics/activation_guided_quantization.py +0 -374
- package/src/superlocalmemory/dynamics/eap_scheduler.py +0 -294
- package/src/superlocalmemory/dynamics/ebbinghaus_langevin_coupling.py +0 -171
- package/src/superlocalmemory/dynamics/fisher_langevin_coupling.py +0 -227
- package/src/superlocalmemory/encoding/__init__.py +0 -0
- package/src/superlocalmemory/encoding/auto_linker.py +0 -308
- package/src/superlocalmemory/encoding/cognitive_consolidator.py +0 -899
- package/src/superlocalmemory/encoding/consolidator.py +0 -472
- package/src/superlocalmemory/encoding/context_generator.py +0 -175
- package/src/superlocalmemory/encoding/emotional.py +0 -189
- package/src/superlocalmemory/encoding/entity_reflexion.py +0 -200
- package/src/superlocalmemory/encoding/entity_resolver.py +0 -687
- package/src/superlocalmemory/encoding/entropy_gate.py +0 -101
- package/src/superlocalmemory/encoding/fact_extractor.py +0 -877
- package/src/superlocalmemory/encoding/foresight.py +0 -93
- package/src/superlocalmemory/encoding/graph_builder.py +0 -346
- package/src/superlocalmemory/encoding/observation_builder.py +0 -177
- package/src/superlocalmemory/encoding/prospective_markers.py +0 -262
- package/src/superlocalmemory/encoding/scene_builder.py +0 -410
- package/src/superlocalmemory/encoding/signal_inference.py +0 -90
- package/src/superlocalmemory/encoding/temporal_parser.py +0 -432
- package/src/superlocalmemory/encoding/temporal_validator.py +0 -572
- package/src/superlocalmemory/encoding/type_router.py +0 -237
- package/src/superlocalmemory/evaluation/__init__.py +0 -13
- package/src/superlocalmemory/evaluation/calibration.py +0 -308
- package/src/superlocalmemory/evolution/__init__.py +0 -29
- package/src/superlocalmemory/evolution/blind_verifier.py +0 -122
- package/src/superlocalmemory/evolution/budget.py +0 -356
- package/src/superlocalmemory/evolution/evolution_store.py +0 -619
- package/src/superlocalmemory/evolution/llm_dispatch.py +0 -559
- package/src/superlocalmemory/evolution/model_selection.py +0 -175
- package/src/superlocalmemory/evolution/mutation_generator.py +0 -226
- package/src/superlocalmemory/evolution/skill_activator.py +0 -270
- package/src/superlocalmemory/evolution/skill_evolver.py +0 -928
- package/src/superlocalmemory/evolution/triggers.py +0 -376
- package/src/superlocalmemory/evolution/types.py +0 -114
- package/src/superlocalmemory/graph/__init__.py +0 -9
- package/src/superlocalmemory/graph/cozo_adjacency.py +0 -122
- package/src/superlocalmemory/graph/cozo_backend.py +0 -751
- package/src/superlocalmemory/hooks/__init__.py +0 -3
- package/src/superlocalmemory/hooks/_outcome_common.py +0 -523
- package/src/superlocalmemory/hooks/adapter_base.py +0 -347
- package/src/superlocalmemory/hooks/antigravity_adapter.py +0 -171
- package/src/superlocalmemory/hooks/auto_capture.py +0 -133
- package/src/superlocalmemory/hooks/auto_invoker.py +0 -521
- package/src/superlocalmemory/hooks/auto_parameterize.py +0 -147
- package/src/superlocalmemory/hooks/auto_recall.py +0 -191
- package/src/superlocalmemory/hooks/auto_recall_hook.py +0 -251
- package/src/superlocalmemory/hooks/before_web_hook.py +0 -131
- package/src/superlocalmemory/hooks/claude_code_hooks.py +0 -637
- package/src/superlocalmemory/hooks/codex_assets.py +0 -251
- package/src/superlocalmemory/hooks/codex_hooks.py +0 -186
- package/src/superlocalmemory/hooks/context_payload.py +0 -311
- package/src/superlocalmemory/hooks/copilot_adapter.py +0 -208
- package/src/superlocalmemory/hooks/cross_platform_connector.py +0 -90
- package/src/superlocalmemory/hooks/cursor_adapter.py +0 -173
- package/src/superlocalmemory/hooks/hook_daemon.py +0 -295
- package/src/superlocalmemory/hooks/hook_handlers.py +0 -822
- package/src/superlocalmemory/hooks/ide_connector.py +0 -246
- package/src/superlocalmemory/hooks/memory_protocol.py +0 -158
- package/src/superlocalmemory/hooks/portable_kit.py +0 -755
- package/src/superlocalmemory/hooks/post_tool_async_hook.py +0 -183
- package/src/superlocalmemory/hooks/post_tool_outcome_hook.py +0 -351
- package/src/superlocalmemory/hooks/prewarm_auth.py +0 -187
- package/src/superlocalmemory/hooks/rules_engine.py +0 -99
- package/src/superlocalmemory/hooks/session_registry.py +0 -330
- package/src/superlocalmemory/hooks/stop_outcome_hook.py +0 -138
- package/src/superlocalmemory/hooks/sync_loop.py +0 -114
- package/src/superlocalmemory/hooks/topic_shift_hook.py +0 -302
- package/src/superlocalmemory/hooks/user_prompt_hook.py +0 -131
- package/src/superlocalmemory/hooks/user_prompt_rehash_hook.py +0 -210
- package/src/superlocalmemory/infra/__init__.py +0 -3
- package/src/superlocalmemory/infra/auth_middleware.py +0 -145
- package/src/superlocalmemory/infra/backup.py +0 -974
- package/src/superlocalmemory/infra/backup_obligations.py +0 -423
- package/src/superlocalmemory/infra/cache_manager.py +0 -267
- package/src/superlocalmemory/infra/cloud_backup.py +0 -788
- package/src/superlocalmemory/infra/daemon_identity.py +0 -300
- package/src/superlocalmemory/infra/data_root.py +0 -238
- package/src/superlocalmemory/infra/event_bus.py +0 -637
- package/src/superlocalmemory/infra/local_diagnostics.py +0 -327
- package/src/superlocalmemory/infra/pid_manager.py +0 -193
- package/src/superlocalmemory/infra/process_identity.py +0 -180
- package/src/superlocalmemory/infra/process_reaper.py +0 -624
- package/src/superlocalmemory/infra/rate_limiter.py +0 -228
- package/src/superlocalmemory/infra/self_heal.py +0 -401
- package/src/superlocalmemory/infra/version_integrity.py +0 -229
- package/src/superlocalmemory/ingestion/__init__.py +0 -13
- package/src/superlocalmemory/ingestion/adapter_manager.py +0 -255
- package/src/superlocalmemory/ingestion/base_adapter.py +0 -171
- package/src/superlocalmemory/ingestion/calendar_adapter.py +0 -349
- package/src/superlocalmemory/ingestion/credentials.py +0 -125
- package/src/superlocalmemory/ingestion/gmail_adapter.py +0 -378
- package/src/superlocalmemory/ingestion/parsers.py +0 -100
- package/src/superlocalmemory/ingestion/transcript_adapter.py +0 -161
- package/src/superlocalmemory/integrations/__init__.py +0 -1
- package/src/superlocalmemory/integrations/bounded_loops_mcp.py +0 -431
- package/src/superlocalmemory/integrations/bounded_loops_v051.py +0 -236
- package/src/superlocalmemory/learning/__init__.py +0 -0
- package/src/superlocalmemory/learning/adaptive.py +0 -172
- package/src/superlocalmemory/learning/arm_catalog.py +0 -97
- package/src/superlocalmemory/learning/assertion_miner.py +0 -403
- package/src/superlocalmemory/learning/bandit.py +0 -654
- package/src/superlocalmemory/learning/bandit_cache.py +0 -131
- package/src/superlocalmemory/learning/behavioral.py +0 -542
- package/src/superlocalmemory/learning/bootstrap.py +0 -298
- package/src/superlocalmemory/learning/consolidation_cycle.py +0 -398
- package/src/superlocalmemory/learning/consolidation_quantization_worker.py +0 -115
- package/src/superlocalmemory/learning/consolidation_worker.py +0 -261
- package/src/superlocalmemory/learning/cross_project.py +0 -408
- package/src/superlocalmemory/learning/database.py +0 -698
- package/src/superlocalmemory/learning/dedup_hnsw.py +0 -413
- package/src/superlocalmemory/learning/engagement.py +0 -487
- package/src/superlocalmemory/learning/engagement_features.py +0 -279
- package/src/superlocalmemory/learning/ensemble.py +0 -309
- package/src/superlocalmemory/learning/entity_compiler.py +0 -356
- package/src/superlocalmemory/learning/fact_outcome_joins.py +0 -207
- package/src/superlocalmemory/learning/features.py +0 -138
- package/src/superlocalmemory/learning/feedback.py +0 -724
- package/src/superlocalmemory/learning/forgetting_scheduler.py +0 -375
- package/src/superlocalmemory/learning/hnsw_dedup.py +0 -69
- package/src/superlocalmemory/learning/labeler.py +0 -85
- package/src/superlocalmemory/learning/legacy_migration.py +0 -316
- package/src/superlocalmemory/learning/lightgbm_subprocess.py +0 -236
- package/src/superlocalmemory/learning/memory_merge.py +0 -175
- package/src/superlocalmemory/learning/model_cache.py +0 -267
- package/src/superlocalmemory/learning/model_rollback.py +0 -281
- package/src/superlocalmemory/learning/outcome_queue.py +0 -306
- package/src/superlocalmemory/learning/outcomes.py +0 -286
- package/src/superlocalmemory/learning/pattern_miner.py +0 -465
- package/src/superlocalmemory/learning/pattern_miner_constants.py +0 -90
- package/src/superlocalmemory/learning/pcos.py +0 -291
- package/src/superlocalmemory/learning/project_context.py +0 -366
- package/src/superlocalmemory/learning/propensity.py +0 -131
- package/src/superlocalmemory/learning/ranker.py +0 -300
- package/src/superlocalmemory/learning/ranker_common.py +0 -163
- package/src/superlocalmemory/learning/ranker_retrain_legacy.py +0 -210
- package/src/superlocalmemory/learning/ranker_retrain_online.py +0 -423
- package/src/superlocalmemory/learning/reward.py +0 -888
- package/src/superlocalmemory/learning/reward_archive.py +0 -223
- package/src/superlocalmemory/learning/reward_boost.py +0 -211
- package/src/superlocalmemory/learning/reward_from_outcomes.py +0 -365
- package/src/superlocalmemory/learning/reward_model.py +0 -144
- package/src/superlocalmemory/learning/reward_proxy.py +0 -578
- package/src/superlocalmemory/learning/shadow_test.py +0 -524
- package/src/superlocalmemory/learning/signal_kinds.py +0 -79
- package/src/superlocalmemory/learning/signal_worker.py +0 -268
- package/src/superlocalmemory/learning/signals.py +0 -646
- package/src/superlocalmemory/learning/skill_performance_miner.py +0 -422
- package/src/superlocalmemory/learning/source_quality.py +0 -828
- package/src/superlocalmemory/learning/trigram_index.py +0 -548
- package/src/superlocalmemory/learning/workflows.py +0 -309
- package/src/superlocalmemory/llm/__init__.py +0 -0
- package/src/superlocalmemory/llm/backbone.py +0 -364
- package/src/superlocalmemory/loops/__init__.py +0 -58
- package/src/superlocalmemory/loops/budget.py +0 -58
- package/src/superlocalmemory/loops/engine.py +0 -174
- package/src/superlocalmemory/loops/ledger.py +0 -298
- package/src/superlocalmemory/loops/models.py +0 -152
- package/src/superlocalmemory/loops/rules.py +0 -52
- package/src/superlocalmemory/math/__init__.py +0 -0
- package/src/superlocalmemory/math/ebbinghaus.py +0 -352
- package/src/superlocalmemory/math/fisher.py +0 -356
- package/src/superlocalmemory/math/fisher_quantized.py +0 -255
- package/src/superlocalmemory/math/hopfield.py +0 -282
- package/src/superlocalmemory/math/langevin.py +0 -411
- package/src/superlocalmemory/math/polar_quant.py +0 -414
- package/src/superlocalmemory/math/qjl.py +0 -115
- package/src/superlocalmemory/math/sheaf.py +0 -261
- package/src/superlocalmemory/math/turbo_quant.py +0 -318
- package/src/superlocalmemory/mcp/__init__.py +0 -0
- package/src/superlocalmemory/mcp/_daemon_proxy.py +0 -203
- package/src/superlocalmemory/mcp/_pool_adapter.py +0 -181
- package/src/superlocalmemory/mcp/_stdin_guard.py +0 -60
- package/src/superlocalmemory/mcp/agent_context.py +0 -115
- package/src/superlocalmemory/mcp/cli_fallback.py +0 -602
- package/src/superlocalmemory/mcp/http_transport.py +0 -85
- package/src/superlocalmemory/mcp/profiles.py +0 -154
- package/src/superlocalmemory/mcp/resources.py +0 -281
- package/src/superlocalmemory/mcp/server.py +0 -480
- package/src/superlocalmemory/mcp/session_binding.py +0 -98
- package/src/superlocalmemory/mcp/shared.py +0 -112
- package/src/superlocalmemory/mcp/tools.py +0 -18
- package/src/superlocalmemory/mcp/tools_active.py +0 -958
- package/src/superlocalmemory/mcp/tools_brain.py +0 -298
- package/src/superlocalmemory/mcp/tools_code_graph.py +0 -1717
- package/src/superlocalmemory/mcp/tools_context.py +0 -239
- package/src/superlocalmemory/mcp/tools_core.py +0 -1112
- package/src/superlocalmemory/mcp/tools_evolution.py +0 -343
- package/src/superlocalmemory/mcp/tools_learning.py +0 -393
- package/src/superlocalmemory/mcp/tools_loops.py +0 -345
- package/src/superlocalmemory/mcp/tools_mesh.py +0 -429
- package/src/superlocalmemory/mcp/tools_ops.py +0 -115
- package/src/superlocalmemory/mcp/tools_optimize.py +0 -322
- package/src/superlocalmemory/mcp/tools_summaries.py +0 -147
- package/src/superlocalmemory/mcp/tools_v28.py +0 -292
- package/src/superlocalmemory/mcp/tools_v3.py +0 -398
- package/src/superlocalmemory/mcp/tools_v33.py +0 -507
- package/src/superlocalmemory/mesh/__init__.py +0 -12
- package/src/superlocalmemory/mesh/broker.py +0 -812
- package/src/superlocalmemory/mesh/broker_security.py +0 -470
- package/src/superlocalmemory/mesh/discovery.py +0 -365
- package/src/superlocalmemory/mesh/lock_protocol.py +0 -313
- package/src/superlocalmemory/mesh/node_identity.py +0 -97
- package/src/superlocalmemory/mesh/outbox_remote.py +0 -429
- package/src/superlocalmemory/mesh/remote_sync.py +0 -829
- package/src/superlocalmemory/mesh/state_sync.py +0 -286
- package/src/superlocalmemory/migrations/__init__.py +0 -5
- package/src/superlocalmemory/migrations/v3_4_25_to_v3_4_26.py +0 -144
- package/src/superlocalmemory/optimize/NOTICE +0 -6
- package/src/superlocalmemory/optimize/__init__.py +0 -0
- package/src/superlocalmemory/optimize/adapters/__init__.py +0 -68
- package/src/superlocalmemory/optimize/adapters/_agent_registry.py +0 -120
- package/src/superlocalmemory/optimize/adapters/anthropic_adapter.py +0 -112
- package/src/superlocalmemory/optimize/adapters/openai_adapter.py +0 -122
- package/src/superlocalmemory/optimize/adapters/wrap.py +0 -228
- package/src/superlocalmemory/optimize/cache/__init__.py +0 -31
- package/src/superlocalmemory/optimize/cache/boundary_store.py +0 -488
- package/src/superlocalmemory/optimize/cache/centroid_store.py +0 -199
- package/src/superlocalmemory/optimize/cache/context_key.py +0 -67
- package/src/superlocalmemory/optimize/cache/exact.py +0 -88
- package/src/superlocalmemory/optimize/cache/invalidation.py +0 -36
- package/src/superlocalmemory/optimize/cache/key_builder.py +0 -111
- package/src/superlocalmemory/optimize/cache/manager.py +0 -737
- package/src/superlocalmemory/optimize/cache/semantic.py +0 -637
- package/src/superlocalmemory/optimize/cache/stampede.py +0 -50
- package/src/superlocalmemory/optimize/compress/__init__.py +0 -17
- package/src/superlocalmemory/optimize/compress/align.py +0 -159
- package/src/superlocalmemory/optimize/compress/ccr.py +0 -116
- package/src/superlocalmemory/optimize/compress/prose_llmlingua.py +0 -71
- package/src/superlocalmemory/optimize/compress/router.py +0 -667
- package/src/superlocalmemory/optimize/config/__init__.py +0 -56
- package/src/superlocalmemory/optimize/config/defaults.py +0 -43
- package/src/superlocalmemory/optimize/config/schema.py +0 -327
- package/src/superlocalmemory/optimize/config/store.py +0 -270
- package/src/superlocalmemory/optimize/metrics/__init__.py +0 -8
- package/src/superlocalmemory/optimize/metrics/counters.py +0 -155
- package/src/superlocalmemory/optimize/metrics/estimator.py +0 -87
- package/src/superlocalmemory/optimize/metrics/exporters.py +0 -77
- package/src/superlocalmemory/optimize/metrics/persistence.py +0 -115
- package/src/superlocalmemory/optimize/proxy/__init__.py +0 -28
- package/src/superlocalmemory/optimize/proxy/_helpers.py +0 -730
- package/src/superlocalmemory/optimize/proxy/anthropic_surface.py +0 -375
- package/src/superlocalmemory/optimize/proxy/capture.py +0 -550
- package/src/superlocalmemory/optimize/proxy/gemini_surface.py +0 -528
- package/src/superlocalmemory/optimize/proxy/lifecycle.py +0 -126
- package/src/superlocalmemory/optimize/proxy/openai_surface.py +0 -465
- package/src/superlocalmemory/optimize/proxy/server.py +0 -199
- package/src/superlocalmemory/optimize/proxy/vertex_surface.py +0 -246
- package/src/superlocalmemory/optimize/storage/__init__.py +0 -0
- package/src/superlocalmemory/optimize/storage/db.py +0 -1185
- package/src/superlocalmemory/optimize/storage/schema.py +0 -205
- package/src/superlocalmemory/parameterization/__init__.py +0 -47
- package/src/superlocalmemory/parameterization/cross_project.py +0 -12
- package/src/superlocalmemory/parameterization/pattern_extractor.py +0 -584
- package/src/superlocalmemory/parameterization/pii_filter.py +0 -106
- package/src/superlocalmemory/parameterization/prompt_injector.py +0 -219
- package/src/superlocalmemory/parameterization/prompt_lifecycle.py +0 -281
- package/src/superlocalmemory/parameterization/soft_prompt_generator.py +0 -542
- package/src/superlocalmemory/parameterization/workflow_miner.py +0 -17
- package/src/superlocalmemory/reliability/__init__.py +0 -45
- package/src/superlocalmemory/reliability/join_liveness.py +0 -301
- package/src/superlocalmemory/reliability/prior_distance.py +0 -243
- package/src/superlocalmemory/retrieval/__init__.py +0 -0
- package/src/superlocalmemory/retrieval/agentic.py +0 -367
- package/src/superlocalmemory/retrieval/ann_index.py +0 -235
- package/src/superlocalmemory/retrieval/bm25_channel.py +0 -451
- package/src/superlocalmemory/retrieval/bridge_discovery.py +0 -253
- package/src/superlocalmemory/retrieval/channel_registry.py +0 -154
- package/src/superlocalmemory/retrieval/channel_status.py +0 -117
- package/src/superlocalmemory/retrieval/engine.py +0 -1615
- package/src/superlocalmemory/retrieval/entity_channel.py +0 -994
- package/src/superlocalmemory/retrieval/forgetting_filter.py +0 -160
- package/src/superlocalmemory/retrieval/fusion.py +0 -81
- package/src/superlocalmemory/retrieval/graph_adjacency.py +0 -219
- package/src/superlocalmemory/retrieval/hopfield_channel.py +0 -465
- package/src/superlocalmemory/retrieval/profile_channel.py +0 -105
- package/src/superlocalmemory/retrieval/quantization_aware_search.py +0 -147
- package/src/superlocalmemory/retrieval/remote_reranker.py +0 -758
- package/src/superlocalmemory/retrieval/reranker.py +0 -674
- package/src/superlocalmemory/retrieval/scope_policy.py +0 -126
- package/src/superlocalmemory/retrieval/semantic_channel.py +0 -638
- package/src/superlocalmemory/retrieval/spreading.py +0 -288
- package/src/superlocalmemory/retrieval/spreading_activation.py +0 -616
- package/src/superlocalmemory/retrieval/strategy.py +0 -248
- package/src/superlocalmemory/retrieval/temporal_channel.py +0 -433
- package/src/superlocalmemory/retrieval/temporal_frame.py +0 -102
- package/src/superlocalmemory/retrieval/temporal_utils.py +0 -122
- package/src/superlocalmemory/retrieval/temporal_validity_filter.py +0 -499
- package/src/superlocalmemory/retrieval/time_window.py +0 -181
- package/src/superlocalmemory/retrieval/vector_store.py +0 -863
- package/src/superlocalmemory/server/__init__.py +0 -1
- package/src/superlocalmemory/server/api.py +0 -310
- package/src/superlocalmemory/server/asset_versions.py +0 -171
- package/src/superlocalmemory/server/bandit_loops.py +0 -158
- package/src/superlocalmemory/server/config_file.py +0 -90
- package/src/superlocalmemory/server/consolidation_runner.py +0 -140
- package/src/superlocalmemory/server/egress_policy.py +0 -258
- package/src/superlocalmemory/server/loopback.py +0 -85
- package/src/superlocalmemory/server/middleware/__init__.py +0 -11
- package/src/superlocalmemory/server/middleware/security_headers.py +0 -144
- package/src/superlocalmemory/server/origin.py +0 -55
- package/src/superlocalmemory/server/profile_runtime.py +0 -515
- package/src/superlocalmemory/server/rbac_enforce.py +0 -194
- package/src/superlocalmemory/server/recall_health.py +0 -343
- package/src/superlocalmemory/server/recall_serializer.py +0 -320
- package/src/superlocalmemory/server/route_mutations.py +0 -104
- package/src/superlocalmemory/server/routes/__init__.py +0 -4
- package/src/superlocalmemory/server/routes/abstraction.py +0 -314
- package/src/superlocalmemory/server/routes/adapters.py +0 -63
- package/src/superlocalmemory/server/routes/agents.py +0 -303
- package/src/superlocalmemory/server/routes/backup.py +0 -869
- package/src/superlocalmemory/server/routes/behavioral.py +0 -659
- package/src/superlocalmemory/server/routes/brain.py +0 -1892
- package/src/superlocalmemory/server/routes/chat.py +0 -393
- package/src/superlocalmemory/server/routes/compliance.py +0 -533
- package/src/superlocalmemory/server/routes/config_api.py +0 -703
- package/src/superlocalmemory/server/routes/data_io.py +0 -329
- package/src/superlocalmemory/server/routes/entity.py +0 -237
- package/src/superlocalmemory/server/routes/events.py +0 -214
- package/src/superlocalmemory/server/routes/evolution.py +0 -510
- package/src/superlocalmemory/server/routes/helpers.py +0 -499
- package/src/superlocalmemory/server/routes/ingest.py +0 -137
- package/src/superlocalmemory/server/routes/insights.py +0 -366
- package/src/superlocalmemory/server/routes/learning.py +0 -834
- package/src/superlocalmemory/server/routes/learning_telemetry.py +0 -154
- package/src/superlocalmemory/server/routes/lifecycle.py +0 -184
- package/src/superlocalmemory/server/routes/memories.py +0 -1661
- package/src/superlocalmemory/server/routes/mesh.py +0 -517
- package/src/superlocalmemory/server/routes/mesh_lock.py +0 -54
- package/src/superlocalmemory/server/routes/mesh_state.py +0 -63
- package/src/superlocalmemory/server/routes/optimize.py +0 -197
- package/src/superlocalmemory/server/routes/prewarm.py +0 -173
- package/src/superlocalmemory/server/routes/profiles.py +0 -292
- package/src/superlocalmemory/server/routes/ratelimit.py +0 -132
- package/src/superlocalmemory/server/routes/rbac.py +0 -366
- package/src/superlocalmemory/server/routes/stats.py +0 -385
- package/src/superlocalmemory/server/routes/tiers.py +0 -222
- package/src/superlocalmemory/server/routes/timeline.py +0 -258
- package/src/superlocalmemory/server/routes/token.py +0 -90
- package/src/superlocalmemory/server/routes/v3_api.py +0 -3023
- package/src/superlocalmemory/server/routes/ws.py +0 -171
- package/src/superlocalmemory/server/security_middleware.py +0 -89
- package/src/superlocalmemory/server/ui.py +0 -354
- package/src/superlocalmemory/server/unified_daemon.py +0 -6326
- package/src/superlocalmemory/server/write_identity.py +0 -195
- package/src/superlocalmemory/storage/__init__.py +0 -0
- package/src/superlocalmemory/storage/_migration_internals.py +0 -638
- package/src/superlocalmemory/storage/_schema_version.py +0 -174
- package/src/superlocalmemory/storage/access_log.py +0 -170
- package/src/superlocalmemory/storage/admission_codec.py +0 -129
- package/src/superlocalmemory/storage/admission_journal.py +0 -843
- package/src/superlocalmemory/storage/agent_experience.py +0 -546
- package/src/superlocalmemory/storage/backup.py +0 -531
- package/src/superlocalmemory/storage/correction_cases.py +0 -670
- package/src/superlocalmemory/storage/database.py +0 -3180
- package/src/superlocalmemory/storage/deferred_writes.py +0 -209
- package/src/superlocalmemory/storage/embedding_codec.py +0 -200
- package/src/superlocalmemory/storage/embedding_migrator.py +0 -672
- package/src/superlocalmemory/storage/erasure_fence.py +0 -45
- package/src/superlocalmemory/storage/execution_learning.py +0 -285
- package/src/superlocalmemory/storage/external_evidence.py +0 -359
- package/src/superlocalmemory/storage/generation_fence.py +0 -63
- package/src/superlocalmemory/storage/lineage_retention.py +0 -236
- package/src/superlocalmemory/storage/logical_edges.py +0 -86
- package/src/superlocalmemory/storage/memory_write.py +0 -115
- package/src/superlocalmemory/storage/migration_runner.py +0 -895
- package/src/superlocalmemory/storage/migration_v33.py +0 -140
- package/src/superlocalmemory/storage/migrations/M001_add_signal_features_columns.py +0 -67
- package/src/superlocalmemory/storage/migrations/M002_model_state_history.py +0 -107
- package/src/superlocalmemory/storage/migrations/M003_migration_log.py +0 -38
- package/src/superlocalmemory/storage/migrations/M004_cross_platform_sync_log.py +0 -46
- package/src/superlocalmemory/storage/migrations/M005_bandit_tables.py +0 -75
- package/src/superlocalmemory/storage/migrations/M006_action_outcomes_reward.py +0 -75
- package/src/superlocalmemory/storage/migrations/M007_pending_outcomes.py +0 -63
- package/src/superlocalmemory/storage/migrations/M009_model_lineage.py +0 -94
- package/src/superlocalmemory/storage/migrations/M010_evolution_config.py +0 -80
- package/src/superlocalmemory/storage/migrations/M011_archive_and_merge.py +0 -87
- package/src/superlocalmemory/storage/migrations/M012_shadow_observations.py +0 -72
- package/src/superlocalmemory/storage/migrations/M013_bi_temporal_columns.py +0 -55
- package/src/superlocalmemory/storage/migrations/M014_v345_scale_ready.py +0 -45
- package/src/superlocalmemory/storage/migrations/M015_add_pinned_column.py +0 -58
- package/src/superlocalmemory/storage/migrations/M016_add_scope_support.py +0 -120
- package/src/superlocalmemory/storage/migrations/M017_ccq_scope_column.py +0 -79
- package/src/superlocalmemory/storage/migrations/M018_ingestion_operations.py +0 -120
- package/src/superlocalmemory/storage/migrations/M019_derivation_lineage.py +0 -54
- package/src/superlocalmemory/storage/migrations/M020_model_state_integrity.py +0 -52
- package/src/superlocalmemory/storage/migrations/M021_ingestion_log_profile.py +0 -108
- package/src/superlocalmemory/storage/migrations/M022_entity_aliases_profile.py +0 -86
- package/src/superlocalmemory/storage/migrations/M023_mesh_profile_isolation.py +0 -194
- package/src/superlocalmemory/storage/migrations/M024_rbac_users_roles.py +0 -87
- package/src/superlocalmemory/storage/migrations/M025_perf_indexes.py +0 -90
- package/src/superlocalmemory/storage/migrations/M026_rbac_memberships_fk.py +0 -136
- package/src/superlocalmemory/storage/migrations/M027_transferable_patterns_profile.py +0 -163
- package/src/superlocalmemory/storage/migrations/M028_fact_entity_associations.py +0 -305
- package/src/superlocalmemory/storage/migrations/M029_behavioral_history_indexes.py +0 -137
- package/src/superlocalmemory/storage/migrations/M030_entity_explorer_indexes.py +0 -93
- package/src/superlocalmemory/storage/migrations/M031_dead_letter_operations.py +0 -80
- package/src/superlocalmemory/storage/migrations/M032_write_coordinator_admission.py +0 -188
- package/src/superlocalmemory/storage/migrations/M033_projection_transactions.py +0 -148
- package/src/superlocalmemory/storage/migrations/M034_obligation_integrity.py +0 -58
- package/src/superlocalmemory/storage/migrations/M035_erasure_receipts.py +0 -113
- package/src/superlocalmemory/storage/migrations/M036_vector_row_map.py +0 -107
- package/src/superlocalmemory/storage/migrations/M037_manifest_hmac_version.py +0 -162
- package/src/superlocalmemory/storage/migrations/M038_learning_feedback_channel.py +0 -77
- package/src/superlocalmemory/storage/migrations/M039_scene_fact_members.py +0 -137
- package/src/superlocalmemory/storage/migrations/M040_agent_experience_receipts.py +0 -254
- package/src/superlocalmemory/storage/migrations/M041_external_evidence_receipts.py +0 -189
- package/src/superlocalmemory/storage/migrations/M042_correction_case_ledger.py +0 -245
- package/src/superlocalmemory/storage/migrations/M043_quarantine_display_summaries.py +0 -512
- package/src/superlocalmemory/storage/migrations/M044_play_carries_its_own_evidence.py +0 -127
- package/src/superlocalmemory/storage/migrations/M045_fact_outcome_score.py +0 -158
- package/src/superlocalmemory/storage/migrations/M046_prospective_memory_has_its_own_name.py +0 -620
- package/src/superlocalmemory/storage/migrations/M047_fisher_vectors_are_stored_like_every_other_vector.py +0 -306
- package/src/superlocalmemory/storage/migrations/M048_upcoming_holds_only_what_is_upcoming.py +0 -229
- package/src/superlocalmemory/storage/migrations/M049_a_schema_version_marker_is_one_row.py +0 -201
- package/src/superlocalmemory/storage/migrations/M050_execution_learning_v2.py +0 -70
- package/src/superlocalmemory/storage/migrations/__init__.py +0 -103
- package/src/superlocalmemory/storage/migrations.py +0 -333
- package/src/superlocalmemory/storage/models.py +0 -500
- package/src/superlocalmemory/storage/projection_outbox.py +0 -346
- package/src/superlocalmemory/storage/quantized_store.py +0 -280
- package/src/superlocalmemory/storage/read_connection.py +0 -115
- package/src/superlocalmemory/storage/retention_policy.py +0 -860
- package/src/superlocalmemory/storage/schema.py +0 -1108
- package/src/superlocalmemory/storage/schema_code_graph.py +0 -282
- package/src/superlocalmemory/storage/schema_v32.py +0 -382
- package/src/superlocalmemory/storage/schema_v3410.py +0 -159
- package/src/superlocalmemory/storage/schema_v3411.py +0 -149
- package/src/superlocalmemory/storage/schema_v343.py +0 -315
- package/src/superlocalmemory/storage/schema_v345.py +0 -109
- package/src/superlocalmemory/storage/schema_v347.py +0 -140
- package/src/superlocalmemory/storage/sqlite_vectors.py +0 -169
- package/src/superlocalmemory/storage/v2_migrator.py +0 -466
- package/src/superlocalmemory/storage/write_coordinator.py +0 -949
- package/src/superlocalmemory/storage/write_lock.py +0 -88
- package/src/superlocalmemory/summaries/__init__.py +0 -37
- package/src/superlocalmemory/summaries/base.py +0 -267
- package/src/superlocalmemory/summaries/daily_reflection.py +0 -340
- package/src/superlocalmemory/summaries/non_answer.py +0 -223
- package/src/superlocalmemory/summaries/project_work_log.py +0 -440
- package/src/superlocalmemory/summaries/session_summary.py +0 -311
- package/src/superlocalmemory/trust/__init__.py +0 -0
- package/src/superlocalmemory/trust/gate.py +0 -171
- package/src/superlocalmemory/trust/provenance.py +0 -124
- package/src/superlocalmemory/trust/scorer.py +0 -413
- package/src/superlocalmemory/trust/signals.py +0 -153
- package/src/superlocalmemory/ui/assets/slm-icon-white.svg +0 -64
- package/src/superlocalmemory/ui/assets/slm-icon.svg +0 -36
- package/src/superlocalmemory/ui/css/brain.css +0 -409
- package/src/superlocalmemory/ui/css/design-system.css +0 -696
- package/src/superlocalmemory/ui/css/legacy-dashboard.css +0 -663
- package/src/superlocalmemory/ui/css/neural-glass.css +0 -1599
- package/src/superlocalmemory/ui/css/od-bridge.css +0 -158
- package/src/superlocalmemory/ui/favicon.svg +0 -36
- package/src/superlocalmemory/ui/index.html +0 -1638
- package/src/superlocalmemory/ui/js/agents.js +0 -192
- package/src/superlocalmemory/ui/js/auto-settings.js +0 -624
- package/src/superlocalmemory/ui/js/brain.js +0 -1400
- package/src/superlocalmemory/ui/js/clusters.js +0 -326
- package/src/superlocalmemory/ui/js/compliance.js +0 -307
- package/src/superlocalmemory/ui/js/core.js +0 -566
- package/src/superlocalmemory/ui/js/dashboard.js +0 -503
- package/src/superlocalmemory/ui/js/event-delegation.js +0 -113
- package/src/superlocalmemory/ui/js/events.js +0 -178
- package/src/superlocalmemory/ui/js/fact-detail.js +0 -142
- package/src/superlocalmemory/ui/js/feedback.js +0 -339
- package/src/superlocalmemory/ui/js/graph-event-bus.js +0 -83
- package/src/superlocalmemory/ui/js/graph-filters.js +0 -220
- package/src/superlocalmemory/ui/js/graph-ui.js +0 -214
- package/src/superlocalmemory/ui/js/ide-status.js +0 -115
- package/src/superlocalmemory/ui/js/init.js +0 -54
- package/src/superlocalmemory/ui/js/knowledge-graph.js +0 -945
- package/src/superlocalmemory/ui/js/lifecycle.js +0 -387
- package/src/superlocalmemory/ui/js/math-health.js +0 -114
- package/src/superlocalmemory/ui/js/memories.js +0 -394
- package/src/superlocalmemory/ui/js/memory-chat.js +0 -371
- package/src/superlocalmemory/ui/js/memory-timeline.js +0 -265
- package/src/superlocalmemory/ui/js/modal.js +0 -733
- package/src/superlocalmemory/ui/js/ng-entities.js +0 -298
- package/src/superlocalmemory/ui/js/ng-health.js +0 -208
- package/src/superlocalmemory/ui/js/ng-ingestion.js +0 -203
- package/src/superlocalmemory/ui/js/ng-mesh.js +0 -374
- package/src/superlocalmemory/ui/js/ng-shell.js +0 -524
- package/src/superlocalmemory/ui/js/ng-skills.js +0 -663
- package/src/superlocalmemory/ui/js/od-agents.js +0 -588
- package/src/superlocalmemory/ui/js/od-auth-gate.js +0 -257
- package/src/superlocalmemory/ui/js/od-backup.js +0 -878
- package/src/superlocalmemory/ui/js/od-boundedloops.js +0 -324
- package/src/superlocalmemory/ui/js/od-brain.js +0 -1095
- package/src/superlocalmemory/ui/js/od-compliance-ext.js +0 -301
- package/src/superlocalmemory/ui/js/od-components.js +0 -147
- package/src/superlocalmemory/ui/js/od-entities.js +0 -622
- package/src/superlocalmemory/ui/js/od-graph.js +0 -776
- package/src/superlocalmemory/ui/js/od-health.js +0 -579
- package/src/superlocalmemory/ui/js/od-mcp.js +0 -508
- package/src/superlocalmemory/ui/js/od-memories.js +0 -1499
- package/src/superlocalmemory/ui/js/od-mesh.js +0 -645
- package/src/superlocalmemory/ui/js/od-operations.js +0 -1268
- package/src/superlocalmemory/ui/js/od-ops-health.js +0 -417
- package/src/superlocalmemory/ui/js/od-optimize.js +0 -828
- package/src/superlocalmemory/ui/js/od-settings.js +0 -1275
- package/src/superlocalmemory/ui/js/od-shell.js +0 -819
- package/src/superlocalmemory/ui/js/od-skills.js +0 -600
- package/src/superlocalmemory/ui/js/od-team.js +0 -265
- package/src/superlocalmemory/ui/js/optimize.js +0 -191
- package/src/superlocalmemory/ui/js/profiles.js +0 -362
- package/src/superlocalmemory/ui/js/quick-actions.js +0 -334
- package/src/superlocalmemory/ui/js/recall-lab.js +0 -373
- package/src/superlocalmemory/ui/js/search.js +0 -86
- package/src/superlocalmemory/ui/js/settings.js +0 -556
- package/src/superlocalmemory/ui/js/timeline.js +0 -62
- package/src/superlocalmemory/ui/js/trust-dashboard.js +0 -225
- package/src/superlocalmemory/ui/vendor/bootstrap-icons/bootstrap-icons.css +0 -2018
- package/src/superlocalmemory/ui/vendor/bootstrap-icons/fonts/bootstrap-icons.woff +0 -0
- package/src/superlocalmemory/ui/vendor/bootstrap-icons/fonts/bootstrap-icons.woff2 +0 -0
- package/src/superlocalmemory/ui/vendor/bootstrap.bundle.min.js +0 -7
- package/src/superlocalmemory/ui/vendor/bootstrap.min.css +0 -6
- package/src/superlocalmemory/ui/vendor/d3.v7.min.js +0 -2
- package/src/superlocalmemory/ui/vendor/graphology-library.min.js +0 -2
- package/src/superlocalmemory/ui/vendor/graphology.umd.min.js +0 -2
- package/src/superlocalmemory/ui/vendor/inter-ui/inter-variable.min.css +0 -8
- package/src/superlocalmemory/ui/vendor/inter-ui/variable/InterVariable-Italic.woff2 +0 -0
- package/src/superlocalmemory/ui/vendor/inter-ui/variable/InterVariable.woff2 +0 -0
- package/src/superlocalmemory/ui/vendor/sigma.min.js +0 -1
- package/src/superlocalmemory/vector/__init__.py +0 -9
- package/src/superlocalmemory/vector/lancedb_backend.py +0 -366
|
@@ -1,329 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
|
|
2
|
-
# Licensed under AGPL-3.0-or-later - see LICENSE file
|
|
3
|
-
# Part of SuperLocalMemory V3 | https://qualixar.com | https://varunpratap.com
|
|
4
|
-
"""SuperLocalMemory V3 - Import/Export Routes
|
|
5
|
-
- AGPL-3.0-or-later
|
|
6
|
-
|
|
7
|
-
Routes: /api/export, /api/import
|
|
8
|
-
"""
|
|
9
|
-
import asyncio
|
|
10
|
-
import io
|
|
11
|
-
import gzip
|
|
12
|
-
import hashlib
|
|
13
|
-
import json
|
|
14
|
-
import logging
|
|
15
|
-
from typing import Any, Optional
|
|
16
|
-
from datetime import datetime, timezone
|
|
17
|
-
|
|
18
|
-
from fastapi import APIRouter, HTTPException, Query, Request, UploadFile, File
|
|
19
|
-
from fastapi.responses import StreamingResponse
|
|
20
|
-
|
|
21
|
-
from .helpers import (
|
|
22
|
-
DB_PATH,
|
|
23
|
-
dict_factory,
|
|
24
|
-
get_active_profile,
|
|
25
|
-
get_db_connection,
|
|
26
|
-
require_engine,
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
logger = logging.getLogger("superlocalmemory.routes.data_io")
|
|
30
|
-
|
|
31
|
-
# Hard cap on the total decompressed byte count for gzip imports.
|
|
32
|
-
# Bounding the compressed upload size alone does not prevent a decompression
|
|
33
|
-
# bomb: a few kilobytes of input can expand to gigabytes. This cap is checked
|
|
34
|
-
# incrementally during streaming decompression so the full expanded content is
|
|
35
|
-
# never materialized before the guard fires.
|
|
36
|
-
_MAX_DECOMPRESSED_BYTES: int = 200 * 1024 * 1024 # 200 MB
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
def _internal_error(detail: str = "Internal server error") -> HTTPException:
|
|
40
|
-
"""SEC-H-02: log full traceback server-side; return a generic message to the client."""
|
|
41
|
-
logger.exception("data_io route error")
|
|
42
|
-
return HTTPException(status_code=500, detail=detail)
|
|
43
|
-
|
|
44
|
-
# WebSocket manager reference (set by ui_server.py at startup)
|
|
45
|
-
ws_manager = None
|
|
46
|
-
|
|
47
|
-
router = APIRouter()
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
@router.get("/api/export")
|
|
51
|
-
async def export_memories(
|
|
52
|
-
request: Request,
|
|
53
|
-
format: str = Query("json", pattern="^(json|jsonl|csv)$"),
|
|
54
|
-
category: Optional[str] = None,
|
|
55
|
-
project_name: Optional[str] = None,
|
|
56
|
-
):
|
|
57
|
-
"""Export memories as JSON, JSONL, or CSV."""
|
|
58
|
-
# Bulk data export. This GET is not covered by the mutation middleware and
|
|
59
|
-
# is reached both by a plain fetch and a top-level navigation, neither of
|
|
60
|
-
# which carries a credential header — so gate on the loopback-trusted
|
|
61
|
-
# mutation boundary: local owner allowed, remote uncredentialed fails closed.
|
|
62
|
-
from superlocalmemory.server.write_identity import require_http_mutation_actor
|
|
63
|
-
require_http_mutation_actor(request, getattr(request.app.state, "daemon_descriptor", None),
|
|
64
|
-
actor_kind="data-export")
|
|
65
|
-
try:
|
|
66
|
-
conn = get_db_connection()
|
|
67
|
-
conn.row_factory = dict_factory
|
|
68
|
-
cursor = conn.cursor()
|
|
69
|
-
active_profile = get_active_profile()
|
|
70
|
-
|
|
71
|
-
# Detect schema
|
|
72
|
-
try:
|
|
73
|
-
cursor.execute(
|
|
74
|
-
"SELECT name FROM sqlite_master WHERE type='table' AND name='atomic_facts'",
|
|
75
|
-
)
|
|
76
|
-
use_v3 = cursor.fetchone() is not None
|
|
77
|
-
except Exception:
|
|
78
|
-
use_v3 = False
|
|
79
|
-
|
|
80
|
-
if use_v3:
|
|
81
|
-
# Withheld summaries are excluded, and this is about IMPORT, not
|
|
82
|
-
# tidiness. Import re-ingests every record through the normal
|
|
83
|
-
# pipeline, which mints a fresh memory with quarantined = 0 — so an
|
|
84
|
-
# export taken here and imported anywhere would resurrect all 1,195
|
|
85
|
-
# model-written rows as though the owner had written them, on a
|
|
86
|
-
# machine where nothing had gone wrong. The repair would then have
|
|
87
|
-
# to run again there.
|
|
88
|
-
#
|
|
89
|
-
# Nothing the owner wrote is lost: these are derived artefacts, the
|
|
90
|
-
# consolidator regenerates them from the facts that ARE exported,
|
|
91
|
-
# and their text is kept in consolidated_summaries. (That table is
|
|
92
|
-
# not in this export either — it is a view, not a memory. Worth
|
|
93
|
-
# revisiting when export covers derived state.)
|
|
94
|
-
query = "SELECT * FROM atomic_facts WHERE profile_id = ?"
|
|
95
|
-
if _has_column(cursor, "atomic_facts", "quarantined"):
|
|
96
|
-
query += " AND COALESCE(quarantined, 0) = 0"
|
|
97
|
-
params = [active_profile]
|
|
98
|
-
if category:
|
|
99
|
-
query += " AND fact_type = ?"
|
|
100
|
-
params.append(category)
|
|
101
|
-
if project_name:
|
|
102
|
-
query += " AND session_id = ?"
|
|
103
|
-
params.append(project_name)
|
|
104
|
-
query += " ORDER BY created_at"
|
|
105
|
-
else:
|
|
106
|
-
query = "SELECT * FROM memories WHERE profile = ?"
|
|
107
|
-
params = [active_profile]
|
|
108
|
-
if category:
|
|
109
|
-
query += " AND category = ?"
|
|
110
|
-
params.append(category)
|
|
111
|
-
if project_name:
|
|
112
|
-
query += " AND project_name = ?"
|
|
113
|
-
params.append(project_name)
|
|
114
|
-
query += " ORDER BY created_at"
|
|
115
|
-
|
|
116
|
-
cursor.execute(query, params)
|
|
117
|
-
memories = cursor.fetchall()
|
|
118
|
-
conn.close()
|
|
119
|
-
|
|
120
|
-
if format == "jsonl":
|
|
121
|
-
content = "\n".join(json.dumps(m) for m in memories)
|
|
122
|
-
media_type = "application/x-ndjson"
|
|
123
|
-
elif format == "csv":
|
|
124
|
-
import csv
|
|
125
|
-
import io as _io
|
|
126
|
-
if memories:
|
|
127
|
-
buf = _io.StringIO()
|
|
128
|
-
fieldnames = list(memories[0].keys())
|
|
129
|
-
writer = csv.DictWriter(
|
|
130
|
-
buf, fieldnames=fieldnames, extrasaction="ignore",
|
|
131
|
-
)
|
|
132
|
-
writer.writeheader()
|
|
133
|
-
for m in memories:
|
|
134
|
-
writer.writerow({
|
|
135
|
-
k: (json.dumps(v) if isinstance(v, (dict, list)) else v)
|
|
136
|
-
for k, v in m.items()
|
|
137
|
-
})
|
|
138
|
-
content = buf.getvalue()
|
|
139
|
-
else:
|
|
140
|
-
content = ""
|
|
141
|
-
media_type = "text/csv"
|
|
142
|
-
else:
|
|
143
|
-
content = json.dumps({
|
|
144
|
-
"version": "3.0.0",
|
|
145
|
-
"exported_at": datetime.now(timezone.utc).isoformat(),
|
|
146
|
-
"total_memories": len(memories),
|
|
147
|
-
"filters": {"category": category, "project_name": project_name},
|
|
148
|
-
"memories": memories,
|
|
149
|
-
}, indent=2)
|
|
150
|
-
media_type = "application/json"
|
|
151
|
-
|
|
152
|
-
ts = datetime.now(timezone.utc).strftime('%Y%m%d_%H%M%S')
|
|
153
|
-
if len(content) > 10000:
|
|
154
|
-
compressed = gzip.compress(content.encode())
|
|
155
|
-
return StreamingResponse(
|
|
156
|
-
io.BytesIO(compressed), media_type="application/gzip",
|
|
157
|
-
headers={
|
|
158
|
-
"Content-Disposition": f"attachment; filename=memories_export_{ts}.{format}.gz",
|
|
159
|
-
},
|
|
160
|
-
)
|
|
161
|
-
return StreamingResponse(
|
|
162
|
-
io.BytesIO(content.encode()), media_type=media_type,
|
|
163
|
-
headers={
|
|
164
|
-
"Content-Disposition": f"attachment; filename=memories_export_{ts}.{format}",
|
|
165
|
-
},
|
|
166
|
-
)
|
|
167
|
-
|
|
168
|
-
except Exception:
|
|
169
|
-
raise _internal_error("Export error")
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
def _has_column(cursor: Any, table: str, column: str) -> bool:
|
|
173
|
-
"""Whether ``table`` carries ``column`` in this database.
|
|
174
|
-
|
|
175
|
-
Presence-guarded because ``quarantined`` arrives with a migration and this
|
|
176
|
-
route must keep working on a store the engine has not opened.
|
|
177
|
-
"""
|
|
178
|
-
try:
|
|
179
|
-
cursor.execute(f"PRAGMA table_info({table})")
|
|
180
|
-
return any(row[1] == column for row in cursor.fetchall())
|
|
181
|
-
except Exception: # noqa: BLE001 -- an export must not fail over a probe
|
|
182
|
-
return False
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
@router.post("/api/import")
|
|
186
|
-
async def import_memories(request: Request, file: UploadFile = File(...)):
|
|
187
|
-
"""Import memories from JSON file using V3 engine."""
|
|
188
|
-
try:
|
|
189
|
-
# Bound the upload so a huge file cannot OOM the daemon (read one byte
|
|
190
|
-
# past the cap to detect oversize without buffering the whole payload).
|
|
191
|
-
_MAX_IMPORT_BYTES = 50 * 1024 * 1024
|
|
192
|
-
content = await file.read(_MAX_IMPORT_BYTES + 1)
|
|
193
|
-
if len(content) > _MAX_IMPORT_BYTES:
|
|
194
|
-
raise HTTPException(status_code=413,
|
|
195
|
-
detail="Import file exceeds the 50 MB limit")
|
|
196
|
-
if file.filename and file.filename.endswith('.gz'):
|
|
197
|
-
# Stream-decompress with an incremental byte counter so the full
|
|
198
|
-
# expanded payload is never allocated before the guard fires.
|
|
199
|
-
_chunk_size = 65_536
|
|
200
|
-
chunks: list[bytes] = []
|
|
201
|
-
total_decompressed = 0
|
|
202
|
-
with gzip.GzipFile(fileobj=io.BytesIO(content)) as _gz:
|
|
203
|
-
while True:
|
|
204
|
-
chunk = _gz.read(_chunk_size)
|
|
205
|
-
if not chunk:
|
|
206
|
-
break
|
|
207
|
-
total_decompressed += len(chunk)
|
|
208
|
-
if total_decompressed > _MAX_DECOMPRESSED_BYTES:
|
|
209
|
-
raise HTTPException(
|
|
210
|
-
status_code=413,
|
|
211
|
-
detail=(
|
|
212
|
-
f"Decompressed content exceeds the "
|
|
213
|
-
f"{_MAX_DECOMPRESSED_BYTES // (1024 * 1024)} MB limit"
|
|
214
|
-
),
|
|
215
|
-
)
|
|
216
|
-
chunks.append(chunk)
|
|
217
|
-
content = b"".join(chunks)
|
|
218
|
-
|
|
219
|
-
try:
|
|
220
|
-
data = json.loads(content)
|
|
221
|
-
except json.JSONDecodeError:
|
|
222
|
-
logger.warning("import: invalid JSON payload")
|
|
223
|
-
raise HTTPException(status_code=400, detail="Invalid JSON format")
|
|
224
|
-
|
|
225
|
-
if isinstance(data, dict) and 'memories' in data:
|
|
226
|
-
memories = data['memories']
|
|
227
|
-
elif isinstance(data, list):
|
|
228
|
-
memories = data
|
|
229
|
-
else:
|
|
230
|
-
raise HTTPException(
|
|
231
|
-
status_code=400, detail="Invalid format: expected 'memories' array",
|
|
232
|
-
)
|
|
233
|
-
|
|
234
|
-
engine = require_engine(request)
|
|
235
|
-
from superlocalmemory.core.engine_ingestion import (
|
|
236
|
-
build_engine_ingestion_command,
|
|
237
|
-
)
|
|
238
|
-
from superlocalmemory.core.ingestion_command import (
|
|
239
|
-
IngestionRequest,
|
|
240
|
-
IngestionState,
|
|
241
|
-
)
|
|
242
|
-
|
|
243
|
-
command = build_engine_ingestion_command(engine)
|
|
244
|
-
from superlocalmemory.server.write_identity import (
|
|
245
|
-
authenticated_request_actor,
|
|
246
|
-
)
|
|
247
|
-
actor_id = authenticated_request_actor(
|
|
248
|
-
request,
|
|
249
|
-
actor_kind="http-import",
|
|
250
|
-
)
|
|
251
|
-
file_digest = hashlib.sha256(content).hexdigest()
|
|
252
|
-
imported = 0
|
|
253
|
-
skipped = 0
|
|
254
|
-
errors = []
|
|
255
|
-
operation_ids: list[str] = []
|
|
256
|
-
|
|
257
|
-
for idx, memory in enumerate(memories):
|
|
258
|
-
try:
|
|
259
|
-
memory_content = memory.get('content')
|
|
260
|
-
if not memory_content:
|
|
261
|
-
errors.append(f"Memory {idx}: missing 'content' field")
|
|
262
|
-
continue
|
|
263
|
-
# Imported content is untrusted: scrub secrets before it reaches
|
|
264
|
-
# any durable or queryable store, exactly as the canonical
|
|
265
|
-
# ingest path does.
|
|
266
|
-
from superlocalmemory.core.ingest_policy import scrub_secrets_for_ingest
|
|
267
|
-
_scrub = scrub_secrets_for_ingest(memory_content)
|
|
268
|
-
if _scrub.redacted:
|
|
269
|
-
memory_content = _scrub.content
|
|
270
|
-
|
|
271
|
-
metadata = {
|
|
272
|
-
"project_name": memory.get('project_name'),
|
|
273
|
-
"category": memory.get('category'),
|
|
274
|
-
"tags": memory.get('tags', ''),
|
|
275
|
-
}
|
|
276
|
-
for _field in (
|
|
277
|
-
"fact_type", "confidence", "importance", "entities",
|
|
278
|
-
"canonical_entities", "referenced_date", "pinned",
|
|
279
|
-
):
|
|
280
|
-
if _field in memory:
|
|
281
|
-
metadata[_field] = memory[_field]
|
|
282
|
-
receipt, created = command.submit_with_status(IngestionRequest(
|
|
283
|
-
content=memory_content,
|
|
284
|
-
profile_id=engine._profile_id,
|
|
285
|
-
source_type="http-import",
|
|
286
|
-
idempotency_key=f"import:{file_digest}:{idx}",
|
|
287
|
-
metadata=metadata,
|
|
288
|
-
scope=memory.get("scope") or "personal",
|
|
289
|
-
shared_with=tuple(memory.get("shared_with") or ()),
|
|
290
|
-
trusted_actor_id=actor_id,
|
|
291
|
-
session_id=memory.get('session_id', ''),
|
|
292
|
-
session_date=memory.get('session_date') or "",
|
|
293
|
-
speaker=memory.get('speaker') or "",
|
|
294
|
-
role=memory.get('role') or "user",
|
|
295
|
-
))
|
|
296
|
-
completed = await asyncio.to_thread(command.materialize, receipt.operation_id)
|
|
297
|
-
if completed.state is not IngestionState.COMPLETE:
|
|
298
|
-
raise RuntimeError(
|
|
299
|
-
completed.last_error or "canonical import failed"
|
|
300
|
-
)
|
|
301
|
-
operation_ids.append(completed.operation_id)
|
|
302
|
-
if created:
|
|
303
|
-
imported += 1
|
|
304
|
-
else:
|
|
305
|
-
skipped += 1
|
|
306
|
-
|
|
307
|
-
if ws_manager:
|
|
308
|
-
await ws_manager.broadcast({
|
|
309
|
-
"type": "memory_added", "memory_id": imported,
|
|
310
|
-
"timestamp": datetime.now(timezone.utc).isoformat(),
|
|
311
|
-
})
|
|
312
|
-
|
|
313
|
-
except Exception as e:
|
|
314
|
-
if "UNIQUE constraint failed" in str(e):
|
|
315
|
-
skipped += 1
|
|
316
|
-
else:
|
|
317
|
-
logger.warning("import: memory %d failed: %s", idx, e)
|
|
318
|
-
errors.append(f"Memory {idx}: import failed")
|
|
319
|
-
|
|
320
|
-
return {
|
|
321
|
-
"success": True, "imported_count": imported,
|
|
322
|
-
"skipped_count": skipped, "total_processed": len(memories),
|
|
323
|
-
"errors": errors[:10], "operation_ids": operation_ids,
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
except HTTPException:
|
|
327
|
-
raise
|
|
328
|
-
except Exception:
|
|
329
|
-
raise _internal_error("Import error")
|
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2026 Varun Pratap Bhardwaj / Qualixar
|
|
2
|
-
# Licensed under AGPL-3.0-or-later - see LICENSE file
|
|
3
|
-
# Part of SuperLocalMemory V3 | https://qualixar.com | https://varunpratap.com
|
|
4
|
-
|
|
5
|
-
"""Entity compilation API routes — view and recompile entity summaries."""
|
|
6
|
-
|
|
7
|
-
from __future__ import annotations
|
|
8
|
-
|
|
9
|
-
from fastapi import APIRouter, HTTPException, Query, Request
|
|
10
|
-
|
|
11
|
-
from .helpers import get_active_profile, get_read_connection, require_engine
|
|
12
|
-
|
|
13
|
-
router = APIRouter(prefix="/api/entity", tags=["entity"])
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
def _list_entities_sql(where_sql: str) -> str:
|
|
17
|
-
"""Build the page-first entity query after ``where_sql`` is parameterized."""
|
|
18
|
-
return f"""
|
|
19
|
-
WITH page_entities AS MATERIALIZED (
|
|
20
|
-
SELECT ce.entity_id, ce.profile_id, ce.canonical_name,
|
|
21
|
-
ce.entity_type, ce.fact_count, ce.first_seen, ce.last_seen
|
|
22
|
-
FROM canonical_entities ce
|
|
23
|
-
WHERE {where_sql}
|
|
24
|
-
ORDER BY ce.fact_count DESC, ce.entity_id ASC
|
|
25
|
-
LIMIT ? OFFSET ?
|
|
26
|
-
),
|
|
27
|
-
ranked_profiles AS MATERIALIZED (
|
|
28
|
-
SELECT ep.*,
|
|
29
|
-
ROW_NUMBER() OVER (
|
|
30
|
-
PARTITION BY ep.entity_id, ep.profile_id
|
|
31
|
-
ORDER BY COALESCE(ep.last_compiled_at, '') DESC,
|
|
32
|
-
ep.project_name COLLATE NOCASE ASC,
|
|
33
|
-
ep.rowid ASC
|
|
34
|
-
) AS summary_rank
|
|
35
|
-
FROM entity_profiles ep
|
|
36
|
-
JOIN page_entities page
|
|
37
|
-
ON page.entity_id = ep.entity_id
|
|
38
|
-
AND page.profile_id = ep.profile_id
|
|
39
|
-
WHERE ep.profile_id = ?
|
|
40
|
-
)
|
|
41
|
-
SELECT ce.entity_id, ce.canonical_name, ce.entity_type,
|
|
42
|
-
ce.fact_count, ce.first_seen, ce.last_seen,
|
|
43
|
-
ep.knowledge_summary, ep.compiled_truth,
|
|
44
|
-
ep.compilation_confidence, ep.last_compiled_at
|
|
45
|
-
FROM page_entities ce
|
|
46
|
-
LEFT JOIN ranked_profiles ep
|
|
47
|
-
ON ce.entity_id = ep.entity_id
|
|
48
|
-
AND ep.profile_id = ce.profile_id
|
|
49
|
-
AND ep.summary_rank = 1
|
|
50
|
-
ORDER BY ce.fact_count DESC, ce.entity_id ASC
|
|
51
|
-
"""
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
def _require_read(request: Request, profile: str) -> None:
|
|
55
|
-
"""Authorize entity metadata access for the explicitly requested profile."""
|
|
56
|
-
from superlocalmemory.access.rbac import Permission
|
|
57
|
-
from superlocalmemory.server.rbac_enforce import require_permission
|
|
58
|
-
|
|
59
|
-
require_permission(request, Permission.READ, profile=profile)
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
def _require_manage(request: Request, profile: str) -> None:
|
|
63
|
-
"""Authorize entity recompilation for the explicitly requested profile."""
|
|
64
|
-
from superlocalmemory.server.rbac_enforce import require_manage
|
|
65
|
-
|
|
66
|
-
require_manage(request, profile=profile)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
@router.get("/list")
|
|
70
|
-
def list_entities(
|
|
71
|
-
request: Request,
|
|
72
|
-
profile: str | None = Query(default=None),
|
|
73
|
-
entity_type: str | None = Query(default=None, alias="type", max_length=80),
|
|
74
|
-
search: str | None = Query(default=None, max_length=200),
|
|
75
|
-
limit: int = Query(default=100, ge=1, le=1000),
|
|
76
|
-
offset: int = Query(default=0, ge=0),
|
|
77
|
-
):
|
|
78
|
-
"""List a profile's entities, filtering before count and pagination."""
|
|
79
|
-
engine = require_engine(request)
|
|
80
|
-
# Default to the ACTIVE profile (request runtime truth), never the literal
|
|
81
|
-
# "default" — otherwise every profile sees the default profile's entities.
|
|
82
|
-
profile = profile or get_active_profile()
|
|
83
|
-
_require_read(request, profile)
|
|
84
|
-
|
|
85
|
-
conn = get_read_connection(engine._config.db_path)
|
|
86
|
-
try:
|
|
87
|
-
# Hide the placeholder that dated facts with no recognised entity
|
|
88
|
-
# attach their temporal events to (core/store_pipeline.py,
|
|
89
|
-
# _ensure_unresolved_entity). It is a hook for a foreign key, not a
|
|
90
|
-
# concept, and it would otherwise appear here as a nameless entity and
|
|
91
|
-
# be counted in the total the owner reads as "entities I have".
|
|
92
|
-
#
|
|
93
|
-
# Only the presentation layer needs this. The other readers of
|
|
94
|
-
# canonical_entities are unaffected on inspection: graph_pruner uses
|
|
95
|
-
# `NOT IN (SELECT entity_id ...)` to find orphaned edges, where
|
|
96
|
-
# including it is correct; community_summary builds from graph edges and
|
|
97
|
-
# the placeholder has none; scale_engine counts for backend sync, not
|
|
98
|
-
# for display.
|
|
99
|
-
where = ["ce.profile_id = ?", "ce.entity_type != 'unresolved'"]
|
|
100
|
-
params: list[object] = [profile]
|
|
101
|
-
if entity_type and entity_type.lower() != "all":
|
|
102
|
-
where.append("ce.entity_type = ? COLLATE NOCASE")
|
|
103
|
-
params.append(entity_type.strip().lower())
|
|
104
|
-
if search and search.strip():
|
|
105
|
-
escaped = (search.strip().lower().replace("\\", "\\\\")
|
|
106
|
-
.replace("%", "\\%").replace("_", "\\_"))
|
|
107
|
-
where.append(
|
|
108
|
-
"(LOWER(ce.canonical_name) LIKE ? ESCAPE '\\' "
|
|
109
|
-
"OR LOWER(COALESCE(ce.entity_type, 'unknown')) LIKE ? ESCAPE '\\' "
|
|
110
|
-
"OR EXISTS ("
|
|
111
|
-
"SELECT 1 FROM entity_profiles eps "
|
|
112
|
-
"WHERE eps.entity_id = ce.entity_id "
|
|
113
|
-
"AND eps.profile_id = ce.profile_id "
|
|
114
|
-
"AND LOWER(COALESCE(eps.knowledge_summary, '')) "
|
|
115
|
-
"LIKE ? ESCAPE '\\'))"
|
|
116
|
-
)
|
|
117
|
-
params.extend([f"%{escaped}%"] * 3)
|
|
118
|
-
where_sql = " AND ".join(where)
|
|
119
|
-
|
|
120
|
-
total = conn.execute(
|
|
121
|
-
"SELECT COUNT(*) FROM canonical_entities ce "
|
|
122
|
-
f"WHERE {where_sql}",
|
|
123
|
-
params,
|
|
124
|
-
).fetchone()[0]
|
|
125
|
-
|
|
126
|
-
rows = conn.execute(
|
|
127
|
-
_list_entities_sql(where_sql),
|
|
128
|
-
[*params, limit, offset, profile],
|
|
129
|
-
).fetchall()
|
|
130
|
-
|
|
131
|
-
entities = []
|
|
132
|
-
for r in rows:
|
|
133
|
-
summary = r["knowledge_summary"] or ""
|
|
134
|
-
entities.append({
|
|
135
|
-
"entity_id": r["entity_id"],
|
|
136
|
-
"name": r["canonical_name"],
|
|
137
|
-
"type": r["entity_type"] or "unknown",
|
|
138
|
-
"fact_count": r["fact_count"] or 0,
|
|
139
|
-
"first_seen": r["first_seen"],
|
|
140
|
-
"last_seen": r["last_seen"],
|
|
141
|
-
"summary_preview": summary[:200] if summary else "",
|
|
142
|
-
"has_compiled_truth": bool(r["compiled_truth"]),
|
|
143
|
-
"confidence": r["compilation_confidence"] or 0.5,
|
|
144
|
-
"last_compiled_at": r["last_compiled_at"],
|
|
145
|
-
})
|
|
146
|
-
|
|
147
|
-
return {
|
|
148
|
-
"entities": entities,
|
|
149
|
-
"total": total,
|
|
150
|
-
"limit": limit,
|
|
151
|
-
"offset": offset,
|
|
152
|
-
"has_more": offset + limit < total,
|
|
153
|
-
}
|
|
154
|
-
finally:
|
|
155
|
-
conn.close()
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
@router.get("/{entity_name}")
|
|
159
|
-
def get_entity(
|
|
160
|
-
entity_name: str,
|
|
161
|
-
request: Request,
|
|
162
|
-
profile: str | None = Query(default=None),
|
|
163
|
-
project: str = Query(default=""),
|
|
164
|
-
):
|
|
165
|
-
"""Get compiled truth + timeline for an entity."""
|
|
166
|
-
engine = require_engine(request)
|
|
167
|
-
profile = profile or get_active_profile()
|
|
168
|
-
_require_read(request, profile)
|
|
169
|
-
|
|
170
|
-
import json
|
|
171
|
-
conn = get_read_connection(engine._config.db_path)
|
|
172
|
-
try:
|
|
173
|
-
# Search by canonical_name (case-insensitive)
|
|
174
|
-
row = conn.execute("""
|
|
175
|
-
SELECT ep.compiled_truth, ep.timeline, ep.fact_ids_json,
|
|
176
|
-
ep.last_compiled_at, ep.compilation_confidence,
|
|
177
|
-
ep.knowledge_summary, ce.entity_type
|
|
178
|
-
FROM entity_profiles ep
|
|
179
|
-
JOIN canonical_entities ce ON ep.entity_id = ce.entity_id
|
|
180
|
-
WHERE LOWER(ce.canonical_name) = LOWER(?)
|
|
181
|
-
AND ep.profile_id = ?
|
|
182
|
-
AND ep.project_name = ?
|
|
183
|
-
""", (entity_name, profile, project)).fetchone()
|
|
184
|
-
|
|
185
|
-
if not row:
|
|
186
|
-
raise HTTPException(404, detail=f"Entity '{entity_name}' not found")
|
|
187
|
-
|
|
188
|
-
return {
|
|
189
|
-
"entity_name": entity_name,
|
|
190
|
-
"entity_type": row["entity_type"],
|
|
191
|
-
"compiled_truth": row["compiled_truth"] or "",
|
|
192
|
-
"knowledge_summary": row["knowledge_summary"] or "",
|
|
193
|
-
"timeline": json.loads(row["timeline"]) if row["timeline"] else [],
|
|
194
|
-
"source_fact_ids": json.loads(row["fact_ids_json"]) if row["fact_ids_json"] else [],
|
|
195
|
-
"last_compiled_at": row["last_compiled_at"],
|
|
196
|
-
"confidence": row["compilation_confidence"],
|
|
197
|
-
}
|
|
198
|
-
finally:
|
|
199
|
-
conn.close()
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
@router.post("/{entity_name}/recompile")
|
|
203
|
-
def recompile_entity(
|
|
204
|
-
entity_name: str,
|
|
205
|
-
request: Request,
|
|
206
|
-
profile: str | None = Query(default=None),
|
|
207
|
-
project: str = Query(default=""),
|
|
208
|
-
):
|
|
209
|
-
"""Force immediate recompilation of an entity."""
|
|
210
|
-
engine = require_engine(request)
|
|
211
|
-
profile = profile or get_active_profile()
|
|
212
|
-
_require_manage(request, profile)
|
|
213
|
-
|
|
214
|
-
import sqlite3
|
|
215
|
-
conn = sqlite3.connect(str(engine._config.db_path))
|
|
216
|
-
conn.row_factory = sqlite3.Row
|
|
217
|
-
try:
|
|
218
|
-
entity = conn.execute(
|
|
219
|
-
"SELECT entity_id, canonical_name, entity_type FROM canonical_entities "
|
|
220
|
-
"WHERE LOWER(canonical_name) = LOWER(?) AND profile_id = ?",
|
|
221
|
-
(entity_name, profile),
|
|
222
|
-
).fetchone()
|
|
223
|
-
|
|
224
|
-
if not entity:
|
|
225
|
-
raise HTTPException(404, detail=f"Entity '{entity_name}' not found")
|
|
226
|
-
|
|
227
|
-
from superlocalmemory.learning.entity_compiler import EntityCompiler
|
|
228
|
-
compiler = EntityCompiler(str(engine._config.db_path), engine._config)
|
|
229
|
-
result = compiler.compile_entity(
|
|
230
|
-
profile, project, entity["entity_id"], entity["canonical_name"],
|
|
231
|
-
)
|
|
232
|
-
|
|
233
|
-
if result:
|
|
234
|
-
return {"ok": True, **result}
|
|
235
|
-
return {"ok": False, "reason": "no facts to compile"}
|
|
236
|
-
finally:
|
|
237
|
-
conn.close()
|