chaoscypher-cortex 0.1.0__tar.gz
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.
- chaoscypher_cortex-0.1.0/PKG-INFO +296 -0
- chaoscypher_cortex-0.1.0/README.md +258 -0
- chaoscypher_cortex-0.1.0/pyproject.toml +67 -0
- chaoscypher_cortex-0.1.0/setup.cfg +4 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/__init__.py +4 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/api/__init__.py +4 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/api/v1/__init__.py +4 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/api/v1/router.py +164 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/app_factory.py +295 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/boot.py +45 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/__init__.py +10 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/admin_plugins/__init__.py +14 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/admin_plugins/api.py +29 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/admin_plugins/service.py +44 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/backup/__init__.py +18 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/backup/api.py +161 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/backup/models.py +36 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/backup/service.py +85 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/chats/__init__.py +46 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/chats/api.py +889 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/chats/models.py +173 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/chats/repository.py +99 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/chats/service.py +146 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/counts/__init__.py +41 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/counts/api.py +79 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/counts/models.py +12 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/dashboard/__init__.py +20 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/dashboard/api.py +108 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/dashboard/models.py +26 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/dashboard/service.py +114 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/databases/__init__.py +43 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/databases/api.py +189 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/databases/models.py +56 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/databases/service.py +156 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/diagnostics/__init__.py +29 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/diagnostics/api.py +105 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/diagnostics/models.py +18 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/diagnostics/service.py +143 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/edges/__init__.py +42 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/edges/api.py +314 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/edges/models.py +41 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/edition/__init__.py +28 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/edition/api.py +79 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/edition/models.py +55 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/export/__init__.py +41 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/export/api.py +260 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/export/models.py +25 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/export/service.py +169 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/graph/__init__.py +38 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/graph/api.py +170 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/graph/grounding_api.py +358 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/graph/grounding_service.py +331 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/graph/models.py +168 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/graph/service.py +235 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/graph_snapshot/__init__.py +37 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/graph_snapshot/api.py +194 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/graph_snapshot/models.py +14 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/graph_snapshot/service.py +94 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/health/__init__.py +36 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/health/api.py +202 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/health/models.py +44 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/health/service.py +513 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/lexicon/__init__.py +21 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/lexicon/api.py +585 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/llm/__init__.py +39 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/llm/api.py +261 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/llm/models.py +46 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/llm/service.py +110 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/local_auth/__init__.py +9 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/local_auth/api.py +343 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/local_auth/auth_failure_tracker.py +59 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/local_auth/models.py +87 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/local_auth/service.py +229 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/logs/__init__.py +31 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/logs/api.py +144 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/logs/models.py +52 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/logs/service.py +273 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/mcp/__init__.py +10 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/mcp/api.py +118 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/mcp/service.py +118 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/nodes/__init__.py +56 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/nodes/api.py +451 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/nodes/graph_repository.py +57 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/nodes/models.py +118 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/nodes/service.py +558 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/nodes/sql_repository.py +401 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/pause/__init__.py +35 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/pause/api.py +282 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/pause/models.py +178 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/pause/repository.py +100 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/pause/service.py +171 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/quality/__init__.py +14 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/quality/api.py +363 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/quality/models.py +239 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/quality/service.py +682 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/quality/startup.py +83 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/queue/__init__.py +41 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/queue/api.py +483 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/queue/models.py +249 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/queue/service.py +344 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/search/__init__.py +36 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/search/api.py +234 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/search/models.py +146 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/search/probe.py +51 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/search/service.py +442 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/settings/__init__.py +60 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/settings/api.py +1227 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/settings/logging_service.py +128 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/settings/models.py +489 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/settings/ollama_models_api.py +207 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/settings/ollama_models_service.py +329 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/settings/service.py +623 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/settings/tls_service.py +140 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/settings/trigger_sync_service.py +95 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/settings_public/__init__.py +8 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/settings_public/api.py +58 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/settings_public/models.py +97 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/settings_public/service.py +68 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/sources/__init__.py +64 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/sources/api.py +1014 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/sources/chunk_attempts_api.py +102 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/sources/chunk_attempts_service.py +61 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/sources/chunk_rerun_api.py +95 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/sources/chunk_rerun_service.py +141 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/sources/chunks_api.py +387 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/sources/extraction_api.py +559 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/sources/mappers.py +196 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/sources/models.py +1804 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/sources/progress.py +142 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/sources/service.py +2005 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/sources/tag_service.py +102 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/sources/tags_api.py +165 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/sources/upload_service.py +335 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/sources/vision_pages_api.py +220 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/sources/vision_pages_repository.py +78 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/sources/vision_pages_service.py +306 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/templates/__init__.py +43 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/templates/api.py +369 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/templates/models.py +54 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/tools/__init__.py +40 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/tools/api.py +274 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/tools/models.py +119 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/triggers/__init__.py +43 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/triggers/api.py +255 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/triggers/models.py +67 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/upgrade/__init__.py +15 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/upgrade/api.py +73 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/workflows/__init__.py +48 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/workflows/api.py +680 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/workflows/execution_api.py +292 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/features/workflows/models.py +299 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/lifespan.py +559 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/main.py +138 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/middleware.py +201 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/py.typed +0 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/shared/__init__.py +13 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/shared/api/__init__.py +58 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/shared/api/dependencies.py +127 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/shared/api/errors.py +403 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/shared/api/models.py +66 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/shared/api/responses.py +129 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/shared/auth/__init__.py +24 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/shared/auth/dependencies.py +149 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/shared/database/__init__.py +16 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/shared/database/session.py +65 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/shared/errors/__init__.py +11 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/shared/errors/branded_page.py +240 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/shared/errors/host_blocked.py +51 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/shared/health/__init__.py +9 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/shared/health/probes.py +34 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/shared/kernel/__init__.py +35 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/shared/kernel/responses.py +46 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/shared/middleware/__init__.py +19 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/shared/middleware/adapter_cleanup.py +44 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/shared/middleware/correlation.py +38 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/shared/middleware/host_header.py +121 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/shared/middleware/rate_limit.py +137 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/shared/middleware/security_headers.py +49 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/shared/models/__init__.py +31 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/shared/models/summaries.py +66 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/shared/repositories/__init__.py +20 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/shared/repositories/bundle.py +90 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/shared/service_factory.py +187 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/shared/utils/__init__.py +4 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/shared/utils/client_ip.py +62 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex/shutdown.py +53 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex.egg-info/PKG-INFO +296 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex.egg-info/SOURCES.txt +190 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex.egg-info/dependency_links.txt +1 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex.egg-info/entry_points.txt +2 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex.egg-info/requires.txt +21 -0
- chaoscypher_cortex-0.1.0/src/chaoscypher_cortex.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: chaoscypher-cortex
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Chaos Cypher Cortex - Full-featured knowledge graph platform (processing center)
|
|
5
|
+
Author-email: Denis MacPherson <denis@chaoscypher.com>
|
|
6
|
+
License-Expression: AGPL-3.0-only
|
|
7
|
+
Project-URL: Homepage, https://github.com/chaoscypherinc/chaoscypher
|
|
8
|
+
Project-URL: Documentation, https://github.com/chaoscypherinc/chaoscypher#readme
|
|
9
|
+
Project-URL: Repository, https://github.com/chaoscypherinc/chaoscypher
|
|
10
|
+
Project-URL: Issues, https://github.com/chaoscypherinc/chaoscypher/issues
|
|
11
|
+
Keywords: knowledge-graph,api,fastapi,ai,workflows
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
16
|
+
Requires-Python: >=3.14
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
Requires-Dist: chaoscypher-core>=0.1.0
|
|
19
|
+
Requires-Dist: fastapi<1,>=0.135.0
|
|
20
|
+
Requires-Dist: uvicorn<1,>=0.44.0
|
|
21
|
+
Requires-Dist: sqlmodel<0.1,>=0.0.38
|
|
22
|
+
Requires-Dist: pydantic<3,>=2.12.0
|
|
23
|
+
Requires-Dist: pydantic-settings<3,>=2.13.0
|
|
24
|
+
Requires-Dist: email-validator<3,>=2.3.0
|
|
25
|
+
Requires-Dist: python-dotenv<2,>=1.2.0
|
|
26
|
+
Requires-Dist: dynaconf<4,>=3.2.13
|
|
27
|
+
Requires-Dist: valkey<7,>=6.1.0
|
|
28
|
+
Requires-Dist: python-multipart<0.1,>=0.0.24
|
|
29
|
+
Requires-Dist: sse-starlette<4,>=3.3.0
|
|
30
|
+
Requires-Dist: structlog<26,>=25.5.0
|
|
31
|
+
Requires-Dist: mcp<2,>=1.27.0
|
|
32
|
+
Requires-Dist: zxcvbn<5,>=4.5.0
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: pytest<10,>=9.0.0; extra == "dev"
|
|
35
|
+
Requires-Dist: pytest-cov<8,>=7.1.0; extra == "dev"
|
|
36
|
+
Requires-Dist: pytest-asyncio<2,>=1.3.0; extra == "dev"
|
|
37
|
+
Requires-Dist: httpx<1,>=0.28.0; extra == "dev"
|
|
38
|
+
|
|
39
|
+
# ChaosCypher Cortex
|
|
40
|
+
|
|
41
|
+
**Full-featured knowledge graph backend API - Processing center**
|
|
42
|
+
|
|
43
|
+
Cortex is the main backend API for ChaosCypher, providing comprehensive CRUD operations, workflow execution, document source processing, AI-powered chat, and knowledge graph management using Vertical Slice Architecture (VSA).
|
|
44
|
+
|
|
45
|
+
## Features
|
|
46
|
+
|
|
47
|
+
- 📊 **Knowledge Graph Management**: Full CRUD for nodes, edges, and templates
|
|
48
|
+
- 💬 **AI Chat**: Conversational interface with RAG and tool use
|
|
49
|
+
- 📁 **Document Source Processing**: Process PDFs, text files, CSVs into knowledge graphs
|
|
50
|
+
- 🔄 **Workflow Engine**: Execute multi-step AI research workflows with triggers
|
|
51
|
+
- 🔍 **Search**: FTS5 full-text + sqlite-vec vector search; multi-hop GraphRAG retrieval
|
|
52
|
+
- 🔌 **MCP Server**: Expose graph operations as Model Context Protocol tools
|
|
53
|
+
- ⚙️ **Settings Management**: Configure LLM providers, databases, and system settings
|
|
54
|
+
- 🔐 **Single-User Auth**: nginx `auth_request` gates every API call (no admin/user split)
|
|
55
|
+
- 🗄️ **Multi-Database**: Isolated workspaces with independent graphs
|
|
56
|
+
|
|
57
|
+
## Architecture
|
|
58
|
+
|
|
59
|
+
Cortex is part of the ChaosCypher neural architecture:
|
|
60
|
+
|
|
61
|
+
- **Core** - Brain (business logic)
|
|
62
|
+
- **Cortex** - Processing center (full backend) 👈 You are here
|
|
63
|
+
- **Neuron** - Worker cells (background processing)
|
|
64
|
+
- **Interface** - Interaction layer (UI)
|
|
65
|
+
|
|
66
|
+
### Vertical Slice Architecture (VSA)
|
|
67
|
+
|
|
68
|
+
Cortex uses VSA with self-contained feature slices. Each slice contains its
|
|
69
|
+
own routes, service logic, and Pydantic models. The authoritative list is the
|
|
70
|
+
set of directories under
|
|
71
|
+
`packages/cortex/src/chaoscypher_cortex/features/`:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
packages/cortex/src/chaoscypher_cortex/
|
|
75
|
+
├── features/ # VSA slices (chats, sources, nodes, edges,
|
|
76
|
+
│ # templates, search, llm, queue, settings,
|
|
77
|
+
│ # settings_public, workflows, triggers, tools,
|
|
78
|
+
│ # dashboard, graph, graph_snapshot, mcp, lexicon,
|
|
79
|
+
│ # backup, export, quality, counts, health,
|
|
80
|
+
│ # diagnostics, logs, pause, upgrade, edition,
|
|
81
|
+
│ # databases, local_auth, admin_plugins)
|
|
82
|
+
├── shared/ # Shared infrastructure
|
|
83
|
+
│ ├── api/ # Auth dependencies, error handling, pagination
|
|
84
|
+
│ ├── database/ # Database session
|
|
85
|
+
│ ├── llm/ # LLM factory
|
|
86
|
+
│ └── queue/ # Queue utilities
|
|
87
|
+
└── main.py # FastAPI application + router registration
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Each feature slice contains:
|
|
91
|
+
- `models.py` - Pydantic DTOs (Request/Response)
|
|
92
|
+
- `repository.py` - Data access layer
|
|
93
|
+
- `service.py` - Business logic
|
|
94
|
+
- `api.py` - REST endpoints + DI factory
|
|
95
|
+
- `__init__.py` - Barrel exports
|
|
96
|
+
|
|
97
|
+
## Installation
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# From source (workspace sync — installs core + cortex + all dev tools)
|
|
101
|
+
uv sync --all-packages --extra dev
|
|
102
|
+
|
|
103
|
+
# Single-package mode (cortex + its core dep only)
|
|
104
|
+
uv sync --package chaoscypher-cortex
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
The repo uses uv workspaces (see `pyproject.toml` `[tool.uv.workspace]`); `pip
|
|
108
|
+
install -e` is no longer the supported install path. Install uv via
|
|
109
|
+
[the official installer](https://docs.astral.sh/uv/getting-started/installation/)
|
|
110
|
+
before running these commands.
|
|
111
|
+
|
|
112
|
+
## Usage
|
|
113
|
+
|
|
114
|
+
### Standalone
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# Start Cortex server
|
|
118
|
+
cc-cortex start
|
|
119
|
+
|
|
120
|
+
# Custom host/port
|
|
121
|
+
cc-cortex start --host 0.0.0.0 --port 8080
|
|
122
|
+
|
|
123
|
+
# With environment variables
|
|
124
|
+
QUEUE_HOST=localhost QUEUE_PORT=6379 cc-cortex start
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Docker
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
# Development
|
|
131
|
+
docker compose -f packages/docker/multi-container/docker-compose.dev.yml up cortex
|
|
132
|
+
|
|
133
|
+
# Production
|
|
134
|
+
docker run -p 8080:8080 -e QUEUE_HOST=valkey -e QUEUE_PORT=6379 chaoscypher-cortex
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Programmatic
|
|
138
|
+
|
|
139
|
+
```python
|
|
140
|
+
from chaoscypher_cortex.main import create_app
|
|
141
|
+
|
|
142
|
+
app = create_app()
|
|
143
|
+
|
|
144
|
+
# Run with uvicorn
|
|
145
|
+
import uvicorn
|
|
146
|
+
uvicorn.run(app, host="0.0.0.0", port=8080)
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Configuration
|
|
150
|
+
|
|
151
|
+
Configure via environment variables or `packages/docker/data/settings.yaml`:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
# Queue (Valkey)
|
|
155
|
+
QUEUE_HOST=localhost
|
|
156
|
+
QUEUE_PORT=6379
|
|
157
|
+
|
|
158
|
+
# Database
|
|
159
|
+
CHAOSCYPHER_DATA_DIR=~/.local/share/chaoscypher
|
|
160
|
+
CHAOSCYPHER_CONFIG_DIR=~/.config/chaoscypher
|
|
161
|
+
|
|
162
|
+
# Logging
|
|
163
|
+
LOG_LEVEL=INFO
|
|
164
|
+
USE_JSON_LOGGING=false
|
|
165
|
+
|
|
166
|
+
# LLM Provider
|
|
167
|
+
LLM_CHAT_PROVIDER=ollama
|
|
168
|
+
LLM_CHAT_MODEL=llama3.2
|
|
169
|
+
LLM_EMBEDDING_PROVIDER=ollama
|
|
170
|
+
LLM_EMBEDDING_MODEL=snowflake-arctic-embed2
|
|
171
|
+
|
|
172
|
+
# API Keys (if using cloud providers)
|
|
173
|
+
OPENAI_API_KEY=sk-...
|
|
174
|
+
ANTHROPIC_API_KEY=sk-ant-...
|
|
175
|
+
GOOGLE_API_KEY=...
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## API Endpoints
|
|
179
|
+
|
|
180
|
+
Routes live under `/api/v1/` and are gated by nginx `auth_request` (no
|
|
181
|
+
register/login flow inside Cortex). The full surface includes:
|
|
182
|
+
|
|
183
|
+
- **Knowledge graph** — `/nodes`, `/edges`, `/templates`, `/graph`
|
|
184
|
+
- **Sources** — `/sources` (upload, list, extract, commit, citations, chunks). `SourceResponse` exposes user upload-time choices via the nested `upload_options` object (`auto_analyze`, `enable_normalization`, `enable_vision`, `content_filtering`, `filtering_mode`, `extraction_depth`, `forced_domain`), per-stage drop / merge counters via `quality_metrics` (45 typed counters + companion fields like `loader_encoding_used`), and search-index health via `quality_metrics.vector_indexing_status` (`pending` / `indexed` / `degraded` / `failed`). New persisted upload settings must round-trip through `upload_options`, never as siblings on `SourceResponse` — see `packages/docs/docs/reference/api/sources.md`.
|
|
185
|
+
- **Search** — `/search` (FTS5, vector, hybrid, GraphRAG)
|
|
186
|
+
- **Chat** — `/chats`, `/chats/{id}/messages`
|
|
187
|
+
- **Workflows** — `/workflows`, `/workflows/{id}/execute`, `/triggers`, `/tools`
|
|
188
|
+
- **Settings** — `/settings`, `/settings/reset` (plus scoped `/settings/reset/{scope}` variants)
|
|
189
|
+
- **Queue** — `/queue/tasks`, `/queue/status`
|
|
190
|
+
- **Operations** — `/llm/instances`, `/databases`, `/exports`, `/backup`
|
|
191
|
+
- **Diagnostics** — `/health`, `/diagnostics`, `/logs`, `/pause`, `/edition`
|
|
192
|
+
- **MCP** — `/mcp/sse`, `/mcp/messages`
|
|
193
|
+
|
|
194
|
+
The complete reference (request/response shapes, query params, error envelopes)
|
|
195
|
+
is in `packages/docs/docs/reference/api/` and at the live OpenAPI page:
|
|
196
|
+
http://localhost:8080/docs (when running).
|
|
197
|
+
|
|
198
|
+
## Development
|
|
199
|
+
|
|
200
|
+
### Project Structure
|
|
201
|
+
|
|
202
|
+
```
|
|
203
|
+
packages/cortex/
|
|
204
|
+
├── src/chaoscypher_cortex/
|
|
205
|
+
│ ├── features/ # VSA feature slices
|
|
206
|
+
│ ├── shared/ # Shared infrastructure
|
|
207
|
+
│ └── main.py # FastAPI app
|
|
208
|
+
├── tests/ # Test suite
|
|
209
|
+
├── Dockerfile # Production image
|
|
210
|
+
├── Dockerfile.dev # Development image
|
|
211
|
+
└── pyproject.toml # Package configuration
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Adding New Features
|
|
215
|
+
|
|
216
|
+
1. Create directory: `features/{feature}/`
|
|
217
|
+
2. Define DTOs: `{feature}/models.py`
|
|
218
|
+
3. Create repository: `{feature}/repository.py`
|
|
219
|
+
4. Create service: `{feature}/service.py`
|
|
220
|
+
5. Create API + factory: `{feature}/api.py`
|
|
221
|
+
6. Export: `{feature}/__init__.py`
|
|
222
|
+
7. Register router in `main.py`
|
|
223
|
+
|
|
224
|
+
Example:
|
|
225
|
+
|
|
226
|
+
```python
|
|
227
|
+
# features/my_feature/models.py
|
|
228
|
+
from pydantic import BaseModel
|
|
229
|
+
|
|
230
|
+
class MyFeatureRequest(BaseModel):
|
|
231
|
+
name: str
|
|
232
|
+
|
|
233
|
+
class MyFeatureResponse(BaseModel):
|
|
234
|
+
id: str
|
|
235
|
+
name: str
|
|
236
|
+
|
|
237
|
+
# features/my_feature/service.py
|
|
238
|
+
class MyFeatureService:
|
|
239
|
+
def create(self, data: dict) -> dict:
|
|
240
|
+
# Business logic
|
|
241
|
+
return {"id": "123", "name": data["name"]}
|
|
242
|
+
|
|
243
|
+
# features/my_feature/api.py
|
|
244
|
+
from fastapi import APIRouter, Depends
|
|
245
|
+
|
|
246
|
+
router = APIRouter(prefix="/api/v1/my-feature", tags=["My Feature"])
|
|
247
|
+
|
|
248
|
+
def get_service() -> MyFeatureService:
|
|
249
|
+
return MyFeatureService()
|
|
250
|
+
|
|
251
|
+
@router.post("/", response_model=MyFeatureResponse)
|
|
252
|
+
def create_item(
|
|
253
|
+
request: MyFeatureRequest,
|
|
254
|
+
service: Annotated[MyFeatureService, Depends(get_service)]
|
|
255
|
+
):
|
|
256
|
+
return service.create(request.model_dump())
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### Testing
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
# Run all tests
|
|
263
|
+
pytest
|
|
264
|
+
|
|
265
|
+
# Unit tests only
|
|
266
|
+
pytest -m unit
|
|
267
|
+
|
|
268
|
+
# Integration tests
|
|
269
|
+
pytest -m integration
|
|
270
|
+
|
|
271
|
+
# With coverage
|
|
272
|
+
pytest --cov=chaoscypher_cortex --cov-report=html
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Hot-Reload Development
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
# Using watchdog
|
|
279
|
+
watchmedo auto-restart -d src -p '*.py' -- cc-cortex start
|
|
280
|
+
|
|
281
|
+
# Using Docker
|
|
282
|
+
docker compose -f packages/docker/multi-container/docker-compose.dev.yml up cortex
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
## Dependencies
|
|
286
|
+
|
|
287
|
+
- **Core**: `chaoscypher-core` - Business logic
|
|
288
|
+
- **FastAPI**: Web framework
|
|
289
|
+
- **SQLModel**: Database ORM
|
|
290
|
+
- **ARQ**: Background task queue
|
|
291
|
+
- **Structlog**: Structured logging
|
|
292
|
+
- **Pydantic**: Data validation
|
|
293
|
+
|
|
294
|
+
## License
|
|
295
|
+
|
|
296
|
+
AGPL-3.0 License - See LICENSE file for details
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
# ChaosCypher Cortex
|
|
2
|
+
|
|
3
|
+
**Full-featured knowledge graph backend API - Processing center**
|
|
4
|
+
|
|
5
|
+
Cortex is the main backend API for ChaosCypher, providing comprehensive CRUD operations, workflow execution, document source processing, AI-powered chat, and knowledge graph management using Vertical Slice Architecture (VSA).
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- 📊 **Knowledge Graph Management**: Full CRUD for nodes, edges, and templates
|
|
10
|
+
- 💬 **AI Chat**: Conversational interface with RAG and tool use
|
|
11
|
+
- 📁 **Document Source Processing**: Process PDFs, text files, CSVs into knowledge graphs
|
|
12
|
+
- 🔄 **Workflow Engine**: Execute multi-step AI research workflows with triggers
|
|
13
|
+
- 🔍 **Search**: FTS5 full-text + sqlite-vec vector search; multi-hop GraphRAG retrieval
|
|
14
|
+
- 🔌 **MCP Server**: Expose graph operations as Model Context Protocol tools
|
|
15
|
+
- ⚙️ **Settings Management**: Configure LLM providers, databases, and system settings
|
|
16
|
+
- 🔐 **Single-User Auth**: nginx `auth_request` gates every API call (no admin/user split)
|
|
17
|
+
- 🗄️ **Multi-Database**: Isolated workspaces with independent graphs
|
|
18
|
+
|
|
19
|
+
## Architecture
|
|
20
|
+
|
|
21
|
+
Cortex is part of the ChaosCypher neural architecture:
|
|
22
|
+
|
|
23
|
+
- **Core** - Brain (business logic)
|
|
24
|
+
- **Cortex** - Processing center (full backend) 👈 You are here
|
|
25
|
+
- **Neuron** - Worker cells (background processing)
|
|
26
|
+
- **Interface** - Interaction layer (UI)
|
|
27
|
+
|
|
28
|
+
### Vertical Slice Architecture (VSA)
|
|
29
|
+
|
|
30
|
+
Cortex uses VSA with self-contained feature slices. Each slice contains its
|
|
31
|
+
own routes, service logic, and Pydantic models. The authoritative list is the
|
|
32
|
+
set of directories under
|
|
33
|
+
`packages/cortex/src/chaoscypher_cortex/features/`:
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
packages/cortex/src/chaoscypher_cortex/
|
|
37
|
+
├── features/ # VSA slices (chats, sources, nodes, edges,
|
|
38
|
+
│ # templates, search, llm, queue, settings,
|
|
39
|
+
│ # settings_public, workflows, triggers, tools,
|
|
40
|
+
│ # dashboard, graph, graph_snapshot, mcp, lexicon,
|
|
41
|
+
│ # backup, export, quality, counts, health,
|
|
42
|
+
│ # diagnostics, logs, pause, upgrade, edition,
|
|
43
|
+
│ # databases, local_auth, admin_plugins)
|
|
44
|
+
├── shared/ # Shared infrastructure
|
|
45
|
+
│ ├── api/ # Auth dependencies, error handling, pagination
|
|
46
|
+
│ ├── database/ # Database session
|
|
47
|
+
│ ├── llm/ # LLM factory
|
|
48
|
+
│ └── queue/ # Queue utilities
|
|
49
|
+
└── main.py # FastAPI application + router registration
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Each feature slice contains:
|
|
53
|
+
- `models.py` - Pydantic DTOs (Request/Response)
|
|
54
|
+
- `repository.py` - Data access layer
|
|
55
|
+
- `service.py` - Business logic
|
|
56
|
+
- `api.py` - REST endpoints + DI factory
|
|
57
|
+
- `__init__.py` - Barrel exports
|
|
58
|
+
|
|
59
|
+
## Installation
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# From source (workspace sync — installs core + cortex + all dev tools)
|
|
63
|
+
uv sync --all-packages --extra dev
|
|
64
|
+
|
|
65
|
+
# Single-package mode (cortex + its core dep only)
|
|
66
|
+
uv sync --package chaoscypher-cortex
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The repo uses uv workspaces (see `pyproject.toml` `[tool.uv.workspace]`); `pip
|
|
70
|
+
install -e` is no longer the supported install path. Install uv via
|
|
71
|
+
[the official installer](https://docs.astral.sh/uv/getting-started/installation/)
|
|
72
|
+
before running these commands.
|
|
73
|
+
|
|
74
|
+
## Usage
|
|
75
|
+
|
|
76
|
+
### Standalone
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# Start Cortex server
|
|
80
|
+
cc-cortex start
|
|
81
|
+
|
|
82
|
+
# Custom host/port
|
|
83
|
+
cc-cortex start --host 0.0.0.0 --port 8080
|
|
84
|
+
|
|
85
|
+
# With environment variables
|
|
86
|
+
QUEUE_HOST=localhost QUEUE_PORT=6379 cc-cortex start
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Docker
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Development
|
|
93
|
+
docker compose -f packages/docker/multi-container/docker-compose.dev.yml up cortex
|
|
94
|
+
|
|
95
|
+
# Production
|
|
96
|
+
docker run -p 8080:8080 -e QUEUE_HOST=valkey -e QUEUE_PORT=6379 chaoscypher-cortex
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Programmatic
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
from chaoscypher_cortex.main import create_app
|
|
103
|
+
|
|
104
|
+
app = create_app()
|
|
105
|
+
|
|
106
|
+
# Run with uvicorn
|
|
107
|
+
import uvicorn
|
|
108
|
+
uvicorn.run(app, host="0.0.0.0", port=8080)
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Configuration
|
|
112
|
+
|
|
113
|
+
Configure via environment variables or `packages/docker/data/settings.yaml`:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# Queue (Valkey)
|
|
117
|
+
QUEUE_HOST=localhost
|
|
118
|
+
QUEUE_PORT=6379
|
|
119
|
+
|
|
120
|
+
# Database
|
|
121
|
+
CHAOSCYPHER_DATA_DIR=~/.local/share/chaoscypher
|
|
122
|
+
CHAOSCYPHER_CONFIG_DIR=~/.config/chaoscypher
|
|
123
|
+
|
|
124
|
+
# Logging
|
|
125
|
+
LOG_LEVEL=INFO
|
|
126
|
+
USE_JSON_LOGGING=false
|
|
127
|
+
|
|
128
|
+
# LLM Provider
|
|
129
|
+
LLM_CHAT_PROVIDER=ollama
|
|
130
|
+
LLM_CHAT_MODEL=llama3.2
|
|
131
|
+
LLM_EMBEDDING_PROVIDER=ollama
|
|
132
|
+
LLM_EMBEDDING_MODEL=snowflake-arctic-embed2
|
|
133
|
+
|
|
134
|
+
# API Keys (if using cloud providers)
|
|
135
|
+
OPENAI_API_KEY=sk-...
|
|
136
|
+
ANTHROPIC_API_KEY=sk-ant-...
|
|
137
|
+
GOOGLE_API_KEY=...
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## API Endpoints
|
|
141
|
+
|
|
142
|
+
Routes live under `/api/v1/` and are gated by nginx `auth_request` (no
|
|
143
|
+
register/login flow inside Cortex). The full surface includes:
|
|
144
|
+
|
|
145
|
+
- **Knowledge graph** — `/nodes`, `/edges`, `/templates`, `/graph`
|
|
146
|
+
- **Sources** — `/sources` (upload, list, extract, commit, citations, chunks). `SourceResponse` exposes user upload-time choices via the nested `upload_options` object (`auto_analyze`, `enable_normalization`, `enable_vision`, `content_filtering`, `filtering_mode`, `extraction_depth`, `forced_domain`), per-stage drop / merge counters via `quality_metrics` (45 typed counters + companion fields like `loader_encoding_used`), and search-index health via `quality_metrics.vector_indexing_status` (`pending` / `indexed` / `degraded` / `failed`). New persisted upload settings must round-trip through `upload_options`, never as siblings on `SourceResponse` — see `packages/docs/docs/reference/api/sources.md`.
|
|
147
|
+
- **Search** — `/search` (FTS5, vector, hybrid, GraphRAG)
|
|
148
|
+
- **Chat** — `/chats`, `/chats/{id}/messages`
|
|
149
|
+
- **Workflows** — `/workflows`, `/workflows/{id}/execute`, `/triggers`, `/tools`
|
|
150
|
+
- **Settings** — `/settings`, `/settings/reset` (plus scoped `/settings/reset/{scope}` variants)
|
|
151
|
+
- **Queue** — `/queue/tasks`, `/queue/status`
|
|
152
|
+
- **Operations** — `/llm/instances`, `/databases`, `/exports`, `/backup`
|
|
153
|
+
- **Diagnostics** — `/health`, `/diagnostics`, `/logs`, `/pause`, `/edition`
|
|
154
|
+
- **MCP** — `/mcp/sse`, `/mcp/messages`
|
|
155
|
+
|
|
156
|
+
The complete reference (request/response shapes, query params, error envelopes)
|
|
157
|
+
is in `packages/docs/docs/reference/api/` and at the live OpenAPI page:
|
|
158
|
+
http://localhost:8080/docs (when running).
|
|
159
|
+
|
|
160
|
+
## Development
|
|
161
|
+
|
|
162
|
+
### Project Structure
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
packages/cortex/
|
|
166
|
+
├── src/chaoscypher_cortex/
|
|
167
|
+
│ ├── features/ # VSA feature slices
|
|
168
|
+
│ ├── shared/ # Shared infrastructure
|
|
169
|
+
│ └── main.py # FastAPI app
|
|
170
|
+
├── tests/ # Test suite
|
|
171
|
+
├── Dockerfile # Production image
|
|
172
|
+
├── Dockerfile.dev # Development image
|
|
173
|
+
└── pyproject.toml # Package configuration
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Adding New Features
|
|
177
|
+
|
|
178
|
+
1. Create directory: `features/{feature}/`
|
|
179
|
+
2. Define DTOs: `{feature}/models.py`
|
|
180
|
+
3. Create repository: `{feature}/repository.py`
|
|
181
|
+
4. Create service: `{feature}/service.py`
|
|
182
|
+
5. Create API + factory: `{feature}/api.py`
|
|
183
|
+
6. Export: `{feature}/__init__.py`
|
|
184
|
+
7. Register router in `main.py`
|
|
185
|
+
|
|
186
|
+
Example:
|
|
187
|
+
|
|
188
|
+
```python
|
|
189
|
+
# features/my_feature/models.py
|
|
190
|
+
from pydantic import BaseModel
|
|
191
|
+
|
|
192
|
+
class MyFeatureRequest(BaseModel):
|
|
193
|
+
name: str
|
|
194
|
+
|
|
195
|
+
class MyFeatureResponse(BaseModel):
|
|
196
|
+
id: str
|
|
197
|
+
name: str
|
|
198
|
+
|
|
199
|
+
# features/my_feature/service.py
|
|
200
|
+
class MyFeatureService:
|
|
201
|
+
def create(self, data: dict) -> dict:
|
|
202
|
+
# Business logic
|
|
203
|
+
return {"id": "123", "name": data["name"]}
|
|
204
|
+
|
|
205
|
+
# features/my_feature/api.py
|
|
206
|
+
from fastapi import APIRouter, Depends
|
|
207
|
+
|
|
208
|
+
router = APIRouter(prefix="/api/v1/my-feature", tags=["My Feature"])
|
|
209
|
+
|
|
210
|
+
def get_service() -> MyFeatureService:
|
|
211
|
+
return MyFeatureService()
|
|
212
|
+
|
|
213
|
+
@router.post("/", response_model=MyFeatureResponse)
|
|
214
|
+
def create_item(
|
|
215
|
+
request: MyFeatureRequest,
|
|
216
|
+
service: Annotated[MyFeatureService, Depends(get_service)]
|
|
217
|
+
):
|
|
218
|
+
return service.create(request.model_dump())
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Testing
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
# Run all tests
|
|
225
|
+
pytest
|
|
226
|
+
|
|
227
|
+
# Unit tests only
|
|
228
|
+
pytest -m unit
|
|
229
|
+
|
|
230
|
+
# Integration tests
|
|
231
|
+
pytest -m integration
|
|
232
|
+
|
|
233
|
+
# With coverage
|
|
234
|
+
pytest --cov=chaoscypher_cortex --cov-report=html
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Hot-Reload Development
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
# Using watchdog
|
|
241
|
+
watchmedo auto-restart -d src -p '*.py' -- cc-cortex start
|
|
242
|
+
|
|
243
|
+
# Using Docker
|
|
244
|
+
docker compose -f packages/docker/multi-container/docker-compose.dev.yml up cortex
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## Dependencies
|
|
248
|
+
|
|
249
|
+
- **Core**: `chaoscypher-core` - Business logic
|
|
250
|
+
- **FastAPI**: Web framework
|
|
251
|
+
- **SQLModel**: Database ORM
|
|
252
|
+
- **ARQ**: Background task queue
|
|
253
|
+
- **Structlog**: Structured logging
|
|
254
|
+
- **Pydantic**: Data validation
|
|
255
|
+
|
|
256
|
+
## License
|
|
257
|
+
|
|
258
|
+
AGPL-3.0 License - See LICENSE file for details
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=82.0.0,<90", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "chaoscypher-cortex"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Chaos Cypher Cortex - Full-featured knowledge graph platform (processing center)"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "AGPL-3.0-only"
|
|
11
|
+
authors = [
|
|
12
|
+
{name = "Denis MacPherson", email = "denis@chaoscypher.com"}
|
|
13
|
+
]
|
|
14
|
+
keywords = ["knowledge-graph", "api", "fastapi", "ai", "workflows"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3.14",
|
|
20
|
+
]
|
|
21
|
+
requires-python = ">=3.14"
|
|
22
|
+
dependencies = [
|
|
23
|
+
"chaoscypher-core>=0.1.0",
|
|
24
|
+
"fastapi>=0.135.0,<1",
|
|
25
|
+
"uvicorn>=0.44.0,<1",
|
|
26
|
+
"sqlmodel>=0.0.38,<0.1",
|
|
27
|
+
"pydantic>=2.12.0,<3",
|
|
28
|
+
"pydantic-settings>=2.13.0,<3",
|
|
29
|
+
"email-validator>=2.3.0,<3",
|
|
30
|
+
"python-dotenv>=1.2.0,<2",
|
|
31
|
+
"dynaconf>=3.2.13,<4",
|
|
32
|
+
"valkey>=6.1.0,<7",
|
|
33
|
+
"python-multipart>=0.0.24,<0.1",
|
|
34
|
+
"sse-starlette>=3.3.0,<4",
|
|
35
|
+
"structlog>=25.5.0,<26",
|
|
36
|
+
"mcp>=1.27.0,<2",
|
|
37
|
+
"zxcvbn>=4.5.0,<5",
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
[project.optional-dependencies]
|
|
41
|
+
dev = [
|
|
42
|
+
"pytest>=9.0.0,<10",
|
|
43
|
+
"pytest-cov>=7.1.0,<8",
|
|
44
|
+
"pytest-asyncio>=1.3.0,<2",
|
|
45
|
+
"httpx>=0.28.0,<1",
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
[project.scripts]
|
|
49
|
+
cc-cortex = "chaoscypher_cortex.main:cli"
|
|
50
|
+
|
|
51
|
+
[project.urls]
|
|
52
|
+
Homepage = "https://github.com/chaoscypherinc/chaoscypher"
|
|
53
|
+
Documentation = "https://github.com/chaoscypherinc/chaoscypher#readme"
|
|
54
|
+
Repository = "https://github.com/chaoscypherinc/chaoscypher"
|
|
55
|
+
Issues = "https://github.com/chaoscypherinc/chaoscypher/issues"
|
|
56
|
+
|
|
57
|
+
[tool.pytest.ini_options]
|
|
58
|
+
pythonpath = ["src", "../core/src"]
|
|
59
|
+
markers = [
|
|
60
|
+
"unit: pure-unit tests (no I/O, no DB, no network) — opt-in via -m unit",
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
[tool.setuptools.packages.find]
|
|
64
|
+
where = ["src"]
|
|
65
|
+
|
|
66
|
+
[tool.setuptools.package-data]
|
|
67
|
+
chaoscypher_cortex = ["py.typed"]
|