bolt-boot 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.
Files changed (260) hide show
  1. bolt_boot-0.1.0/.dockerignore +78 -0
  2. bolt_boot-0.1.0/.env.example +54 -0
  3. bolt_boot-0.1.0/.gitattributes +18 -0
  4. bolt_boot-0.1.0/.github/workflows/ci.yml +23 -0
  5. bolt_boot-0.1.0/.gitignore +69 -0
  6. bolt_boot-0.1.0/.pre-commit-config.yaml +51 -0
  7. bolt_boot-0.1.0/CHANGELOG.md +127 -0
  8. bolt_boot-0.1.0/CONTRIBUTING.md +51 -0
  9. bolt_boot-0.1.0/Dockerfile +55 -0
  10. bolt_boot-0.1.0/LICENSE +21 -0
  11. bolt_boot-0.1.0/Makefile +18 -0
  12. bolt_boot-0.1.0/PKG-INFO +492 -0
  13. bolt_boot-0.1.0/README.md +392 -0
  14. bolt_boot-0.1.0/SECURITY.md +44 -0
  15. bolt_boot-0.1.0/alembic.ini +39 -0
  16. bolt_boot-0.1.0/bolt/__init__.py +23 -0
  17. bolt_boot-0.1.0/bolt/__main__.py +18 -0
  18. bolt_boot-0.1.0/bolt/agent/__init__.py +39 -0
  19. bolt_boot-0.1.0/bolt/agent/base.py +282 -0
  20. bolt_boot-0.1.0/bolt/agent/example.py +94 -0
  21. bolt_boot-0.1.0/bolt/agent/memory.py +375 -0
  22. bolt_boot-0.1.0/bolt/agent/messages.py +48 -0
  23. bolt_boot-0.1.0/bolt/agent/oxy/__init__.py +24 -0
  24. bolt_boot-0.1.0/bolt/agent/oxy/engine.py +285 -0
  25. bolt_boot-0.1.0/bolt/agent/oxy/llm_compat.py +132 -0
  26. bolt_boot-0.1.0/bolt/agent/oxy/mapping.py +275 -0
  27. bolt_boot-0.1.0/bolt/agent/oxy/mas_api.py +390 -0
  28. bolt_boot-0.1.0/bolt/agent/oxy/runtime.py +588 -0
  29. bolt_boot-0.1.0/bolt/agent/tools.py +125 -0
  30. bolt_boot-0.1.0/bolt/api/__init__.py +85 -0
  31. bolt_boot-0.1.0/bolt/api/deps.py +155 -0
  32. bolt_boot-0.1.0/bolt/api/health.py +501 -0
  33. bolt_boot-0.1.0/bolt/api/openapi.py +291 -0
  34. bolt_boot-0.1.0/bolt/api/rate_limit.py +421 -0
  35. bolt_boot-0.1.0/bolt/cli/commands/__init__.py +1 -0
  36. bolt_boot-0.1.0/bolt/cli/commands/agent.py +114 -0
  37. bolt_boot-0.1.0/bolt/cli/commands/docs.py +56 -0
  38. bolt_boot-0.1.0/bolt/cli/commands/generate.py +535 -0
  39. bolt_boot-0.1.0/bolt/cli/commands/init.py +277 -0
  40. bolt_boot-0.1.0/bolt/cli/commands/migrate.py +277 -0
  41. bolt_boot-0.1.0/bolt/cli/commands/rag.py +137 -0
  42. bolt_boot-0.1.0/bolt/cli/console.py +8 -0
  43. bolt_boot-0.1.0/bolt/cli/main.py +375 -0
  44. bolt_boot-0.1.0/bolt/core/__init__.py +84 -0
  45. bolt_boot-0.1.0/bolt/core/app.py +497 -0
  46. bolt_boot-0.1.0/bolt/core/config.py +332 -0
  47. bolt_boot-0.1.0/bolt/core/database.py +167 -0
  48. bolt_boot-0.1.0/bolt/core/di.py +463 -0
  49. bolt_boot-0.1.0/bolt/core/exceptions.py +419 -0
  50. bolt_boot-0.1.0/bolt/core/lifecycle.py +144 -0
  51. bolt_boot-0.1.0/bolt/core/logging.py +310 -0
  52. bolt_boot-0.1.0/bolt/core/middleware.py +411 -0
  53. bolt_boot-0.1.0/bolt/core/plugin.py +108 -0
  54. bolt_boot-0.1.0/bolt/core/propagation.py +72 -0
  55. bolt_boot-0.1.0/bolt/core/protocols.py +79 -0
  56. bolt_boot-0.1.0/bolt/core/response.py +190 -0
  57. bolt_boot-0.1.0/bolt/core/telemetry.py +214 -0
  58. bolt_boot-0.1.0/bolt/domain/__init__.py +34 -0
  59. bolt_boot-0.1.0/bolt/domain/events.py +220 -0
  60. bolt_boot-0.1.0/bolt/domain/model.py +140 -0
  61. bolt_boot-0.1.0/bolt/domain/repository/__init__.py +13 -0
  62. bolt_boot-0.1.0/bolt/domain/repository/base.py +695 -0
  63. bolt_boot-0.1.0/bolt/domain/repository/bulk.py +209 -0
  64. bolt_boot-0.1.0/bolt/domain/repository/cache.py +134 -0
  65. bolt_boot-0.1.0/bolt/domain/repository/filters.py +86 -0
  66. bolt_boot-0.1.0/bolt/domain/repository/pagination.py +61 -0
  67. bolt_boot-0.1.0/bolt/domain/schema.py +138 -0
  68. bolt_boot-0.1.0/bolt/domain/service.py +251 -0
  69. bolt_boot-0.1.0/bolt/domain/transaction.py +387 -0
  70. bolt_boot-0.1.0/bolt/infrastructure/__init__.py +99 -0
  71. bolt_boot-0.1.0/bolt/infrastructure/cache.py +252 -0
  72. bolt_boot-0.1.0/bolt/infrastructure/cache_backends.py +237 -0
  73. bolt_boot-0.1.0/bolt/infrastructure/config_center/__init__.py +349 -0
  74. bolt_boot-0.1.0/bolt/infrastructure/distributed_lock.py +199 -0
  75. bolt_boot-0.1.0/bolt/infrastructure/mq/__init__.py +242 -0
  76. bolt_boot-0.1.0/bolt/infrastructure/mq/kafka.py +274 -0
  77. bolt_boot-0.1.0/bolt/infrastructure/mq/rabbitmq.py +247 -0
  78. bolt_boot-0.1.0/bolt/infrastructure/mq/rocketmq.py +254 -0
  79. bolt_boot-0.1.0/bolt/infrastructure/observability/__init__.py +410 -0
  80. bolt_boot-0.1.0/bolt/infrastructure/registry/__init__.py +73 -0
  81. bolt_boot-0.1.0/bolt/infrastructure/registry/consul.py +209 -0
  82. bolt_boot-0.1.0/bolt/infrastructure/registry/nacos.py +204 -0
  83. bolt_boot-0.1.0/bolt/infrastructure/resilience/__init__.py +530 -0
  84. bolt_boot-0.1.0/bolt/infrastructure/scheduler.py +444 -0
  85. bolt_boot-0.1.0/bolt/infrastructure/scheduler_backends.py +186 -0
  86. bolt_boot-0.1.0/bolt/infrastructure/scheduler_models.py +277 -0
  87. bolt_boot-0.1.0/bolt/py.typed +0 -0
  88. bolt_boot-0.1.0/bolt/rag/__init__.py +51 -0
  89. bolt_boot-0.1.0/bolt/rag/advanced/__init__.py +40 -0
  90. bolt_boot-0.1.0/bolt/rag/advanced/advanced_retriever.py +146 -0
  91. bolt_boot-0.1.0/bolt/rag/advanced/citation.py +69 -0
  92. bolt_boot-0.1.0/bolt/rag/advanced/compression.py +88 -0
  93. bolt_boot-0.1.0/bolt/rag/advanced/reranker.py +215 -0
  94. bolt_boot-0.1.0/bolt/rag/advanced/retriever.py +154 -0
  95. bolt_boot-0.1.0/bolt/rag/advanced/search.py +149 -0
  96. bolt_boot-0.1.0/bolt/rag/documents.py +28 -0
  97. bolt_boot-0.1.0/bolt/rag/embeddings.py +241 -0
  98. bolt_boot-0.1.0/bolt/rag/knowledge_graph/__init__.py +79 -0
  99. bolt_boot-0.1.0/bolt/rag/knowledge_graph/extractor.py +114 -0
  100. bolt_boot-0.1.0/bolt/rag/knowledge_graph/graph_rag.py +158 -0
  101. bolt_boot-0.1.0/bolt/rag/knowledge_graph/models.py +69 -0
  102. bolt_boot-0.1.0/bolt/rag/knowledge_graph/stores.py +462 -0
  103. bolt_boot-0.1.0/bolt/rag/llm.py +159 -0
  104. bolt_boot-0.1.0/bolt/rag/loaders.py +725 -0
  105. bolt_boot-0.1.0/bolt/rag/multimodal/__init__.py +42 -0
  106. bolt_boot-0.1.0/bolt/rag/multimodal/audio.py +118 -0
  107. bolt_boot-0.1.0/bolt/rag/multimodal/base.py +38 -0
  108. bolt_boot-0.1.0/bolt/rag/multimodal/image.py +186 -0
  109. bolt_boot-0.1.0/bolt/rag/multimodal/loader.py +190 -0
  110. bolt_boot-0.1.0/bolt/rag/multimodal/table.py +138 -0
  111. bolt_boot-0.1.0/bolt/rag/multimodal/video.py +234 -0
  112. bolt_boot-0.1.0/bolt/rag/retriever.py +382 -0
  113. bolt_boot-0.1.0/bolt/rag/splitters.py +276 -0
  114. bolt_boot-0.1.0/bolt/rag/vectorstore.py +448 -0
  115. bolt_boot-0.1.0/bolt/security/__init__.py +135 -0
  116. bolt_boot-0.1.0/bolt/security/api_key.py +250 -0
  117. bolt_boot-0.1.0/bolt/security/audit.py +204 -0
  118. bolt_boot-0.1.0/bolt/security/brute_force.py +177 -0
  119. bolt_boot-0.1.0/bolt/security/jwt.py +575 -0
  120. bolt_boot-0.1.0/bolt/security/jwt_blacklist.py +108 -0
  121. bolt_boot-0.1.0/bolt/security/jwt_keys.py +80 -0
  122. bolt_boot-0.1.0/bolt/security/password.py +174 -0
  123. bolt_boot-0.1.0/bolt/security/permissions.py +272 -0
  124. bolt_boot-0.1.0/bolt/security/tenant.py +489 -0
  125. bolt_boot-0.1.0/deploy/grafana/bolt-dashboard.json +995 -0
  126. bolt_boot-0.1.0/deploy/grafana/dashboards.yml +11 -0
  127. bolt_boot-0.1.0/deploy/grafana/datasources.yml +11 -0
  128. bolt_boot-0.1.0/deploy/kubernetes/configmap.yaml +31 -0
  129. bolt_boot-0.1.0/deploy/kubernetes/deployment.yaml +93 -0
  130. bolt_boot-0.1.0/deploy/otel-collector-config.yaml +32 -0
  131. bolt_boot-0.1.0/deploy/prometheus.yml +24 -0
  132. bolt_boot-0.1.0/docker-compose.yml +186 -0
  133. bolt_boot-0.1.0/docs/ARCHITECTURE.md +223 -0
  134. bolt_boot-0.1.0/docs/KNOWN-TRADEOFFS.md +38 -0
  135. bolt_boot-0.1.0/docs/OXYGENT_GUIDE.md +158 -0
  136. bolt_boot-0.1.0/examples/quickstart/main.py +104 -0
  137. bolt_boot-0.1.0/examples/test_app/.env.example +21 -0
  138. bolt_boot-0.1.0/examples/test_app/README.md +43 -0
  139. bolt_boot-0.1.0/examples/test_app/app/__init__.py +0 -0
  140. bolt_boot-0.1.0/examples/test_app/app/api/__init__.py +0 -0
  141. bolt_boot-0.1.0/examples/test_app/app/api/user.py +72 -0
  142. bolt_boot-0.1.0/examples/test_app/app/models/__init__.py +0 -0
  143. bolt_boot-0.1.0/examples/test_app/app/models/user.py +13 -0
  144. bolt_boot-0.1.0/examples/test_app/app/repositories/__init__.py +0 -0
  145. bolt_boot-0.1.0/examples/test_app/app/repositories/user_repository.py +13 -0
  146. bolt_boot-0.1.0/examples/test_app/app/schemas/__init__.py +0 -0
  147. bolt_boot-0.1.0/examples/test_app/app/schemas/user.py +21 -0
  148. bolt_boot-0.1.0/examples/test_app/app/services/__init__.py +0 -0
  149. bolt_boot-0.1.0/examples/test_app/app/services/user_service.py +43 -0
  150. bolt_boot-0.1.0/examples/test_app/config.py +12 -0
  151. bolt_boot-0.1.0/examples/test_app/main.py +21 -0
  152. bolt_boot-0.1.0/examples/test_app/requirements.txt +9 -0
  153. bolt_boot-0.1.0/examples/test_app/setup_db.py +33 -0
  154. bolt_boot-0.1.0/examples/test_app/test_agent.py +237 -0
  155. bolt_boot-0.1.0/examples/test_app/test_bolt_db.py +100 -0
  156. bolt_boot-0.1.0/examples/test_app/test_bulk_ops.py +123 -0
  157. bolt_boot-0.1.0/examples/test_app/test_crud.py +149 -0
  158. bolt_boot-0.1.0/examples/test_app/test_db.py +69 -0
  159. bolt_boot-0.1.0/examples/test_app/test_enhanced.py +214 -0
  160. bolt_boot-0.1.0/examples/test_app/test_model.py +132 -0
  161. bolt_boot-0.1.0/examples/test_app/test_pg.py +46 -0
  162. bolt_boot-0.1.0/examples/test_app/test_rag.py +168 -0
  163. bolt_boot-0.1.0/examples/test_app/test_scheduler.py +224 -0
  164. bolt_boot-0.1.0/examples/test_app/test_transaction.py +315 -0
  165. bolt_boot-0.1.0/examples/test_app/tests/__init__.py +0 -0
  166. bolt_boot-0.1.0/migrations/env.py +88 -0
  167. bolt_boot-0.1.0/migrations/script.py.mako +26 -0
  168. bolt_boot-0.1.0/migrations/versions/001_initial.py +23 -0
  169. bolt_boot-0.1.0/pyproject.toml +234 -0
  170. bolt_boot-0.1.0/scripts/oxy_integration_smoke.py +93 -0
  171. bolt_boot-0.1.0/scripts/oxy_real_llm_test.py +166 -0
  172. bolt_boot-0.1.0/tests/conftest.py +248 -0
  173. bolt_boot-0.1.0/tests/integration/conftest.py +93 -0
  174. bolt_boot-0.1.0/tests/integration/test_api.py +94 -0
  175. bolt_boot-0.1.0/tests/integration/test_auth.py +185 -0
  176. bolt_boot-0.1.0/tests/integration/test_crud_integration.py +263 -0
  177. bolt_boot-0.1.0/tests/integration/test_database_integration.py +221 -0
  178. bolt_boot-0.1.0/tests/integration/test_observability_integration.py +143 -0
  179. bolt_boot-0.1.0/tests/integration/test_redis_integration.py +101 -0
  180. bolt_boot-0.1.0/tests/integration/test_repository_db.py +127 -0
  181. bolt_boot-0.1.0/tests/unit/_oxy_fakes.py +116 -0
  182. bolt_boot-0.1.0/tests/unit/test_a2a.py +97 -0
  183. bolt_boot-0.1.0/tests/unit/test_agent.py +243 -0
  184. bolt_boot-0.1.0/tests/unit/test_agent_extended.py +89 -0
  185. bolt_boot-0.1.0/tests/unit/test_agent_messages.py +55 -0
  186. bolt_boot-0.1.0/tests/unit/test_api_key.py +367 -0
  187. bolt_boot-0.1.0/tests/unit/test_app_factory.py +506 -0
  188. bolt_boot-0.1.0/tests/unit/test_brute_force.py +95 -0
  189. bolt_boot-0.1.0/tests/unit/test_cache.py +268 -0
  190. bolt_boot-0.1.0/tests/unit/test_cache_full.py +889 -0
  191. bolt_boot-0.1.0/tests/unit/test_cli.py +548 -0
  192. bolt_boot-0.1.0/tests/unit/test_cli_docs.py +46 -0
  193. bolt_boot-0.1.0/tests/unit/test_concurrency.py +234 -0
  194. bolt_boot-0.1.0/tests/unit/test_config.py +316 -0
  195. bolt_boot-0.1.0/tests/unit/test_config_center.py +450 -0
  196. bolt_boot-0.1.0/tests/unit/test_consul.py +117 -0
  197. bolt_boot-0.1.0/tests/unit/test_contract.py +197 -0
  198. bolt_boot-0.1.0/tests/unit/test_core.py +234 -0
  199. bolt_boot-0.1.0/tests/unit/test_core_protocols_plugin.py +180 -0
  200. bolt_boot-0.1.0/tests/unit/test_core_telemetry.py +165 -0
  201. bolt_boot-0.1.0/tests/unit/test_database.py +330 -0
  202. bolt_boot-0.1.0/tests/unit/test_deps.py +88 -0
  203. bolt_boot-0.1.0/tests/unit/test_di.py +700 -0
  204. bolt_boot-0.1.0/tests/unit/test_distributed_lock.py +109 -0
  205. bolt_boot-0.1.0/tests/unit/test_domain.py +111 -0
  206. bolt_boot-0.1.0/tests/unit/test_domain_events.py +110 -0
  207. bolt_boot-0.1.0/tests/unit/test_drain.py +52 -0
  208. bolt_boot-0.1.0/tests/unit/test_exceptions_full.py +242 -0
  209. bolt_boot-0.1.0/tests/unit/test_health.py +693 -0
  210. bolt_boot-0.1.0/tests/unit/test_jwt.py +595 -0
  211. bolt_boot-0.1.0/tests/unit/test_kg_context_health_checks.py +217 -0
  212. bolt_boot-0.1.0/tests/unit/test_kg_neo4j_audio_table.py +183 -0
  213. bolt_boot-0.1.0/tests/unit/test_llm_compat.py +149 -0
  214. bolt_boot-0.1.0/tests/unit/test_logging.py +284 -0
  215. bolt_boot-0.1.0/tests/unit/test_mas_api.py +138 -0
  216. bolt_boot-0.1.0/tests/unit/test_memory.py +316 -0
  217. bolt_boot-0.1.0/tests/unit/test_memory_backend_config.py +57 -0
  218. bolt_boot-0.1.0/tests/unit/test_metrics_server.py +113 -0
  219. bolt_boot-0.1.0/tests/unit/test_middleware.py +1079 -0
  220. bolt_boot-0.1.0/tests/unit/test_mq.py +120 -0
  221. bolt_boot-0.1.0/tests/unit/test_mq_implementations.py +1383 -0
  222. bolt_boot-0.1.0/tests/unit/test_nacos.py +135 -0
  223. bolt_boot-0.1.0/tests/unit/test_neo4j_store_cli_rag_multimodal.py +222 -0
  224. bolt_boot-0.1.0/tests/unit/test_observability.py +883 -0
  225. bolt_boot-0.1.0/tests/unit/test_openapi.py +685 -0
  226. bolt_boot-0.1.0/tests/unit/test_oxy_engine.py +199 -0
  227. bolt_boot-0.1.0/tests/unit/test_oxy_mapping.py +225 -0
  228. bolt_boot-0.1.0/tests/unit/test_oxy_materialization.py +90 -0
  229. bolt_boot-0.1.0/tests/unit/test_oxy_runtime.py +139 -0
  230. bolt_boot-0.1.0/tests/unit/test_password.py +94 -0
  231. bolt_boot-0.1.0/tests/unit/test_password_policy.py +75 -0
  232. bolt_boot-0.1.0/tests/unit/test_permissions.py +618 -0
  233. bolt_boot-0.1.0/tests/unit/test_propagation.py +262 -0
  234. bolt_boot-0.1.0/tests/unit/test_rag.py +280 -0
  235. bolt_boot-0.1.0/tests/unit/test_rag_advanced_llm.py +234 -0
  236. bolt_boot-0.1.0/tests/unit/test_rag_experimental.py +232 -0
  237. bolt_boot-0.1.0/tests/unit/test_rag_extended.py +176 -0
  238. bolt_boot-0.1.0/tests/unit/test_rag_kg_multimodal.py +100 -0
  239. bolt_boot-0.1.0/tests/unit/test_rag_loaders.py +303 -0
  240. bolt_boot-0.1.0/tests/unit/test_rag_reranker_kg_cli.py +177 -0
  241. bolt_boot-0.1.0/tests/unit/test_rag_retriever.py +328 -0
  242. bolt_boot-0.1.0/tests/unit/test_rag_vectorstore.py +200 -0
  243. bolt_boot-0.1.0/tests/unit/test_rate_limit.py +643 -0
  244. bolt_boot-0.1.0/tests/unit/test_registry.py +147 -0
  245. bolt_boot-0.1.0/tests/unit/test_repository.py +564 -0
  246. bolt_boot-0.1.0/tests/unit/test_repository_bulk.py +311 -0
  247. bolt_boot-0.1.0/tests/unit/test_repository_filters_pagination.py +244 -0
  248. bolt_boot-0.1.0/tests/unit/test_resilience.py +312 -0
  249. bolt_boot-0.1.0/tests/unit/test_resilience_enhanced.py +1166 -0
  250. bolt_boot-0.1.0/tests/unit/test_response.py +161 -0
  251. bolt_boot-0.1.0/tests/unit/test_scheduler.py +1174 -0
  252. bolt_boot-0.1.0/tests/unit/test_scheduler_lock.py +120 -0
  253. bolt_boot-0.1.0/tests/unit/test_security.py +419 -0
  254. bolt_boot-0.1.0/tests/unit/test_security_jwt_keys.py +77 -0
  255. bolt_boot-0.1.0/tests/unit/test_service.py +169 -0
  256. bolt_boot-0.1.0/tests/unit/test_tenant.py +739 -0
  257. bolt_boot-0.1.0/tests/unit/test_tenant_repo_enhanced.py +122 -0
  258. bolt_boot-0.1.0/tests/unit/test_thread_safety.py +123 -0
  259. bolt_boot-0.1.0/tests/unit/test_transaction.py +245 -0
  260. bolt_boot-0.1.0/tests/unit/test_transaction_full.py +919 -0
@@ -0,0 +1,78 @@
1
+ # Git
2
+ .git
3
+ .gitignore
4
+
5
+ # Python
6
+ __pycache__
7
+ *.py[cod]
8
+ *$py.class
9
+ *.so
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ *.egg-info/
24
+ .installed.cfg
25
+ *.egg
26
+
27
+ # Virtual environments
28
+ .env
29
+ .venv
30
+ env/
31
+ venv/
32
+ ENV/
33
+
34
+ # IDE
35
+ .idea/
36
+ .vscode/
37
+ *.swp
38
+ *.swo
39
+ *~
40
+
41
+ # Testing
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ htmlcov/
47
+ .pytest_cache/
48
+ .hypothesis/
49
+
50
+ # Type checking
51
+ .mypy_cache/
52
+ .pytype/
53
+
54
+ # Documentation
55
+ docs/
56
+ *.md
57
+ !README.md
58
+
59
+ # Local development
60
+ .dev/
61
+ *.log
62
+ logs/
63
+ .env.*
64
+ !.env.example
65
+
66
+ # Docker
67
+ Dockerfile*
68
+ docker-compose*.yml
69
+ .docker/
70
+
71
+ # CI/CD
72
+ .github/
73
+ .gitlab-ci.yml
74
+ .travis.yml
75
+
76
+ # Misc
77
+ .DS_Store
78
+ Thumbs.db
@@ -0,0 +1,54 @@
1
+ # 环境变量示例
2
+
3
+ # 应用配置
4
+ BOLT_APP_NAME=my-app
5
+ BOLT_DEBUG=true
6
+ BOLT_ENVIRONMENT=development
7
+
8
+ # 数据库配置
9
+ BOLT_DATABASE_URL=sqlite+aiosqlite:///./dev.db
10
+ #BOLT_DATABASE_POOL_SIZE=5
11
+ BOLT_DATABASE_ECHO_SQL=false
12
+
13
+ # Redis 配置
14
+ BOLT_REDIS_URL=redis://localhost:6379/0
15
+ BOLT_REDIS_PREFIX=bolt:
16
+
17
+ # 日志配置
18
+ BOLT_LOG_LEVEL=INFO
19
+ BOLT_LOG_FORMAT=json
20
+ BOLT_LOG_DIR=logs
21
+
22
+ # LLM 配置(OxyGent 引擎走 OpenAI 兼容端点;provider 可选 openai/deepseek/qwen/custom)
23
+ BOLT_LLM_DEFAULT_PROVIDER=openai
24
+ BOLT_LLM_DEFAULT_MODEL=gpt-4o
25
+ BOLT_LLM_API_KEY=your-api-key-here
26
+ # OpenAI 兼容端点地址(DeepSeek/通义/自建网关必配;openai 官方可不配)
27
+ BOLT_LLM_BASE_URL=https://api.deepseek.com
28
+ BOLT_LLM_MAX_TOKENS=4096
29
+
30
+ # OxyGent 引擎配置
31
+ # 多 worker 部署必须配置 ES 集群以共享会话历史;留空 = 进程内存存储
32
+ BOLT_OXY_ES_HOSTS=
33
+ BOLT_OXY_PRELOAD=false
34
+
35
+ # OxyGent A2A 跨进程协作(把本进程 master 暴露给其他 bolt 应用委派)
36
+ BOLT_OXY_A2A_SERVER_ENABLED=false
37
+ BOLT_OXY_A2A_BASE_PATH=/a2a
38
+ # 共享密钥;留空 = 不鉴权(仅限内网/开发环境)
39
+ BOLT_OXY_A2A_TOKEN=
40
+
41
+ # BoltAgent 会话记忆后端:memory(进程内,默认) / redis(多 worker 共享,复用 BOLT_REDIS_URL)
42
+ BOLT_MEMORY_BACKEND=memory
43
+ BOLT_MEMORY_TTL=3600
44
+
45
+ # OpenTelemetry 配置
46
+ BOLT_TELEMETRY_ENABLED=true
47
+ BOLT_TELEMETRY_ENDPOINT=http://localhost:4317
48
+ BOLT_TELEMETRY_SERVICE_NAME=bolt-app
49
+
50
+
51
+ # ============ 独立指标端口(Prometheus 抓取) ============
52
+ # 启用后应用在 BOLT_METRICS_PORT 起一个无认证 /metrics 服务(限内网抓取)
53
+ #BOLT_METRICS_SERVER_ENABLED=true
54
+ #BOLT_METRICS_PORT=9090
@@ -0,0 +1,18 @@
1
+ # 统一换行符为 LF(跨平台一致)
2
+ * text=auto eol=lf
3
+
4
+ # Windows 脚本保留 CRLF
5
+ *.bat text eol=crlf
6
+ *.cmd text eol=crlf
7
+ *.ps1 text eol=crlf
8
+
9
+ # 二进制文件不做换行转换
10
+ *.png binary
11
+ *.jpg binary
12
+ *.jpeg binary
13
+ *.gif binary
14
+ *.ico binary
15
+ *.db binary
16
+ *.sqlite binary
17
+ *.woff binary
18
+ *.woff2 binary
@@ -0,0 +1,23 @@
1
+ # 三件套:红了拒绝合并
2
+ name: ci
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ quality:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - uses: actions/setup-python@v5
14
+ with:
15
+ python-version: "3.11"
16
+ - name: 安装
17
+ run: pip install -e ".[dev]" && pip install -e ".[observability]" || pip install -e ".[dev]"
18
+ - name: ① ruff
19
+ run: ruff check bolt
20
+ - name: ② mypy
21
+ run: mypy bolt/core bolt/domain --ignore-missing-imports --no-strict-optional
22
+ - name: ③ pytest
23
+ run: pytest tests/unit -q -o addopts=""
@@ -0,0 +1,69 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.pyo
5
+ *.pyd
6
+ .Python
7
+ .build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ .eggs/
12
+ *.egg-info/
13
+ *.egg
14
+
15
+ # Virtual environments
16
+ .venv/
17
+ venv/
18
+ ENV/
19
+
20
+ # IDE
21
+ .idea/
22
+ .vscode/
23
+ *.swp
24
+ *.swo
25
+ *~
26
+
27
+ # Testing
28
+ .pytest_cache/
29
+ .coverage
30
+ htmlcov/
31
+ .tox/
32
+ .nox/
33
+ coverage.xml
34
+ *.cover
35
+
36
+ # Database
37
+ *.db
38
+ *.sqlite
39
+ *.sqlite3
40
+
41
+ # Logs
42
+ logs/
43
+ *.log
44
+
45
+ # Environment
46
+ .env
47
+ .env.local
48
+ .env.*.local
49
+
50
+ # OS
51
+ .DS_Store
52
+ Thumbs.db
53
+
54
+ # Build
55
+ *.pyc
56
+
57
+ # Test app
58
+ test_app/.env
59
+ test_app/*.db
60
+
61
+ # CLI/脚手架生成的临时产物
62
+ .bolt/
63
+ .tests/
64
+ *.bak
65
+
66
+ # 本地 AI 工具配置
67
+ .claude/
68
+ coverage.json
69
+ cache_dir/
@@ -0,0 +1,51 @@
1
+ # Pre-commit hooks for Bolt framework
2
+ # See https://pre-commit.com for more information
3
+
4
+ default_language_version:
5
+ python: python3.12
6
+
7
+ repos:
8
+ # General file checks
9
+ - repo: https://github.com/pre-commit/pre-commit-hooks
10
+ rev: v5.0.0
11
+ hooks:
12
+ - id: trailing-whitespace
13
+ - id: end-of-file-fixer
14
+ - id: check-yaml
15
+ args: [--unsafe]
16
+ - id: check-toml
17
+ - id: check-json
18
+ - id: check-added-large-files
19
+ args: [--maxkb=500]
20
+ - id: check-merge-conflict
21
+ - id: detect-private-key
22
+ - id: no-commit-to-branch
23
+ args: [--branch, master, --branch, main]
24
+
25
+ # Ruff - linter + formatter (replaces flake8, isort, black)
26
+ - repo: https://github.com/astral-sh/ruff-pre-commit
27
+ rev: v0.8.0
28
+ hooks:
29
+ - id: ruff
30
+ args: [--fix, --exit-non-zero-on-fix]
31
+ - id: ruff-format
32
+
33
+ # Type checking
34
+ - repo: https://github.com/pre-commit/mirrors-mypy
35
+ rev: v1.14.0
36
+ hooks:
37
+ - id: mypy
38
+ args: [--ignore-missing-imports]
39
+ additional_dependencies:
40
+ - pydantic>=2.10
41
+ - fastapi>=0.115
42
+ files: ^bolt/
43
+
44
+ # Security checks
45
+ - repo: https://github.com/PyCQA/bandit
46
+ rev: 1.9.0
47
+ hooks:
48
+ - id: bandit
49
+ args: [-c, pyproject.toml]
50
+ additional_dependencies: ["bandit[toml]"]
51
+ files: ^bolt/
@@ -0,0 +1,127 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Fixed
11
+
12
+ - **`bulk_upsert` 支持 MySQL/MariaDB**:新增 `ON DUPLICATE KEY UPDATE` 分支(原仅 PostgreSQL,非 PG 直接抛错);sqlite 走与 PG 同构的 `ON CONFLICT`;注意 MySQL rowcount 语义(插入=1/更新=2/无变化=0)
13
+ - **连接池参数覆盖 MySQL/MariaDB**:`database.py` 原仅 PostgreSQL 添加 pool_size/max_overflow/pre_ping,MySQL 走裸默认(5 连接、无心跳),高并发与 wait_timeout 场景会出 "MySQL server has gone away";现在 PG/MySQL/MariaDB 统一注入池参数,SQLite 维持原策略
14
+ - **RedisCacheBackend 弃用调用清理**:`setex`(redis-py 8.x 起弃用)改为 `set(key, value, ex=ttl)`,行为等价
15
+ - **测试环境**:补充 `redis`/`fakeredis` 测试依赖(原 14 例 RedisCacheBackend 用例因 patch 目标 `aioredis` 未绑定而失败);Redis 相关用例在未安装 redis 的环境中自动跳过
16
+ - **新增 Redis 集成测试** `tests/integration/test_redis_integration.py`(5 例):连本地 Docker Redis(localhost:6379,redis 服务需发布端口)验证真实读写/TTL 过期/重连持久化;无可用 Redis 自动跳过
17
+
18
+ ### Changed
19
+
20
+ - **统一响应格式对齐内部规范**:所有接口(含异常/限流/租户/体积限制/关机中间件)统一为
21
+ `{success, code:int, message, data, timestamp, trace_id?, error?}`
22
+ - `code` 改为 int:0=成功;失败为 HTTP 语义码(400/401/403/404/409/413/422/429/500/502),业务自定义码从 10000 段起
23
+ - 新增 `timestamp`(ISO8601 服务端时间);`error` 为失败时的可读错误码(如 NOT_FOUND);`trace_id` 保留
24
+ - `bolt/core/response.py` 为唯一定义点;全量单测(1859 例)已更新并通过
25
+ - 测试环境:补充 `redis`/`fakeredis` 测试依赖(原 14 例 RedisCacheBackend 用例因 patch 目标 `aioredis` 未绑定而失败);Redis 相关用例在未安装 redis 的环境中自动跳过
26
+
27
+ - **Agent 引擎全量切换为 OxyGent**(PyPI `oxygent==1.1.3`),移除 langchain/langgraph/langsmith 依赖
28
+ - `BoltAgent` 对话/工具循环/流式由 OxyGent MAS 驱动(ReAct 工具循环完整可用,`AgentResult.tool_calls` 真实填充)
29
+ - 新增 `MultiAgentSystem` / `AgentSpec` 多 Agent 编排 API(master 委派 sub_agents)
30
+ - 新增 A2A 跨进程协作:`add_remote_agent` 客户端委派 + `BOLT_OXY_A2A_SERVER_ENABLED` 服务端暴露(含共享密钥校验)
31
+ - `ConversationMemory` 重建为纯 Python 实现(内存/Redis/DB 三后端),后端经 `BOLT_MEMORY_BACKEND` 配置化
32
+ - RAG 全面重写为自有实现:Document/Splitters(纯 Python 递归分割)/Loaders(pypdf+stdlib+httpx,SSRF 防护保留)/Embeddings(OpenAI 兼容直连)/VectorStore(numpy 内存 + Chroma 原生)
33
+ - 删除 `AgentGraph`(langgraph 封装)与 `bolt.agent.providers`(RAG 的 LLM 调用改走 `bolt.rag.llm`)
34
+
35
+ ### Added
36
+
37
+ - `bolt-boot[oxy]` extra:OxyGent 引擎(默认 Agent 引擎,含 `mcp<2`/`python-dotenv` 补钉)
38
+ - `scripts/oxy_integration_smoke.py`:真机集成冒烟(MockLLM 零网络验证委派全链路)
39
+ - 会话记忆配置:`BOLT_MEMORY_BACKEND` / `BOLT_MEMORY_TTL`;A2A 配置:`BOLT_OXY_A2A_*`
40
+
41
+ ### Fixed(生产级框架 bug)
42
+ - observability: `get_tracer`/`get_meter` 持锁调用 init 导致的自死锁(改 RLock)
43
+ - config_center: Apollo `watch` 变更检测死代码(回调永不触发)与失败后零退避 CPU 紧转
44
+ - mq/kafka: `subscribe` 循环 pending future 泄漏
45
+ - security/api_key: `hashlib` 调用错误导致 API Key 生成与旧格式校验必崩
46
+ - security/jwt: `refresh_access_token` 未遵循 blacklist `fail_closed` 配置
47
+ - distributed_lock: 注入 redis client 时 Lua 脚本未注册导致 release 崩溃
48
+ - core/di: 单例工厂异常后 `_PENDING` 标记残留(之后误报循环依赖);scoped 服务越界获取显式报错
49
+ - mq: `ack/nack` 现返回状态更新后的 Message(冻结数据契约下可观察状态流转)
50
+ - domain/transaction: `transactional` 跨 session 复用事务上下文前校验 session 身份
51
+
52
+ ### Changed
53
+ - Agent 层单引擎化:移除 LangSmith 死代码与 LangGraph 时代残留,文档同步为 OxyGent
54
+ - core 关闭路径改用 `bolt.core.lifecycle` 生命周期注册表,不再感知具体基础设施类型
55
+ - RequestValidationError/HTTPException 接入统一响应 envelope
56
+ - 权限错误消息带上缺失的权限/角色名;健康检查失败消息带上异常文本
57
+ - `BoltAgent._memories` / `OxyRuntime.session_traces` 改为有界 LRU,消除慢性内存泄漏
58
+ - `@tool` 注册沿 MRO 收集,父类工具可被子类继承
59
+ - 时区统一:cache_backends 使用 `time.time()`,registry 使用 aware UTC
60
+
61
+ ### Fixed
62
+ - agent/oxy/engine: 无工具 Agent 的 invoke/chat 曾路由到不存在的
63
+ `{name}__chat` 孪生导致 KeyError(冷眼新用户实测发现,README 首例
64
+ 即触发);现无工具 Agent 直接路由主名
65
+ - agent/oxy/runtime: 有工具 Agent 的自定义 system_prompt 改走
66
+ `additional_prompt` 追加(原用 prompt 覆盖会吞掉默认提示词中的
67
+ `${tools_description}` 渲染,模型看不到任何工具)
68
+ - agent/oxy/mapping: `invoke()/chat()` 最终输出剥离 `<think>` 推理块,
69
+ 返回干净正文(流式透传不受影响)
70
+ - README: 补 api_prefix 前缀说明、DeepSeek 等国产模型接入方式、
71
+ 流式语义说明、独立指标端口配置
72
+
73
+ ### Fixed
74
+ - oxy/runtime: `_build_mas` 对 oxygent 1.1.3 的 import 路径错误
75
+ (ChatAgent/FunctionHub/ReActAgent/OpenAILLM 位于 `oxygent.oxy` 子模块)
76
+ - oxy/llm_compat(新增): 修复上游流式 reasoning/content 分流 bug,
77
+ DeepSeek 等思考模型每个 delta 均携带 reasoning_content 属性(content
78
+ 阶段值为 None),上游 hasattr 判断导致正文被全部丢弃、ReAct 失效。
79
+ 修复后经 DeepSeek 真实环境端到端验证:ReAct 工具调用、无工具对话、
80
+ RAG LLM 直连三条路径全部通过
81
+
82
+ ### Fixed
83
+ - 部署外壳(生产就绪评审 P1):Dockerfile 修复源码 COPY 缺失导致构建必败
84
+ 与无效 CMD(新增 bolt/__main__.py 内置演示应用);BOLT_ENV →
85
+ BOLT_ENVIRONMENT(原变量名使容器内生产校验全部失效,已实测恢复)
86
+ - prometheus-client 升级为核心依赖;新增独立指标端口
87
+ (BOLT_METRICS_SERVER_ENABLED,默认关闭)打通 deploy/prometheus.yml 抓取链路
88
+ - scheduler: Redis 后端下分布式锁接线 _execute_job(多实例部署同一任务
89
+ 仅一个实例执行;Memory 后端行为不变),附接线测试
90
+ - 安全: get_current_user 强制 type==access(refresh token 不再能当
91
+ access 凭据);mas_api session_traces 改走 LRU 入口
92
+
93
+ ### Fixed
94
+ - security/brute_force: 容量上限改为 LRU 硬驱逐(原惰性清理可被
95
+ 轮换 username 的攻击者撑大内存),纯 check 不再产生空条目
96
+ - deploy: Grafana 面板挂载路径修正(deploy/grafana)并补充
97
+ provisioning provider 配置,原配置面板加载为空
98
+
99
+ ### Added
100
+ - `bolt.core.lifecycle` 生命周期注册表(启动/关闭钩子对称)与
101
+ `ScopedServiceError` 异常类型
102
+ - `docs/KNOWN-TRADEOFFS.md` 技术债台账(能力边界/安全取舍/运维前置条件)
103
+ - repository 缓存能力拆分至 `bolt/domain/repository/cache.py`
104
+ (CachePort + CacheMixin),base.py 803 → 713 行
105
+ - TokenBlacklist 读路径 fail-open / 写路径 fail-closed 语义、
106
+ 撤销往返与全量撤销的回归测试
107
+ - OxyGent MAS 真实物化测试(test_oxy_materialization.py,需安装 oxygent):
108
+ 覆盖 Config/LLM 去重/FunctionHub 工具桥接/ReActAgent-ChatAgent 双映射/aclose
109
+ - 测试套件修复并扩展至 1969 个用例(全绿),覆盖率 72% → 80.00%(门禁首次真实达标)
110
+ - 新增测试覆盖:jwt_keys、repository filters/pagination/bulk、core protocols/plugin/telemetry、
111
+ agent messages、RAG advanced 全系列、Neo4j/内存图谱库、多模态处理器、CLI 命令
112
+
113
+ ## [0.1.0] - 2026-04-26
114
+
115
+ ### Added
116
+ - AI 原生 FastAPI 框架核心(App 工厂、配置、DI 容器、中间件链)
117
+ - DDD 分层架构(Domain / API / Infrastructure / Security)
118
+ - Agent 模块(BoltAgent基类、OxyGent MAS 引擎驱动、多 Agent 编排、对话记忆)
119
+ - RAG 模块(文档加载、分割、嵌入、向量存储、检索器)
120
+ - Advanced RAG(重排序、上下文压缩、引用生成、混合搜索、知识图谱、多模态)
121
+ - 安全模块(JWT RS256/ES256/HS256、API Key、RBAC、多租户隔离、暴力破解防护)
122
+ - 基础设施(Redis 缓存、Kafka/RabbitMQ/RocketMQ 消息队列、分布式锁、调度器)
123
+ - 微服务支持(Consul/Nacos 注册中心、Apollo/Nacos 配置中心、可观测性 OpenTelemetry)
124
+ - CLI 工具(init / generate / migrate / agent / rag / test / docs / db)
125
+ - Docker 多阶段构建 + docker-compose 全栈编排
126
+ - CI/CD 四阶段流水线(lint → test → build → docker)
127
+ - 完整测试套件(单元测试 + 集成测试,覆盖率 > 80%)
@@ -0,0 +1,51 @@
1
+ # 贡献指南
2
+
3
+ 感谢你为 Bolt 做贡献!本文档说明如何开始以及项目维护的底线规则。
4
+
5
+ ## 开发环境
6
+
7
+ ```bash
8
+ # Python 3.11+
9
+ pip install -e ".[dev]" # 框架 + 开发工具
10
+ # 或按需安装可选依赖
11
+ pip install -e ".[oxy]" # OxyGent Agent 引擎
12
+ pip install -e ".[rag]" # RAG 全家桶
13
+ ```
14
+
15
+ ## 底线规则(CI 会拦截)
16
+
17
+ 1. **测试必须全绿**。`pytest tests/unit tests/integration` 零失败、零错误、零挂起;
18
+ 覆盖率门禁为 `--cov-fail-under=80`(pyproject 中已配置),新增代码请附带测试。
19
+ 2. **测试与实现同步演进**。修改实现时,同步更新受影响的测试契约;
20
+ 不要为了让旧测试通过而回退实现,也不要删测试来"变绿"。
21
+ 3. **静态检查**:`ruff check bolt` 零告警;`mypy` 配置为 `strict = true`
22
+ (第三方库在 pyproject overrides 中豁免)。
23
+ 4. **禁止引入**:`eval`/`exec`/`pickle.loads`、`shell=True`、`verify=False`、
24
+ 未脱敏的敏感信息日志。安全敏感改动(认证、加密、路径处理)请在 PR 中明确标注。
25
+
26
+ ## 提交规范
27
+
28
+ - 遵循 [Conventional Commits](https://www.conventionalcommits.org/zh-hans/):
29
+ `feat:` / `fix:` / `docs:` / `refactor:` / `test:` / `chore:`
30
+ - 一次提交聚焦一件事;提交前确保本地全量测试通过。
31
+
32
+ ## 架构约定(写代码前请读)
33
+
34
+ 完整架构见 [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md)。核心纪律:
35
+
36
+ - **分层单向依赖**:`core → domain → api/security/infrastructure`;
37
+ core 不感知具体基础设施类型(通过 `bolt.core.lifecycle` 注册关闭钩子、
38
+ `bolt.core.protocols` 定义端口协议)。
39
+ - **防腐层**:第三方 SDK 类型不得泄漏出适配模块(参考 `bolt/agent/oxy/`)。
40
+ - **错误处理**:对外抛 `BoltError` 子类(见 `bolt/core/exceptions.py`),
41
+ 统一响应格式 `{success, code, message, data}`;不要引入第二种错误信封。
42
+ - **有界资源**:任何以用户输入为 key 的内存缓存必须有上限(LRU 语义,
43
+ 参考 `OxyRuntime.session_traces`、`BoltAgent._memories`)。
44
+ - **事务**:业务方法用 `@transactional`;跨 session 场景注意 session 身份校验。
45
+ - **时间**:统一 aware UTC(`datetime.now(UTC)`)或 epoch(`time.time()`),
46
+ 禁止 naive `datetime.now()`。
47
+
48
+ ## 报告 bug
49
+
50
+ 请附上:最小复现代码、预期/实际行为、Python 版本、相关 traceback。
51
+ 安全问题请勿公开提交,见 [SECURITY.md](SECURITY.md)。
@@ -0,0 +1,55 @@
1
+ # Bolt 框架 Docker 镜像
2
+ # 多阶段构建优化生产镜像
3
+
4
+ # ============ 构建阶段 ============
5
+ FROM python:3.12-slim AS builder
6
+
7
+ WORKDIR /app
8
+
9
+ # 安装构建依赖(利用 Docker layer cache)
10
+ RUN apt-get update && apt-get install -y --no-install-recommends \
11
+ build-essential \
12
+ && rm -rf /var/lib/apt/lists/*
13
+
14
+ # 复制包定义与源码(hatchling 构建需要 bolt/ 源码与 README 元数据)
15
+ COPY pyproject.toml README.md ./
16
+ COPY bolt ./bolt
17
+
18
+ # 创建虚拟环境并安装包及其核心依赖
19
+ RUN python -m venv /opt/venv
20
+ ENV PATH="/opt/venv/bin:$PATH"
21
+ RUN pip install --no-cache-dir --upgrade pip && pip install --no-cache-dir .
22
+
23
+ # ============ 生产阶段 ============
24
+ FROM python:3.12-slim AS production
25
+
26
+ WORKDIR /app
27
+
28
+ # 安装运行时系统依赖
29
+ RUN apt-get update && apt-get install -y --no-install-recommends \
30
+ curl \
31
+ && rm -rf /var/lib/apt/lists/* \
32
+ && useradd --create-home --shell /bin/bash appuser
33
+
34
+ # 从构建阶段复制虚拟环境(bolt 包及其依赖已安装其中)
35
+ COPY --from=builder /opt/venv /opt/venv
36
+ ENV PATH="/opt/venv/bin:$PATH"
37
+
38
+ # 安全:非 root 用户运行
39
+ RUN chown -R appuser:appuser /app
40
+ USER appuser
41
+
42
+ # 环境变量
43
+ ENV PYTHONUNBUFFERED=1 \
44
+ PYTHONDONTWRITEBYTECODE=1 \
45
+ BOLT_ENVIRONMENT=production
46
+
47
+ # 暴露端口(8000: API, 9090: 指标,需 BOLT_METRICS_SERVER_ENABLED=true)
48
+ EXPOSE 8000 9090
49
+
50
+ # 健康检查
51
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
52
+ CMD curl -f http://localhost:8000/health || exit 1
53
+
54
+ # 默认命令:内置演示应用(健康检查等基础端点),生产部署请覆盖为业务 app
55
+ CMD ["uvicorn", "bolt.__main__:app", "--host", "0.0.0.0", "--port", "8000"]
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Cheng Qiaoqiao
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,18 @@
1
+ .PHONY: install dev test lint typecheck check
2
+
3
+ install: ## 安装框架(可编辑模式)
4
+ pip install -e .
5
+
6
+ dev: ## 启动开发服务器(默认 8000)
7
+ uvicorn main:app --reload --port 8000
8
+
9
+ test: ## 全量测试
10
+ pytest tests/unit -q -o addopts=""
11
+
12
+ lint: ## ruff 规范检查
13
+ ruff check bolt
14
+
15
+ typecheck: ## mypy 类型检查
16
+ mypy bolt/core bolt/domain --ignore-missing-imports --no-strict-optional
17
+
18
+ check: lint typecheck test ## 三件套(CI 同款)