Pi sync: providers registry, db, main updates#20
Pi sync: providers registry, db, main updates#20blackboxprogramming wants to merge 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR synchronizes the Lucidia Pi environment back into the repo, replacing the prior experimental Lucidia/LLM code with a much slimmer HTTP surface (FastAPI + SQLite + simple provider registry) and checking in the Pi’s Python runtime environment (Flask, Click, Blinker, MarkupSafe, distutils hack, etc.).
Changes:
- Add a minimal FastAPI service (
main.py) exposing health, simple key/value memory via SQLite, provider capability discovery, placeholder tool calls, and a completion bridge to a local model server. - Introduce a lightweight provider registry (
providers/registry.py) keyed off environment variables to gate tool availability. - Add a small Flask app entrypoint under
core/app.pyplus multiple vendored third-party packages and dist-info from the Pi virtualenv; remove most of the prior Lucidia, Codex, and LLM scaffolding and automation workflows.
Reviewed changes
Copilot reviewed 212 out of 1195 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| runtime/venv/lib/python3.11/site-packages/flask/blueprints.py | Vendored Flask blueprint implementation from Pi venv. |
| runtime/venv/lib/python3.11/site-packages/flask/main.py | Vendored Flask CLI entrypoint. |
| runtime/venv/lib/python3.11/site-packages/flask/init.py | Vendored Flask package init. |
| runtime/venv/lib/python3.11/site-packages/flask-3.1.1.dist-info/licenses/LICENSE.txt | Vendored Flask license metadata. |
| runtime/venv/lib/python3.11/site-packages/flask-3.1.1.dist-info/entry_points.txt | Vendored Flask entry point metadata. |
| runtime/venv/lib/python3.11/site-packages/flask-3.1.1.dist-info/WHEEL | Vendored Flask wheel metadata. |
| runtime/venv/lib/python3.11/site-packages/flask-3.1.1.dist-info/RECORD | Vendored Flask record file. |
| runtime/venv/lib/python3.11/site-packages/flask-3.1.1.dist-info/METADATA | Vendored Flask package metadata. |
| runtime/venv/lib/python3.11/site-packages/flask-3.1.1.dist-info/INSTALLER | Vendored Flask installer marker. |
| runtime/venv/lib/python3.11/site-packages/distutils-precedence.pth | Vendored distutils hack shim. |
| runtime/venv/lib/python3.11/site-packages/click/globals.py | Vendored Click globals. |
| runtime/venv/lib/python3.11/site-packages/click/_textwrap.py | Vendored Click text wrapping helper. |
| runtime/venv/lib/python3.11/site-packages/click/init.py | Vendored Click package init. |
| runtime/venv/lib/python3.11/site-packages/click-8.2.1.dist-info/licenses/LICENSE.txt | Vendored Click license. |
| runtime/venv/lib/python3.11/site-packages/click-8.2.1.dist-info/WHEEL | Vendored Click wheel metadata. |
| runtime/venv/lib/python3.11/site-packages/click-8.2.1.dist-info/RECORD | Vendored Click record file. |
| runtime/venv/lib/python3.11/site-packages/click-8.2.1.dist-info/METADATA | Vendored Click metadata. |
| runtime/venv/lib/python3.11/site-packages/click-8.2.1.dist-info/INSTALLER | Vendored Click installer marker. |
| runtime/venv/lib/python3.11/site-packages/blinker/_utilities.py | Vendored Blinker utilities. |
| runtime/venv/lib/python3.11/site-packages/blinker/init.py | Vendored Blinker package init. |
| runtime/venv/lib/python3.11/site-packages/blinker-1.9.0.dist-info/WHEEL | Vendored Blinker wheel metadata. |
| runtime/venv/lib/python3.11/site-packages/blinker-1.9.0.dist-info/RECORD | Vendored Blinker record file. |
| runtime/venv/lib/python3.11/site-packages/blinker-1.9.0.dist-info/METADATA | Vendored Blinker metadata. |
| runtime/venv/lib/python3.11/site-packages/blinker-1.9.0.dist-info/LICENSE.txt | Vendored Blinker license. |
| runtime/venv/lib/python3.11/site-packages/blinker-1.9.0.dist-info/INSTALLER | Vendored Blinker installer marker. |
| runtime/venv/lib/python3.11/site-packages/_distutils_hack/override.py | Vendored distutils override shim. |
| runtime/venv/lib/python3.11/site-packages/_distutils_hack/init.py | Vendored distutils hack implementation. |
| runtime/venv/lib/python3.11/site-packages/MarkupSafe-3.0.2.dist-info/top_level.txt | Vendored MarkupSafe top-level metadata. |
| runtime/venv/lib/python3.11/site-packages/MarkupSafe-3.0.2.dist-info/WHEEL | Vendored MarkupSafe wheel metadata. |
| runtime/venv/lib/python3.11/site-packages/MarkupSafe-3.0.2.dist-info/RECORD | Vendored MarkupSafe record file. |
| runtime/venv/lib/python3.11/site-packages/MarkupSafe-3.0.2.dist-info/METADATA | Vendored MarkupSafe metadata. |
| runtime/venv/lib/python3.11/site-packages/MarkupSafe-3.0.2.dist-info/LICENSE.txt | Vendored MarkupSafe license. |
| runtime/venv/lib/python3.11/site-packages/MarkupSafe-3.0.2.dist-info/INSTALLER | Vendored MarkupSafe installer marker. |
| quick_blackroad_test.sh | Removed helper script for BlackRoad status checks. |
| quantum/teleportation.py | Removed placeholder quantum demo. |
| quantum/q_simulation.py | Removed placeholder quantum demo. |
| quantum/q_gates.py | Removed placeholder quantum demo. |
| quantum/q_errors.py | Removed placeholder quantum demo. |
| quantum/q_comms.py | Removed placeholder quantum demo. |
| quantum/q_algorithms.py | Removed basic quantum algorithms demo. |
| quantum/measurement.py | Removed quantum measurement demo. |
| quantum/entanglement.py | Removed Bell-state entanglement demo. |
| quantum/decoherence.py | Removed decoherence simulation demo. |
| quantum/coherence.py | Removed coherence measure demo. |
| providers/registry.py | New provider registry and feature-flag mechanism for external tools. |
| providers/init.py | Exposes provider registry functions. |
| ollama_phi_bridge/hello.py | Removed placeholder. |
| novel_ideas/lucidia_novel_ideas.md | Removed conceptual Lucidia ideas doc. |
| novel_ideas/brainstorm_ideas.md | Removed additional brainstorming doc. |
| main.py | New FastAPI app for Lucidia health, memory, provider tools, and completion bridge. |
| lucidia_quantum_loop.sh | Removed Lucidia quantum loop maintenance script. |
| lucidia_memory_core/hello.py | Removed placeholder. |
| lucidia_master_init_prompt.md | Removed Lucidia initialization prompt spec. |
| lucidia_llm/training/sft.py | Removed stub SFT training script. |
| lucidia_llm/training/rlhf.py | Removed stub RLHF training script. |
| lucidia_llm/training/pretrain.py | Removed stub pretraining script. |
| lucidia_llm/tokenizer/train_tokenizer.py | Removed tokenizer training stub. |
| lucidia_llm/tokenizer/spm.yaml | Removed SentencePiece config. |
| lucidia_llm/scripts/serve_local.sh | Removed LLM serve stub. |
| lucidia_llm/scripts/run_tokenizer.sh | Removed tokenizer script stub. |
| lucidia_llm/scripts/run_sft.sh | Removed SFT script stub. |
| lucidia_llm/scripts/run_rlhf.sh | Removed RLHF script stub. |
| lucidia_llm/scripts/run_pretrain.sh | Removed pretrain script stub. |
| lucidia_llm/lucidia_rewards/truth_rm.py | Removed reward model stub. |
| lucidia_llm/lucidia_rewards/score_examples.py | Removed reward scoring stub. |
| lucidia_llm/lucidia_rewards/love_rm.py | Removed reward model stub. |
| lucidia_llm/lucidia_rewards/consent_rm.py | Removed reward model stub. |
| lucidia_llm/lucidia_memory/store.py | Removed embedding memory store stub. |
| lucidia_llm/lucidia_memory/self_embed.py | Removed self-embedding stub. |
| lucidia_llm/lucidia_core/tokenizer_wrap.py | Removed tokenizer wrapper stub. |
| lucidia_llm/lucidia_core/quantize.py | Removed quantization stub. |
| lucidia_llm/lucidia_core/model.py | Removed Transformer model stub. |
| lucidia_llm/lucidama/serve.py | Removed Lucidia REPL server. |
| lucidia_llm/evaluator/eval_suite.py | Removed evaluation suite stub. |
| lucidia_llm/data/schemas.md | Removed dataset schema doc. |
| lucidia_llm/data/build_sft.py | Removed SFT dataset builder stub. |
| lucidia_llm/data/build_rlhf_pairs.py | Removed RLHF pairs builder stub. |
| lucidia_llm/data/build_pretrain.py | Removed pretrain dataset builder stub. |
| lucidia_llm/configs/train.yaml | Removed training config. |
| lucidia_llm/configs/runtime.yaml | Removed runtime config. |
| lucidia_llm/configs/model.yaml | Removed model config. |
| lucidia_llm/PROMPT.md | Removed Lucidia constitution prompt. |
| lucidia_genome.json | Removed Lucidia genome definition. |
| lucidia_codex/validated/coherence_equation.py | Removed validated coherence equation implementation. |
| lucidia_codex/test_harness/equation_validator.py | Removed coherence equation test harness. |
| lucidia_codex/equation_status.json | Removed equation validation status file. |
| lucidia_chat_phi.py | Removed local Lucidia chat script. |
| lucidia_build/init.py | Removed Lucidia build package initializer. |
| lucidia/video_agent.py | Removed video agent implementation. |
| lucidia/truth_agent.py | Removed truth agent implementation. |
| lucidia/substrate_performance_optimizer.py | Removed substrate optimizer module. |
| lucidia/spiral_agent.py | Removed spiral agent module. |
| lucidia/quantum_agent.py | Removed quantum agent module. |
| lucidia/memory_manager.py | Removed Lucidia memory manager. |
| lucidia/lucidia_logic.py | Removed Lucidia trinary logic implementation. |
| lucidia/guardian_agent.py | Removed guardian agent implementation. |
| lucidia/equations/contradiction_coherence.md | Removed contradiction–coherence equation doc. |
| lucidia/emotional_agent.py | Removed emotional agent module. |
| lucidia/core.py | Removed Lucidia core conversational agent implementation. |
| lucidia/contradiction_log.py | Removed contradiction log module. |
| lucidia/contradiction_agent.py | Removed contradiction agent module. |
| lucidia/codex_recursion.py | Removed codex recursion module. |
| lucidia/chatgpt_agent.py | Removed ChatGPT agent wrapper. |
| lucidia/init.py | Removed Lucidia package init and exports. |
| lucidia/SeedIdentityDetector.js | Removed SeedIdentityDetector JS stub. |
| lucidia/.gitkeep | Removed empty placeholder. |
| learning/training.txt | Removed training note. |
| hybrid/multi_modal_processing.py | Removed multimodal processing helpers. |
| hybrid/integration_strategy.py | Removed integration strategy helper. |
| hybrid/hybrid_logic.py | Removed hybrid logic container. |
| hybrid/human_ai_interfaces.py | Removed human-AI interface definitions. |
| hybrid/environment_bridge.py | Removed environment bridge. |
| hybrid/emotional_sync.py | Removed emotional synchronizer. |
| hybrid/dynamic_role_assignment.py | Removed dynamic role assignment. |
| hybrid/cross_domain_reasoning.py | Removed cross-domain reasoner. |
| hybrid/continuity_management.py | Removed continuity manager. |
| hybrid/adaptive_learning.py | Removed adaptive learner. |
| human_machine/trust_model.py | Removed human-machine trust model. |
| human_machine/reinforcement.py | Removed basic RL agent. |
| human_machine/learning_loop.py | Removed learning loop helper. |
| human_machine/interface_design.py | Removed interface design helper. |
| human_machine/feedback_mechanisms.py | Removed feedback manager. |
| human_machine/empathy_engine.py | Removed empathy engine. |
| human_machine/decision_support.py | Removed decision support. |
| human_machine/context_awareness.py | Removed context-aware system. |
| human_machine/collaboration_protocols.py | Removed collaboration protocols. |
| human_machine/cognition_integration.py | Removed cognition integrator. |
| human_machine/adaptation.py | Removed adaptive system. |
| guardian_agent.py | Removed top-level guardian agent wrapper. |
| guardian.py | Removed simple Guardian REPL. |
| git pull | Removed helper text file with git commands. |
| deployment_scripts/hello.py | Removed placeholder. |
| core/app.py | New minimal Flask app serving a static home page. |
| collaboration_platform_checklist.md | Removed collaboration platform checklist doc. |
| coding/version_control.py | Removed placeholder. |
| coding/testing_framework.py | Removed placeholder. |
| coding/syntax_analysis.py | Removed placeholder. |
| coding/package_management.py | Removed placeholder. |
| coding/documentation_generator.py | Removed placeholder. |
| coding/deployment_workflow.py | Removed placeholder. |
| coding/debugging_tools.py | Removed placeholder. |
| coding/code_optimization.py | Removed placeholder. |
| coding/code_generation.py | Removed placeholder. |
| coding/ci_cd.py | Removed placeholder. |
| codex_agent/agent.py | Removed Codex agent implementation. |
| codex_agent/.gitkeep | Removed placeholder. |
| codex/truth_table.py | Removed trinary truth table. |
| codex/state_transition.py | Removed state machine module. |
| codex/recursion_engine.py | Removed recursion engine. |
| codex/perturbation_logic.py | Removed perturbation helper. |
| codex/operator_definition.py | Removed operator registry. |
| codex/mirror/thermodynamic_entropy_mirror.py | Removed thermodynamic mirror implementation. |
| codex/mirror/number_mirror_mu.py | Removed Möbius mirror implementation. |
| codex/mirror/mirror_mechanics.py | Removed oscillator mirror mechanics. |
| codex/mirror/mirror_friend_equation.md | Removed mirror friend equation doc. |
| codex/mirror/graph_network_mirror.py | Removed graph mirror implementation. |
| codex/mirror/capability_optimizer.py | Removed mirror capability optimizer. |
| codex/mirror/README_thermodynamic_entropy.md | Removed thermodynamic mirror README. |
| codex/mirror/README_qi.md | Removed quantum mirror README. |
| codex/mirror/README_graph_network.md | Removed graph mirror README. |
| codex/mirror/README.md | Removed mirror modules index. |
| codex/memory_serialization.py | Removed memory serialization helper. |
| codex/logic_parser.py | Removed simple logic parser. |
| codex/contradiction_resolution.py | Removed contradiction resolution helper. |
| codex/codex_loader.py | Removed codex loader. |
| codex/agent_descriptions.py | Removed agent descriptions. |
| codex-agent-runner/README.md | Removed codex agent runner README. |
| changes.sh | Removed helper script for committing/pushing. |
| cadillac_detector.py | Removed Cadillac detector stub. |
| blackroad_site/docs/MANIFESTO.md | Removed manifesto document. |
| blackroad_site/assets/IMG_7125.PNG | Removed Cloudflare HTML placeholder masquerading as PNG. |
| blackroad_site/assets/IMG_1775.PNG | Same as above. |
| blackroad_site/assets/A9EFF2D3.PNG | Same as above. |
| blackroad_site/assets/63B40EFA.PNG | Same as above. |
| blackroad_site/assets/21CBD79F.PNG | Same as above. |
| blackroad_api_core/hello.py | Removed placeholder. |
| blackroad.io | Removed submodule pointer. |
| agents_bootstrap/hello.py | Removed placeholder. |
| _write_lucidia.py | Script that writes providers/registry.py and main.py into the repo. |
| Roadie/agent.py | Removed Roadie agent implementation. |
| Roadie/.gitkeep | Removed placeholder. |
| README.md | Removed repo-level README. |
| LICENSE | Removed proprietary license text. |
| Elias/agent.py | Removed Elias agent implementation. |
| Elias/.gitkeep | Removed placeholder. |
| CONTRIBUTING.md | Removed contributing guidelines. |
| .sh | Removed helper for git push. |
| .github/workflows/project-sync.yml | Removed workflow to add PRs to a project board. |
| .github/workflows/failure-issue.yml | Removed CI failure issue workflow. |
| .github/workflows/deploy.yml | Removed Cloudflare deploy workflow. |
| .github/workflows/core-ci.yml | Removed basic core CI workflow. |
| .github/workflows/auto-label.yml | Removed auto-label workflow. |
| .gitattributes | Removed Git LFS and text attributes configuration. |
Comments suppressed due to low confidence (2)
providers/registry.py:1
/agent/capabilitiesreturns provider IDs like"slack"and"asana", whereascall_toolexpects fully-qualified tool names such as"slack.say"and"asana.me", which can be ambiguous for API consumers. It would be clearer to either expose the actual callable tool identifiers (e.g."slack.say","asana.me") in the capabilities response or include a mapping from provider to supported tools so clients can discover validtoolvalues programmatically.
import os
_write_lucidia.py:1
- This script embeds full string copies of
providers/registry.pyandmain.pywhile those files are also checked into the repo, which creates duplication and a high risk of the script falling out of sync with the actual source files. It would be more maintainable to either remove this generator now that the files are version-controlled, or refactor it to read from the canonical modules (or templates) instead of duplicating their contents inline.
from pathlib import Path
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import os, sqlite3 | ||
| from typing import Optional, Dict, Any | ||
| from fastapi import FastAPI, HTTPException | ||
| from pydantic import BaseModel | ||
| from providers import get_enabled, call_tool | ||
|
|
||
| # ---- tiny sqlite memory ---- | ||
| DB_PATH = "/home/pi/lucidia/lucidia.db" | ||
| conn = sqlite3.connect(DB_PATH, check_same_thread=False) | ||
| conn.execute("CREATE TABLE IF NOT EXISTS memory (k TEXT PRIMARY KEY, v TEXT)") |
There was a problem hiding this comment.
The global SQLite connection with check_same_thread=False can lead to subtle race conditions and locking issues under FastAPI's concurrent request handling. Consider creating a connection per request (or per thread) via a dependency, or using a connection pool pattern, and avoid sharing a single connection across all requests.
| from providers import get_enabled, call_tool | ||
|
|
||
| # ---- tiny sqlite memory ---- | ||
| DB_PATH = "/home/pi/lucidia/lucidia.db" |
There was a problem hiding this comment.
Hard-coding an absolute path to the SQLite database under /home/pi/... makes this service brittle outside that specific host; it will fail or write to an unexpected location in other environments. It would be more robust to take the DB path from an environment variable or configuration with a sensible default and ensure the directory exists at startup.
| DB_PATH = "/home/pi/lucidia/lucidia.db" | |
| DB_DEFAULT_PATH = os.path.join(os.getcwd(), "lucidia.db") | |
| DB_PATH = os.getenv("LUCIDIA_DB_PATH", DB_DEFAULT_PATH) | |
| db_dir = os.path.dirname(DB_PATH) | |
| if db_dir: | |
| os.makedirs(db_dir, exist_ok=True) |
| import os, sqlite3 | ||
| from typing import Optional, Dict, Any | ||
| from fastapi import FastAPI, HTTPException | ||
| from pydantic import BaseModel |
There was a problem hiding this comment.
BaseModel is imported twice in the same module, once at the top and again near the /agent/complete endpoint, which is redundant and can be confusing. Removing the second import and grouping all imports at the top of the file will keep the module cleaner.
| from pydantic import BaseModel | ||
| import json, urllib.request |
There was a problem hiding this comment.
BaseModel is imported twice in the same module, once at the top and again near the /agent/complete endpoint, which is redundant and can be confusing. Removing the second import and grouping all imports at the top of the file will keep the module cleaner.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 41618f2509
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| DB_PATH = "/home/pi/lucidia/lucidia.db" | ||
| conn = sqlite3.connect(DB_PATH, check_same_thread=False) |
There was a problem hiding this comment.
Hard-coding the database location to /home/pi/lucidia/lucidia.db makes the app fail to start anywhere that path doesn’t exist (e.g., local dev, CI, or Docker). In those environments sqlite3.connect raises “unable to open database file” because the parent directory is missing, so the whole FastAPI app crashes on import. Consider making the path configurable (env var) or resolving it relative to the repo so the committed lucidia.db can be used.
Useful? React with 👍 / 👎.
Summary
Source
Direct sync from lucidia Pi (192.168.4.38)