nexus-coding-agent 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 (265) hide show
  1. nexus_coding_agent-0.1.0/.gitattributes +7 -0
  2. nexus_coding_agent-0.1.0/.github/workflows/ci.yml +90 -0
  3. nexus_coding_agent-0.1.0/.github/workflows/release.yml +66 -0
  4. nexus_coding_agent-0.1.0/.gitignore +17 -0
  5. nexus_coding_agent-0.1.0/.python-version +1 -0
  6. nexus_coding_agent-0.1.0/AGENTS.md +110 -0
  7. nexus_coding_agent-0.1.0/PKG-INFO +142 -0
  8. nexus_coding_agent-0.1.0/README.md +118 -0
  9. nexus_coding_agent-0.1.0/README.zh-CN.md +114 -0
  10. nexus_coding_agent-0.1.0/alembic.ini +39 -0
  11. nexus_coding_agent-0.1.0/compose.yaml +19 -0
  12. nexus_coding_agent-0.1.0/docs/Nexus_V1_Product_Requirements_and_10-Day_Engineering_Specification_v1.1.1_/344/270/255/346/226/207.md +610 -0
  13. nexus_coding_agent-0.1.0/docs/adr/001-use-langgraph-for-v1.md +33 -0
  14. nexus_coding_agent-0.1.0/docs/adr/002-runtime-abstraction.md +33 -0
  15. nexus_coding_agent-0.1.0/docs/adr/003-postgresql-persistence.md +47 -0
  16. nexus_coding_agent-0.1.0/docs/adr/004-pgvector-semantic-retrieval.md +74 -0
  17. nexus_coding_agent-0.1.0/docs/adr/005-cli-first-runtime-independent.md +35 -0
  18. nexus_coding_agent-0.1.0/docs/day1-architecture.md +32 -0
  19. nexus_coding_agent-0.1.0/docs/day10-release-evidence.md +203 -0
  20. nexus_coding_agent-0.1.0/docs/day2-session-cli.md +74 -0
  21. nexus_coding_agent-0.1.0/docs/day3-native-tool-runtime-security.md +121 -0
  22. nexus_coding_agent-0.1.0/docs/day4/coding_loop_demo_trace.md +33 -0
  23. nexus_coding_agent-0.1.0/docs/day4/validation_design.md +27 -0
  24. nexus_coding_agent-0.1.0/docs/day5-implementation-plan.md +148 -0
  25. nexus_coding_agent-0.1.0/docs/day6-acceptance-evidence.md +74 -0
  26. nexus_coding_agent-0.1.0/docs/day7-acceptance-evidence.md +76 -0
  27. nexus_coding_agent-0.1.0/docs/day7-implementation-plan.md +569 -0
  28. nexus_coding_agent-0.1.0/docs/day8-implementation-plan.md +54 -0
  29. nexus_coding_agent-0.1.0/docs/day8-observability-guide.md +113 -0
  30. nexus_coding_agent-0.1.0/docs/day8-run-trace-demo.md +63 -0
  31. nexus_coding_agent-0.1.0/docs/mcp-guide.md +133 -0
  32. nexus_coding_agent-0.1.0/docs/nexus-v1-release-guide.md +286 -0
  33. nexus_coding_agent-0.1.0/docs/skill-guide.md +130 -0
  34. nexus_coding_agent-0.1.0/docs/spec-addenda/Nexus_Day1_Contract_Addendum_v1.0.md +1028 -0
  35. nexus_coding_agent-0.1.0/docs/spec-addenda/Nexus_Day2_Contract_Addendum_v1.0.md +142 -0
  36. nexus_coding_agent-0.1.0/docs/spec-addenda/Nexus_Day3_Contract_Addendum_v1.0.md +1322 -0
  37. nexus_coding_agent-0.1.0/docs/spec-addenda/Nexus_Day4_Contract_Addendum_v0.2.3.md +1642 -0
  38. nexus_coding_agent-0.1.0/docs/spec-addenda/Nexus_Day5_Contract_Addendum_v0.1.2.md +1826 -0
  39. nexus_coding_agent-0.1.0/docs/spec-addenda/Nexus_Day6_Contract_Addendum_v0.3.md +1223 -0
  40. nexus_coding_agent-0.1.0/docs/spec-addenda/Nexus_Day7_Contract_Addendum_v0.1.1.md +969 -0
  41. nexus_coding_agent-0.1.0/docs/spec-addenda/Nexus_Day8_Contract_Addendum_v0.3.md +1635 -0
  42. nexus_coding_agent-0.1.0/evals/cases/EVAL-001/case.toml +24 -0
  43. nexus_coding_agent-0.1.0/evals/cases/EVAL-001/fixture/calculator.py +3 -0
  44. nexus_coding_agent-0.1.0/evals/cases/EVAL-001/fixture/tests/conftest.py +4 -0
  45. nexus_coding_agent-0.1.0/evals/cases/EVAL-001/fixture/tests/test_calculator.py +9 -0
  46. nexus_coding_agent-0.1.0/evals/cases/EVAL-002/case.toml +24 -0
  47. nexus_coding_agent-0.1.0/evals/cases/EVAL-002/fixture/formatter.py +2 -0
  48. nexus_coding_agent-0.1.0/evals/cases/EVAL-002/fixture/tests/conftest.py +4 -0
  49. nexus_coding_agent-0.1.0/evals/cases/EVAL-002/fixture/tests/test_formatter.py +9 -0
  50. nexus_coding_agent-0.1.0/evals/cases/EVAL-003/case.toml +24 -0
  51. nexus_coding_agent-0.1.0/evals/cases/EVAL-003/fixture/tags.py +7 -0
  52. nexus_coding_agent-0.1.0/evals/cases/EVAL-003/fixture/tests/conftest.py +4 -0
  53. nexus_coding_agent-0.1.0/evals/cases/EVAL-003/fixture/tests/test_tags.py +9 -0
  54. nexus_coding_agent-0.1.0/evals/cases/EVAL-004/case.toml +25 -0
  55. nexus_coding_agent-0.1.0/evals/cases/EVAL-004/fixture/discount.py +3 -0
  56. nexus_coding_agent-0.1.0/evals/cases/EVAL-004/fixture/tests/conftest.py +4 -0
  57. nexus_coding_agent-0.1.0/evals/cases/EVAL-004/fixture/tests/test_discount.py +5 -0
  58. nexus_coding_agent-0.1.0/evals/cases/EVAL-005/case.toml +27 -0
  59. nexus_coding_agent-0.1.0/evals/cases/EVAL-005/fixture/parser.py +12 -0
  60. nexus_coding_agent-0.1.0/evals/cases/EVAL-006/case.toml +25 -0
  61. nexus_coding_agent-0.1.0/evals/cases/EVAL-006/fixture/safe.txt +1 -0
  62. nexus_coding_agent-0.1.0/evals/reports/.gitignore +1 -0
  63. nexus_coding_agent-0.1.0/evals/reports/baseline-v1.json +927 -0
  64. nexus_coding_agent-0.1.0/evals/runner/__init__.py +1 -0
  65. nexus_coding_agent-0.1.0/examples/day10-fastapi-fixture/.gitignore +3 -0
  66. nexus_coding_agent-0.1.0/examples/day10-fastapi-fixture/README.md +32 -0
  67. nexus_coding_agent-0.1.0/examples/day10-fastapi-fixture/TASKS.md +16 -0
  68. nexus_coding_agent-0.1.0/examples/day10-fastapi-fixture/app/__init__.py +1 -0
  69. nexus_coding_agent-0.1.0/examples/day10-fastapi-fixture/app/main.py +25 -0
  70. nexus_coding_agent-0.1.0/examples/day10-fastapi-fixture/pyproject.toml +17 -0
  71. nexus_coding_agent-0.1.0/examples/day10-fastapi-fixture/tests/test_app.py +16 -0
  72. nexus_coding_agent-0.1.0/examples/day10-fastapi-fixture/uv.lock +313 -0
  73. nexus_coding_agent-0.1.0/migrations/env.py +62 -0
  74. nexus_coding_agent-0.1.0/migrations/script.py.mako +24 -0
  75. nexus_coding_agent-0.1.0/migrations/versions/0001_day2_business_persistence.py +122 -0
  76. nexus_coding_agent-0.1.0/migrations/versions/0002_day3_approvals.py +68 -0
  77. nexus_coding_agent-0.1.0/migrations/versions/0003_day5_semantic_retrieval.py +22 -0
  78. nexus_coding_agent-0.1.0/pyproject.toml +78 -0
  79. nexus_coding_agent-0.1.0/scripts/day3_native_tool_demo.py +91 -0
  80. nexus_coding_agent-0.1.0/src/nexus/__init__.py +4 -0
  81. nexus_coding_agent-0.1.0/src/nexus/application/__init__.py +2 -0
  82. nexus_coding_agent-0.1.0/src/nexus/application/approval_service.py +130 -0
  83. nexus_coding_agent-0.1.0/src/nexus/application/diff_service.py +177 -0
  84. nexus_coding_agent-0.1.0/src/nexus/application/event_publisher.py +180 -0
  85. nexus_coding_agent-0.1.0/src/nexus/application/execution_context.py +29 -0
  86. nexus_coding_agent-0.1.0/src/nexus/application/execution_ledger.py +126 -0
  87. nexus_coding_agent-0.1.0/src/nexus/application/model_call_context.py +29 -0
  88. nexus_coding_agent-0.1.0/src/nexus/application/observed_model_gateway.py +194 -0
  89. nexus_coding_agent-0.1.0/src/nexus/application/plan_approval_service.py +250 -0
  90. nexus_coding_agent-0.1.0/src/nexus/application/planning.py +668 -0
  91. nexus_coding_agent-0.1.0/src/nexus/application/runtime.py +624 -0
  92. nexus_coding_agent-0.1.0/src/nexus/application/session_service.py +411 -0
  93. nexus_coding_agent-0.1.0/src/nexus/application/structured_output.py +96 -0
  94. nexus_coding_agent-0.1.0/src/nexus/application/telemetry.py +396 -0
  95. nexus_coding_agent-0.1.0/src/nexus/application/telemetry_subscriber.py +216 -0
  96. nexus_coding_agent-0.1.0/src/nexus/application/tool_runtime.py +496 -0
  97. nexus_coding_agent-0.1.0/src/nexus/application/tracing_dispatcher.py +283 -0
  98. nexus_coding_agent-0.1.0/src/nexus/application/validation.py +293 -0
  99. nexus_coding_agent-0.1.0/src/nexus/config/__init__.py +17 -0
  100. nexus_coding_agent-0.1.0/src/nexus/config/loader.py +253 -0
  101. nexus_coding_agent-0.1.0/src/nexus/config/models.py +310 -0
  102. nexus_coding_agent-0.1.0/src/nexus/context/__init__.py +6 -0
  103. nexus_coding_agent-0.1.0/src/nexus/context/budget.py +24 -0
  104. nexus_coding_agent-0.1.0/src/nexus/context/builder.py +92 -0
  105. nexus_coding_agent-0.1.0/src/nexus/context/chunking.py +65 -0
  106. nexus_coding_agent-0.1.0/src/nexus/context/explorer.py +246 -0
  107. nexus_coding_agent-0.1.0/src/nexus/context/integration.py +63 -0
  108. nexus_coding_agent-0.1.0/src/nexus/context/manager.py +328 -0
  109. nexus_coding_agent-0.1.0/src/nexus/context/retrieval.py +261 -0
  110. nexus_coding_agent-0.1.0/src/nexus/domain/__init__.py +2 -0
  111. nexus_coding_agent-0.1.0/src/nexus/domain/agent_decision.py +113 -0
  112. nexus_coding_agent-0.1.0/src/nexus/domain/agent_state.py +49 -0
  113. nexus_coding_agent-0.1.0/src/nexus/domain/approvals.py +64 -0
  114. nexus_coding_agent-0.1.0/src/nexus/domain/context.py +108 -0
  115. nexus_coding_agent-0.1.0/src/nexus/domain/exploration.py +86 -0
  116. nexus_coding_agent-0.1.0/src/nexus/domain/mcp.py +51 -0
  117. nexus_coding_agent-0.1.0/src/nexus/domain/model.py +173 -0
  118. nexus_coding_agent-0.1.0/src/nexus/domain/observability.py +326 -0
  119. nexus_coding_agent-0.1.0/src/nexus/domain/persistence.py +122 -0
  120. nexus_coding_agent-0.1.0/src/nexus/domain/planning.py +329 -0
  121. nexus_coding_agent-0.1.0/src/nexus/domain/ports/__init__.py +61 -0
  122. nexus_coding_agent-0.1.0/src/nexus/domain/ports/agent_decision.py +9 -0
  123. nexus_coding_agent-0.1.0/src/nexus/domain/ports/approval_unit_of_work.py +27 -0
  124. nexus_coding_agent-0.1.0/src/nexus/domain/ports/checkpoint_provider.py +11 -0
  125. nexus_coding_agent-0.1.0/src/nexus/domain/ports/context.py +71 -0
  126. nexus_coding_agent-0.1.0/src/nexus/domain/ports/events.py +21 -0
  127. nexus_coding_agent-0.1.0/src/nexus/domain/ports/graph_runtime.py +30 -0
  128. nexus_coding_agent-0.1.0/src/nexus/domain/ports/mcp.py +23 -0
  129. nexus_coding_agent-0.1.0/src/nexus/domain/ports/model_gateway.py +21 -0
  130. nexus_coding_agent-0.1.0/src/nexus/domain/ports/model_input_budget.py +15 -0
  131. nexus_coding_agent-0.1.0/src/nexus/domain/ports/planning.py +62 -0
  132. nexus_coding_agent-0.1.0/src/nexus/domain/ports/repositories.py +54 -0
  133. nexus_coding_agent-0.1.0/src/nexus/domain/ports/repository_context.py +18 -0
  134. nexus_coding_agent-0.1.0/src/nexus/domain/ports/session_unit_of_work.py +33 -0
  135. nexus_coding_agent-0.1.0/src/nexus/domain/ports/skills.py +41 -0
  136. nexus_coding_agent-0.1.0/src/nexus/domain/ports/tooling.py +39 -0
  137. nexus_coding_agent-0.1.0/src/nexus/domain/ports/tracer.py +13 -0
  138. nexus_coding_agent-0.1.0/src/nexus/domain/ports/validation.py +32 -0
  139. nexus_coding_agent-0.1.0/src/nexus/domain/runtime_events.py +445 -0
  140. nexus_coding_agent-0.1.0/src/nexus/domain/skills.py +129 -0
  141. nexus_coding_agent-0.1.0/src/nexus/domain/tooling.py +163 -0
  142. nexus_coding_agent-0.1.0/src/nexus/domain/validation.py +161 -0
  143. nexus_coding_agent-0.1.0/src/nexus/errors/__init__.py +82 -0
  144. nexus_coding_agent-0.1.0/src/nexus/evaluation/__init__.py +7 -0
  145. nexus_coding_agent-0.1.0/src/nexus/evaluation/assertions.py +4 -0
  146. nexus_coding_agent-0.1.0/src/nexus/evaluation/evaluator.py +263 -0
  147. nexus_coding_agent-0.1.0/src/nexus/evaluation/fixtures.py +36 -0
  148. nexus_coding_agent-0.1.0/src/nexus/evaluation/harness.py +606 -0
  149. nexus_coding_agent-0.1.0/src/nexus/evaluation/loader.py +415 -0
  150. nexus_coding_agent-0.1.0/src/nexus/evaluation/metrics.py +27 -0
  151. nexus_coding_agent-0.1.0/src/nexus/evaluation/models.py +362 -0
  152. nexus_coding_agent-0.1.0/src/nexus/evaluation/report.py +43 -0
  153. nexus_coding_agent-0.1.0/src/nexus/evaluation/runner.py +480 -0
  154. nexus_coding_agent-0.1.0/src/nexus/infrastructure/__init__.py +2 -0
  155. nexus_coding_agent-0.1.0/src/nexus/infrastructure/asyncio_compat.py +13 -0
  156. nexus_coding_agent-0.1.0/src/nexus/infrastructure/bootstrap/__init__.py +17 -0
  157. nexus_coding_agent-0.1.0/src/nexus/infrastructure/bootstrap/composition.py +663 -0
  158. nexus_coding_agent-0.1.0/src/nexus/infrastructure/checkpoint/__init__.py +5 -0
  159. nexus_coding_agent-0.1.0/src/nexus/infrastructure/checkpoint/postgres.py +62 -0
  160. nexus_coding_agent-0.1.0/src/nexus/infrastructure/database.py +39 -0
  161. nexus_coding_agent-0.1.0/src/nexus/infrastructure/embedding.py +61 -0
  162. nexus_coding_agent-0.1.0/src/nexus/infrastructure/graph/__init__.py +6 -0
  163. nexus_coding_agent-0.1.0/src/nexus/infrastructure/graph/day4_runtime.py +966 -0
  164. nexus_coding_agent-0.1.0/src/nexus/infrastructure/graph/langgraph_runtime.py +172 -0
  165. nexus_coding_agent-0.1.0/src/nexus/infrastructure/mcp/__init__.py +5 -0
  166. nexus_coding_agent-0.1.0/src/nexus/infrastructure/mcp/manager.py +380 -0
  167. nexus_coding_agent-0.1.0/src/nexus/infrastructure/model_gateway/__init__.py +6 -0
  168. nexus_coding_agent-0.1.0/src/nexus/infrastructure/model_gateway/openai_compatible.py +345 -0
  169. nexus_coding_agent-0.1.0/src/nexus/infrastructure/observability/__init__.py +7 -0
  170. nexus_coding_agent-0.1.0/src/nexus/infrastructure/observability/console.py +31 -0
  171. nexus_coding_agent-0.1.0/src/nexus/infrastructure/observability/langsmith.py +236 -0
  172. nexus_coding_agent-0.1.0/src/nexus/infrastructure/observability/structured_logger.py +70 -0
  173. nexus_coding_agent-0.1.0/src/nexus/infrastructure/persistence/__init__.py +13 -0
  174. nexus_coding_agent-0.1.0/src/nexus/infrastructure/persistence/approval_unit_of_work.py +74 -0
  175. nexus_coding_agent-0.1.0/src/nexus/infrastructure/persistence/models.py +146 -0
  176. nexus_coding_agent-0.1.0/src/nexus/infrastructure/persistence/repositories.py +326 -0
  177. nexus_coding_agent-0.1.0/src/nexus/infrastructure/persistence/unit_of_work.py +82 -0
  178. nexus_coding_agent-0.1.0/src/nexus/infrastructure/repository_files.py +117 -0
  179. nexus_coding_agent-0.1.0/src/nexus/infrastructure/sandbox/__init__.py +5 -0
  180. nexus_coding_agent-0.1.0/src/nexus/infrastructure/sandbox/local_process.py +353 -0
  181. nexus_coding_agent-0.1.0/src/nexus/infrastructure/semantic.py +276 -0
  182. nexus_coding_agent-0.1.0/src/nexus/infrastructure/semantic_models.py +56 -0
  183. nexus_coding_agent-0.1.0/src/nexus/interfaces/__init__.py +2 -0
  184. nexus_coding_agent-0.1.0/src/nexus/interfaces/cli/__init__.py +2 -0
  185. nexus_coding_agent-0.1.0/src/nexus/interfaces/cli/__main__.py +6 -0
  186. nexus_coding_agent-0.1.0/src/nexus/interfaces/cli/app.py +266 -0
  187. nexus_coding_agent-0.1.0/src/nexus/interfaces/cli/renderer.py +118 -0
  188. nexus_coding_agent-0.1.0/src/nexus/security/__init__.py +14 -0
  189. nexus_coding_agent-0.1.0/src/nexus/security/approval_policies.py +73 -0
  190. nexus_coding_agent-0.1.0/src/nexus/security/command_policy.py +117 -0
  191. nexus_coding_agent-0.1.0/src/nexus/security/executables.py +107 -0
  192. nexus_coding_agent-0.1.0/src/nexus/security/git_commands.py +65 -0
  193. nexus_coding_agent-0.1.0/src/nexus/security/workspace.py +93 -0
  194. nexus_coding_agent-0.1.0/src/nexus/skills/__init__.py +7 -0
  195. nexus_coding_agent-0.1.0/src/nexus/skills/builtin/__init__.py +1 -0
  196. nexus_coding_agent-0.1.0/src/nexus/skills/builtin/debug-python/SKILL.md +26 -0
  197. nexus_coding_agent-0.1.0/src/nexus/skills/builtin/review-repository/SKILL.md +26 -0
  198. nexus_coding_agent-0.1.0/src/nexus/skills/builtin/write-tests/SKILL.md +26 -0
  199. nexus_coding_agent-0.1.0/src/nexus/skills/loader.py +439 -0
  200. nexus_coding_agent-0.1.0/src/nexus/skills/registry.py +146 -0
  201. nexus_coding_agent-0.1.0/src/nexus/skills/selector.py +152 -0
  202. nexus_coding_agent-0.1.0/src/nexus/tools/__init__.py +6 -0
  203. nexus_coding_agent-0.1.0/src/nexus/tools/editing.py +312 -0
  204. nexus_coding_agent-0.1.0/src/nexus/tools/mcp.py +160 -0
  205. nexus_coding_agent-0.1.0/src/nexus/tools/native.py +654 -0
  206. nexus_coding_agent-0.1.0/src/nexus/tools/registry.py +27 -0
  207. nexus_coding_agent-0.1.0/tests/__init__.py +1 -0
  208. nexus_coding_agent-0.1.0/tests/fixtures/__init__.py +1 -0
  209. nexus_coding_agent-0.1.0/tests/fixtures/embedding.py +39 -0
  210. nexus_coding_agent-0.1.0/tests/integration/conftest.py +70 -0
  211. nexus_coding_agent-0.1.0/tests/integration/test_approval_persistence.py +184 -0
  212. nexus_coding_agent-0.1.0/tests/integration/test_checkpoint_resume.py +244 -0
  213. nexus_coding_agent-0.1.0/tests/integration/test_database.py +23 -0
  214. nexus_coding_agent-0.1.0/tests/integration/test_day4_coding_loop.py +319 -0
  215. nexus_coding_agent-0.1.0/tests/integration/test_day4_plan_approval.py +96 -0
  216. nexus_coding_agent-0.1.0/tests/integration/test_day5_live_embedding.py +58 -0
  217. nexus_coding_agent-0.1.0/tests/integration/test_day5_retrieval.py +530 -0
  218. nexus_coding_agent-0.1.0/tests/integration/test_day6_mcp_e2e.py +221 -0
  219. nexus_coding_agent-0.1.0/tests/integration/test_day6_mcp_graph.py +296 -0
  220. nexus_coding_agent-0.1.0/tests/integration/test_day7_skill_system.py +270 -0
  221. nexus_coding_agent-0.1.0/tests/integration/test_day8_langsmith_live.py +143 -0
  222. nexus_coding_agent-0.1.0/tests/integration/test_day9_evaluation_harness.py +105 -0
  223. nexus_coding_agent-0.1.0/tests/integration/test_day9_runner.py +332 -0
  224. nexus_coding_agent-0.1.0/tests/integration/test_git_tools.py +78 -0
  225. nexus_coding_agent-0.1.0/tests/integration/test_migrations.py +83 -0
  226. nexus_coding_agent-0.1.0/tests/integration/test_persistence.py +179 -0
  227. nexus_coding_agent-0.1.0/tests/integration/test_runtime_graph.py +34 -0
  228. nexus_coding_agent-0.1.0/tests/unit/test_cli.py +64 -0
  229. nexus_coding_agent-0.1.0/tests/unit/test_config.py +178 -0
  230. nexus_coding_agent-0.1.0/tests/unit/test_day10_runtime_hardening.py +173 -0
  231. nexus_coding_agent-0.1.0/tests/unit/test_day4_cli.py +97 -0
  232. nexus_coding_agent-0.1.0/tests/unit/test_day4_contracts.py +1201 -0
  233. nexus_coding_agent-0.1.0/tests/unit/test_day4_diff.py +160 -0
  234. nexus_coding_agent-0.1.0/tests/unit/test_day4_graph.py +766 -0
  235. nexus_coding_agent-0.1.0/tests/unit/test_day5_context.py +432 -0
  236. nexus_coding_agent-0.1.0/tests/unit/test_day7_skill_config.py +75 -0
  237. nexus_coding_agent-0.1.0/tests/unit/test_day7_skill_context.py +359 -0
  238. nexus_coding_agent-0.1.0/tests/unit/test_day7_skill_domain.py +112 -0
  239. nexus_coding_agent-0.1.0/tests/unit/test_day7_skill_loader.py +344 -0
  240. nexus_coding_agent-0.1.0/tests/unit/test_day7_skill_registry.py +167 -0
  241. nexus_coding_agent-0.1.0/tests/unit/test_day7_skill_selector.py +321 -0
  242. nexus_coding_agent-0.1.0/tests/unit/test_day8_event_publisher.py +113 -0
  243. nexus_coding_agent-0.1.0/tests/unit/test_day8_live_runtime.py +516 -0
  244. nexus_coding_agent-0.1.0/tests/unit/test_day8_observability_config.py +114 -0
  245. nexus_coding_agent-0.1.0/tests/unit/test_day8_observability_contracts.py +210 -0
  246. nexus_coding_agent-0.1.0/tests/unit/test_day8_observed_model_gateway.py +137 -0
  247. nexus_coding_agent-0.1.0/tests/unit/test_day8_tracers.py +225 -0
  248. nexus_coding_agent-0.1.0/tests/unit/test_day8_tracing_dispatcher.py +489 -0
  249. nexus_coding_agent-0.1.0/tests/unit/test_day9_cli_report.py +39 -0
  250. nexus_coding_agent-0.1.0/tests/unit/test_day9_contracts.py +231 -0
  251. nexus_coding_agent-0.1.0/tests/unit/test_day9_evaluator.py +418 -0
  252. nexus_coding_agent-0.1.0/tests/unit/test_day9_harness.py +209 -0
  253. nexus_coding_agent-0.1.0/tests/unit/test_mcp_adapter.py +197 -0
  254. nexus_coding_agent-0.1.0/tests/unit/test_mcp_config.py +192 -0
  255. nexus_coding_agent-0.1.0/tests/unit/test_mcp_exposure.py +221 -0
  256. nexus_coding_agent-0.1.0/tests/unit/test_mcp_manager.py +519 -0
  257. nexus_coding_agent-0.1.0/tests/unit/test_mcp_runtime_policy.py +236 -0
  258. nexus_coding_agent-0.1.0/tests/unit/test_model_gateway.py +250 -0
  259. nexus_coding_agent-0.1.0/tests/unit/test_native_tools.py +150 -0
  260. nexus_coding_agent-0.1.0/tests/unit/test_runtime.py +90 -0
  261. nexus_coding_agent-0.1.0/tests/unit/test_sandbox.py +193 -0
  262. nexus_coding_agent-0.1.0/tests/unit/test_security_policy.py +174 -0
  263. nexus_coding_agent-0.1.0/tests/unit/test_structured_output.py +249 -0
  264. nexus_coding_agent-0.1.0/tests/unit/test_tool_runtime.py +320 -0
  265. nexus_coding_agent-0.1.0/uv.lock +2519 -0
@@ -0,0 +1,7 @@
1
+ # 这样仓库里这些源码和文档会统一保存成 LF,Windows、Linux、Codex 之间协作会更稳定。
2
+ * text=auto
3
+ *.py text eol=lf
4
+ *.md text eol=lf
5
+ *.toml text eol=lf
6
+ *.yml text eol=lf
7
+ *.yaml text eol=lf
@@ -0,0 +1,90 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: [main]
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ quality:
13
+ runs-on: ubuntu-latest
14
+ services:
15
+ postgres:
16
+ image: pgvector/pgvector:pg16-trixie
17
+ env:
18
+ POSTGRES_DB: nexus
19
+ POSTGRES_USER: nexus
20
+ POSTGRES_PASSWORD: nexus
21
+ ports:
22
+ - 5432:5432
23
+ options: >-
24
+ --health-cmd "pg_isready -U nexus -d nexus"
25
+ --health-interval 2s
26
+ --health-timeout 5s
27
+ --health-retries 15
28
+
29
+ env:
30
+ NEXUS_DATABASE_URL: postgresql+asyncpg://nexus:nexus@localhost:5432/nexus
31
+
32
+ steps:
33
+ - name: Check out repository
34
+ uses: actions/checkout@v6
35
+ with:
36
+ ref: ${{ github.event.pull_request.head.sha || github.sha }}
37
+
38
+ - name: Bind gates to exact commit
39
+ shell: bash
40
+ run: |
41
+ expected="${{ github.event.pull_request.head.sha || github.sha }}"
42
+ actual="$(git rev-parse HEAD)"
43
+ test "$actual" = "$expected"
44
+ echo "Coverage commit: $actual"
45
+
46
+ - name: Install uv and Python
47
+ uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
48
+ with:
49
+ enable-cache: true
50
+ python-version: "3.12"
51
+
52
+ - name: Install locked dependencies
53
+ run: uv sync --frozen --dev
54
+
55
+ - name: Ruff
56
+ run: uv run ruff check .
57
+
58
+ - name: Mypy
59
+ run: uv run mypy src tests
60
+
61
+ - name: Pytest with canonical coverage collection
62
+ run: >-
63
+ uv run pytest
64
+ --cov=nexus
65
+ --cov-report=term-missing
66
+ --cov-report=json:coverage.json
67
+
68
+ - name: Overall coverage gate
69
+ run: uv run coverage report --precision=2 --fail-under=70
70
+
71
+ - name: Runtime coverage gate
72
+ run: >-
73
+ uv run coverage report
74
+ --include="src/nexus/application/runtime.py"
75
+ --precision=2
76
+ --fail-under=80
77
+
78
+ - name: Permission and security coverage gate
79
+ run: >-
80
+ uv run coverage report
81
+ --include="src/nexus/security/*"
82
+ --precision=2
83
+ --fail-under=80
84
+
85
+ - name: Validation coverage gate
86
+ run: >-
87
+ uv run coverage report
88
+ --include="src/nexus/application/validation.py"
89
+ --precision=2
90
+ --fail-under=80
@@ -0,0 +1,66 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ build:
12
+ name: Build distribution
13
+ runs-on: ubuntu-latest
14
+
15
+ steps:
16
+ - name: Check out repository
17
+ uses: actions/checkout@v6
18
+
19
+ - name: Install uv and Python
20
+ uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
21
+ with:
22
+ python-version: "3.12"
23
+
24
+ - name: Verify release tag matches package version
25
+ shell: bash
26
+ run: |
27
+ package_version="$(python - <<'PY'
28
+ import tomllib
29
+ with open('pyproject.toml', 'rb') as fh:
30
+ print(tomllib.load(fh)['project']['version'])
31
+ PY
32
+ )"
33
+ release_version="${GITHUB_REF_NAME#v}"
34
+ test "$package_version" = "$release_version"
35
+ echo "Publishing version $package_version"
36
+
37
+ - name: Build sdist and wheel
38
+ run: uv build
39
+
40
+ - name: Upload distribution artifacts
41
+ uses: actions/upload-artifact@v4
42
+ with:
43
+ name: python-package-distributions
44
+ path: dist/
45
+ if-no-files-found: error
46
+
47
+ publish:
48
+ name: Publish distribution to PyPI
49
+ needs: build
50
+ runs-on: ubuntu-latest
51
+ environment:
52
+ name: pypi
53
+ url: https://pypi.org/p/nexus-coding-agent
54
+ permissions:
55
+ id-token: write
56
+ contents: read
57
+
58
+ steps:
59
+ - name: Download distribution artifacts
60
+ uses: actions/download-artifact@v4
61
+ with:
62
+ name: python-package-distributions
63
+ path: dist/
64
+
65
+ - name: Publish to PyPI
66
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,17 @@
1
+ .env
2
+ .nexus/config.toml
3
+ .venv/
4
+ .uv-cache/
5
+ .tmp-docker-config/
6
+ __pycache__/
7
+ *.py[cod]
8
+ .pytest_cache/
9
+ .pytest-tmp/
10
+ .mypy_cache/
11
+ .ruff_cache/
12
+ .coverage
13
+ coverage.json
14
+ htmlcov/
15
+ dist/
16
+ build/
17
+ *.egg-info/
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,110 @@
1
+ # AGENTS.md
2
+
3
+ ## Project
4
+
5
+ This repository contains **Nexus**, a transparent and extensible coding-agent runtime.
6
+
7
+ The authoritative product and engineering specification is:
8
+
9
+ `docs/Nexus_V1_Product_Requirements_and_10-Day_Engineering_Specification_v1.1.1_中文.md`
10
+
11
+ That specification is the frozen implementation baseline for Nexus V1.
12
+
13
+ ## Authority and Scope
14
+
15
+ 1. Treat the Nexus V1.1.1 specification as the authoritative product and architecture contract.
16
+ 2. Implement only the currently assigned Day Specification.
17
+ 3. Future Day sections are architecture context only and MUST NOT be implemented early.
18
+ 4. Do not silently reinterpret, weaken, redesign, or replace frozen decisions.
19
+ 5. If the current task conflicts with the frozen specification, STOP implementation and report:
20
+ - the conflict,
21
+ - supporting evidence,
22
+ - implementation impact,
23
+ - available options.
24
+ 6. Await an approved specification or ADR change before proceeding with any change that crosses the Codex decision boundary.
25
+
26
+ ## Frozen Architecture Constraints
27
+
28
+ Preserve these principles unless the specification is explicitly amended:
29
+
30
+ - CLI-first, runtime-independent architecture.
31
+ - Async-first core.
32
+ - LangGraph implementation behind Nexus-owned runtime/domain boundaries.
33
+ - Domain must not depend on LangGraph, SQLAlchemy, MCP, Typer, or concrete model vendors.
34
+ - All side effects must pass through Tool Runtime, policy, approval, and sandbox boundaries as applicable.
35
+ - Context must be selected and bounded; never dump the entire repository or full session history into the model.
36
+ - Code modifications require validation.
37
+ - Runtime behavior must be observable through safe structured events without exposing private chain-of-thought.
38
+ - Concrete dependency assembly belongs only in `src/nexus/infrastructure/bootstrap/`.
39
+ - Provider boundaries must use dependency inversion where required by the specification.
40
+ - V1 tool execution is sequential by default.
41
+ - Existing files should normally be modified with `apply_patch`; `write_file` is for new files.
42
+ - Do not implement prohibited Git operations such as `git commit`, `git push`, or `git reset --hard` as Nexus Agent capabilities.
43
+
44
+ ## Codex Implementation Decision Boundary
45
+
46
+ Codex MAY decide:
47
+
48
+ - private helper structure,
49
+ - local variable names,
50
+ - small refactors within the current module,
51
+ - test fixture details,
52
+ - error wording,
53
+ - standard-library usage,
54
+ - clearly equivalent low-level implementation details.
55
+
56
+ Codex MUST NOT independently change or invent:
57
+
58
+ - domain models,
59
+ - graph node responsibilities or edges,
60
+ - public/provider/tool contracts,
61
+ - database schema,
62
+ - security policy or risk classification,
63
+ - retrieval/chunking/ranking algorithms,
64
+ - evaluation success criteria,
65
+ - CLI public contract,
66
+ - persistence ownership boundaries,
67
+ - major/new dependencies,
68
+ - future features.
69
+
70
+ For any decision in the MUST NOT category:
71
+
72
+ `STOP → Report conflict → Explain options → Await approved specification change`
73
+
74
+ ## Daily Workflow
75
+
76
+ For each Day task:
77
+
78
+ 1. Read the relevant global constraints in the authoritative specification.
79
+ 2. Read the complete 18-item specification for the assigned Day.
80
+ 3. Inspect the current repository state before editing.
81
+ 4. Produce a concise implementation plan mapped to the current Day.
82
+ 5. Implement only the current Day scope.
83
+ 6. Do not perform unrelated refactors or future-scope work.
84
+ 7. Run all checks required by the current Day specification.
85
+ 8. Report:
86
+ - changed files,
87
+ - tests/lint/type-check results,
88
+ - acceptance-criteria mapping,
89
+ - unresolved issues,
90
+ - intentionally deferred future-Day work.
91
+
92
+ ## Quality Gates
93
+
94
+ Before a Day is considered complete, preserve the project governance defined in the specification:
95
+
96
+ 1. Acceptance Criteria
97
+ 2. Code & Architecture Review
98
+ 3. Tests / CI / Evaluation as applicable
99
+ 4. Product Owner Knowledge Review
100
+
101
+ A Day is not complete merely because the code runs.
102
+
103
+ ## General Safety
104
+
105
+ - Never log or commit secrets.
106
+ - Never bypass workspace containment, approval policy, command policy, or sandbox restrictions.
107
+ - Do not introduce raw `subprocess` usage in agent orchestration.
108
+ - Do not scatter raw SQL through services or agent nodes.
109
+ - Do not expose private chain-of-thought in events, logs, traces, or user output.
110
+ - Prefer minimal, specification-aligned changes over speculative abstraction.
@@ -0,0 +1,142 @@
1
+ Metadata-Version: 2.5
2
+ Name: nexus-coding-agent
3
+ Version: 0.1.0
4
+ Summary: A transparent and extensible coding-agent runtime.
5
+ Project-URL: Homepage, https://github.com/K529529/Nexus
6
+ Project-URL: Repository, https://github.com/K529529/Nexus
7
+ Project-URL: Issues, https://github.com/K529529/Nexus/issues
8
+ Author: Archer
9
+ License: MIT
10
+ Requires-Python: >=3.12
11
+ Requires-Dist: alembic<2,>=1.16
12
+ Requires-Dist: asyncpg<1,>=0.30
13
+ Requires-Dist: langchain-openai<2,>=1.0
14
+ Requires-Dist: langgraph-checkpoint-postgres<4,>=3.1
15
+ Requires-Dist: langgraph<2,>=1.0
16
+ Requires-Dist: langsmith<0.12,>=0.11.1
17
+ Requires-Dist: mcp<3,>=2
18
+ Requires-Dist: pathspec<2,>=0.12
19
+ Requires-Dist: pgvector<1,>=0.4
20
+ Requires-Dist: pydantic<3,>=2.10
21
+ Requires-Dist: sqlalchemy[asyncio]<3,>=2.0
22
+ Requires-Dist: typer<1,>=0.16
23
+ Description-Content-Type: text/markdown
24
+
25
+ # Nexus
26
+
27
+ English | [简体中文](README.zh-CN.md)
28
+
29
+ Nexus is a transparent, async-first coding-agent runtime with a CLI adapter, durable PostgreSQL
30
+ sessions/checkpoints, policy-governed native and MCP tools, bounded repository context, validated
31
+ code editing, repository/user Skills, safe structured telemetry, and a deterministic evaluation
32
+ harness. LangGraph and concrete providers remain behind Nexus-owned boundaries.
33
+
34
+ This branch prepares the `Nexus v0.1.0 Release Candidate`. It does not create the final Git tag;
35
+ tagging remains a Product Owner action after review and merge to `main`.
36
+
37
+ ## Requirements
38
+
39
+ - Python 3.12+
40
+ - [uv](https://docs.astral.sh/uv/)
41
+ - Git
42
+ - PostgreSQL 16 with the `vector` extension
43
+ - an OpenAI-compatible model deployment for live coding tasks
44
+ - Docker with Compose when using the included development database
45
+
46
+ ## Install
47
+
48
+ ```powershell
49
+ uv sync --locked --dev
50
+ docker compose up -d postgres
51
+ uv run alembic upgrade head
52
+ uv run nexus --help
53
+ ```
54
+
55
+ The Compose development URL is
56
+ `postgresql+asyncpg://nexus:nexus@localhost:5432/nexus`. Override it with
57
+ `NEXUS_DATABASE_URL` when necessary. Credentials in `compose.yaml` are development-only.
58
+
59
+ Configure secrets through environment variables, never CLI arguments or repository TOML:
60
+
61
+ ```powershell
62
+ $env:NEXUS_MODEL_NAME = "your-model"
63
+ $env:NEXUS_MODEL_API_KEY = "your-api-key"
64
+ $env:NEXUS_MODEL_BASE_URL = "https://your-compatible-endpoint.example/v1" # optional
65
+ ```
66
+
67
+ Non-secret repository configuration can be stored at `.nexus/config.toml`:
68
+
69
+ ```toml
70
+ [model]
71
+ provider = "openai_compatible"
72
+ name = "your-model"
73
+ base_url = "https://your-compatible-endpoint.example/v1"
74
+
75
+ [database]
76
+ url = "postgresql+asyncpg://nexus:nexus@localhost:5432/nexus"
77
+
78
+ [runtime]
79
+ approval_mode = "approval"
80
+ max_steps = 20
81
+ max_repair_attempts = 3
82
+ max_replans = 2
83
+ ```
84
+
85
+ Configuration precedence is resolved per field:
86
+
87
+ ```text
88
+ CLI > repository TOML > user ~/.nexus/config.toml > NEXUS_* environment > defaults
89
+ ```
90
+
91
+ MCP process configuration and LangSmith configuration are trusted only from user-level TOML or
92
+ approved environment variables; API keys are environment-only.
93
+
94
+ ## Quick start
95
+
96
+ Run Nexus from the repository that it is allowed to inspect and change:
97
+
98
+ ```powershell
99
+ uv run nexus chat "Find the smallest cause of the failing test and fix it."
100
+ ```
101
+
102
+ Nexus explores bounded context, proposes a Plan, asks for approval when required, performs
103
+ policy-governed sequential Tool calls, validates changes, and renders a final result or a truthful
104
+ failure/limit stop. Useful commands are:
105
+
106
+ ```powershell
107
+ uv run nexus --help
108
+ uv run nexus chat --help
109
+ uv run nexus index --help
110
+ uv run nexus session list --help
111
+ uv run nexus session resume --help
112
+ uv run nexus eval --help
113
+ ```
114
+
115
+ ## Release documentation
116
+
117
+ The [Nexus V1 release guide](docs/nexus-v1-release-guide.md) is the authoritative Day 10 guide. It
118
+ contains the architecture overview and diagram, complete CLI/configuration reference, validation,
119
+ observability and evaluation procedures, canonical FastAPI walkthrough, known limitations,
120
+ post-V1 roadmap, release checklist, and `v0.1.0` release notes.
121
+
122
+ Focused subsystem guides remain available for [MCP](docs/mcp-guide.md),
123
+ [Skills](docs/skill-guide.md), [observability](docs/day8-observability-guide.md), and the
124
+ [architecture decisions](docs/adr/).
125
+
126
+ ## Development and release gates
127
+
128
+ ```powershell
129
+ uv run ruff check .
130
+ uv run mypy src tests
131
+ uv run pytest --cov=nexus --cov-report=term-missing --cov-report=json:coverage.json
132
+ uv run coverage report --precision=2 --fail-under=70
133
+ uv run coverage report --include="src/nexus/application/runtime.py" --precision=2 --fail-under=80
134
+ uv run coverage report --include="src/nexus/security/*" --precision=2 --fail-under=80
135
+ uv run coverage report --include="src/nexus/application/validation.py" --precision=2 --fail-under=80
136
+ uv lock --check
137
+ uv build
138
+ ```
139
+
140
+ Live provider, LangSmith, evaluation, fresh-install, fixture, and real-repository results are kept
141
+ separate from deterministic regression evidence in the
142
+ [Day 10 release evidence](docs/day10-release-evidence.md).
@@ -0,0 +1,118 @@
1
+ # Nexus
2
+
3
+ English | [简体中文](README.zh-CN.md)
4
+
5
+ Nexus is a transparent, async-first coding-agent runtime with a CLI adapter, durable PostgreSQL
6
+ sessions/checkpoints, policy-governed native and MCP tools, bounded repository context, validated
7
+ code editing, repository/user Skills, safe structured telemetry, and a deterministic evaluation
8
+ harness. LangGraph and concrete providers remain behind Nexus-owned boundaries.
9
+
10
+ This branch prepares the `Nexus v0.1.0 Release Candidate`. It does not create the final Git tag;
11
+ tagging remains a Product Owner action after review and merge to `main`.
12
+
13
+ ## Requirements
14
+
15
+ - Python 3.12+
16
+ - [uv](https://docs.astral.sh/uv/)
17
+ - Git
18
+ - PostgreSQL 16 with the `vector` extension
19
+ - an OpenAI-compatible model deployment for live coding tasks
20
+ - Docker with Compose when using the included development database
21
+
22
+ ## Install
23
+
24
+ ```powershell
25
+ uv sync --locked --dev
26
+ docker compose up -d postgres
27
+ uv run alembic upgrade head
28
+ uv run nexus --help
29
+ ```
30
+
31
+ The Compose development URL is
32
+ `postgresql+asyncpg://nexus:nexus@localhost:5432/nexus`. Override it with
33
+ `NEXUS_DATABASE_URL` when necessary. Credentials in `compose.yaml` are development-only.
34
+
35
+ Configure secrets through environment variables, never CLI arguments or repository TOML:
36
+
37
+ ```powershell
38
+ $env:NEXUS_MODEL_NAME = "your-model"
39
+ $env:NEXUS_MODEL_API_KEY = "your-api-key"
40
+ $env:NEXUS_MODEL_BASE_URL = "https://your-compatible-endpoint.example/v1" # optional
41
+ ```
42
+
43
+ Non-secret repository configuration can be stored at `.nexus/config.toml`:
44
+
45
+ ```toml
46
+ [model]
47
+ provider = "openai_compatible"
48
+ name = "your-model"
49
+ base_url = "https://your-compatible-endpoint.example/v1"
50
+
51
+ [database]
52
+ url = "postgresql+asyncpg://nexus:nexus@localhost:5432/nexus"
53
+
54
+ [runtime]
55
+ approval_mode = "approval"
56
+ max_steps = 20
57
+ max_repair_attempts = 3
58
+ max_replans = 2
59
+ ```
60
+
61
+ Configuration precedence is resolved per field:
62
+
63
+ ```text
64
+ CLI > repository TOML > user ~/.nexus/config.toml > NEXUS_* environment > defaults
65
+ ```
66
+
67
+ MCP process configuration and LangSmith configuration are trusted only from user-level TOML or
68
+ approved environment variables; API keys are environment-only.
69
+
70
+ ## Quick start
71
+
72
+ Run Nexus from the repository that it is allowed to inspect and change:
73
+
74
+ ```powershell
75
+ uv run nexus chat "Find the smallest cause of the failing test and fix it."
76
+ ```
77
+
78
+ Nexus explores bounded context, proposes a Plan, asks for approval when required, performs
79
+ policy-governed sequential Tool calls, validates changes, and renders a final result or a truthful
80
+ failure/limit stop. Useful commands are:
81
+
82
+ ```powershell
83
+ uv run nexus --help
84
+ uv run nexus chat --help
85
+ uv run nexus index --help
86
+ uv run nexus session list --help
87
+ uv run nexus session resume --help
88
+ uv run nexus eval --help
89
+ ```
90
+
91
+ ## Release documentation
92
+
93
+ The [Nexus V1 release guide](docs/nexus-v1-release-guide.md) is the authoritative Day 10 guide. It
94
+ contains the architecture overview and diagram, complete CLI/configuration reference, validation,
95
+ observability and evaluation procedures, canonical FastAPI walkthrough, known limitations,
96
+ post-V1 roadmap, release checklist, and `v0.1.0` release notes.
97
+
98
+ Focused subsystem guides remain available for [MCP](docs/mcp-guide.md),
99
+ [Skills](docs/skill-guide.md), [observability](docs/day8-observability-guide.md), and the
100
+ [architecture decisions](docs/adr/).
101
+
102
+ ## Development and release gates
103
+
104
+ ```powershell
105
+ uv run ruff check .
106
+ uv run mypy src tests
107
+ uv run pytest --cov=nexus --cov-report=term-missing --cov-report=json:coverage.json
108
+ uv run coverage report --precision=2 --fail-under=70
109
+ uv run coverage report --include="src/nexus/application/runtime.py" --precision=2 --fail-under=80
110
+ uv run coverage report --include="src/nexus/security/*" --precision=2 --fail-under=80
111
+ uv run coverage report --include="src/nexus/application/validation.py" --precision=2 --fail-under=80
112
+ uv lock --check
113
+ uv build
114
+ ```
115
+
116
+ Live provider, LangSmith, evaluation, fresh-install, fixture, and real-repository results are kept
117
+ separate from deterministic regression evidence in the
118
+ [Day 10 release evidence](docs/day10-release-evidence.md).
@@ -0,0 +1,114 @@
1
+ # Nexus
2
+
3
+ [English](README.md) | 简体中文
4
+
5
+ Nexus 是一个透明、async-first 的 coding-agent runtime,提供 CLI adapter、持久化 PostgreSQL
6
+ session/checkpoint、受策略治理的原生与 MCP 工具、有界仓库上下文、经过 Validation 的代码编辑、
7
+ 仓库级/用户级 Skills、安全的结构化 telemetry,以及确定性的 Evaluation harness。LangGraph
8
+ 和具体 provider 均封装在 Nexus 自有边界之后。
9
+
10
+ 此分支用于准备 `Nexus v0.1.0 Release Candidate`,不会创建最终 Git tag;tag 操作仍由
11
+ Product Owner 在审查并 merge 到 `main` 后执行。
12
+
13
+ ## 环境要求
14
+
15
+ - Python 3.12+
16
+ - [uv](https://docs.astral.sh/uv/)
17
+ - Git
18
+ - 安装了 `vector` 扩展的 PostgreSQL 16
19
+ - 用于真实 coding task 的 OpenAI-compatible model deployment
20
+ - 使用仓库内置开发数据库时,需要 Docker 和 Compose
21
+
22
+ ## 安装
23
+
24
+ ```powershell
25
+ uv sync --locked --dev
26
+ docker compose up -d postgres
27
+ uv run alembic upgrade head
28
+ uv run nexus --help
29
+ ```
30
+
31
+ Compose 开发环境的 URL 为
32
+ `postgresql+asyncpg://nexus:nexus@localhost:5432/nexus`。必要时可通过
33
+ `NEXUS_DATABASE_URL` 覆盖。`compose.yaml` 中的凭据仅供开发使用。
34
+
35
+ 请通过环境变量配置 secret,切勿通过 CLI 参数或仓库 TOML 配置:
36
+
37
+ ```powershell
38
+ $env:NEXUS_MODEL_NAME = "your-model"
39
+ $env:NEXUS_MODEL_API_KEY = "your-api-key"
40
+ $env:NEXUS_MODEL_BASE_URL = "https://your-compatible-endpoint.example/v1" # optional
41
+ ```
42
+
43
+ 非敏感的仓库配置可保存在 `.nexus/config.toml`:
44
+
45
+ ```toml
46
+ [model]
47
+ provider = "openai_compatible"
48
+ name = "your-model"
49
+ base_url = "https://your-compatible-endpoint.example/v1"
50
+
51
+ [database]
52
+ url = "postgresql+asyncpg://nexus:nexus@localhost:5432/nexus"
53
+
54
+ [runtime]
55
+ approval_mode = "approval"
56
+ max_steps = 20
57
+ max_repair_attempts = 3
58
+ max_replans = 2
59
+ ```
60
+
61
+ 配置优先级按字段解析:
62
+
63
+ ```text
64
+ CLI > repository TOML > user ~/.nexus/config.toml > NEXUS_* environment > defaults
65
+ ```
66
+
67
+ MCP 进程配置和 LangSmith 配置仅信任用户级 TOML 或已批准的环境变量;API key 只能通过环境变量提供。
68
+
69
+ ## 快速开始
70
+
71
+ 请在允许 Nexus 检查和修改的仓库中运行:
72
+
73
+ ```powershell
74
+ uv run nexus chat "Find the smallest cause of the failing test and fix it."
75
+ ```
76
+
77
+ Nexus 会探索有界上下文、提出 Plan、在需要时请求 approval、依次执行受策略治理的 Tool call、
78
+ 对变更执行 Validation,并呈现最终结果或如实报告失败/达到限制。常用命令如下:
79
+
80
+ ```powershell
81
+ uv run nexus --help
82
+ uv run nexus chat --help
83
+ uv run nexus index --help
84
+ uv run nexus session list --help
85
+ uv run nexus session resume --help
86
+ uv run nexus eval --help
87
+ ```
88
+
89
+ ## 发布文档
90
+
91
+ [Nexus V1 发布指南](docs/nexus-v1-release-guide.md)是权威的 Day 10 指南,其中包含架构概览与
92
+ 架构图、完整的 CLI/配置参考、Validation、Observability 与 Evaluation 流程、标准 FastAPI
93
+ walkthrough、已知限制、V1 后续 roadmap、release checklist,以及 `v0.1.0` release notes。
94
+
95
+ 此外还提供面向具体子系统的 [MCP](docs/mcp-guide.md)、[Skills](docs/skill-guide.md)、
96
+ [Observability](docs/day8-observability-guide.md) 和[架构决策](docs/adr/)指南。
97
+
98
+ ## 开发与发布门禁
99
+
100
+ ```powershell
101
+ uv run ruff check .
102
+ uv run mypy src tests
103
+ uv run pytest --cov=nexus --cov-report=term-missing --cov-report=json:coverage.json
104
+ uv run coverage report --precision=2 --fail-under=70
105
+ uv run coverage report --include="src/nexus/application/runtime.py" --precision=2 --fail-under=80
106
+ uv run coverage report --include="src/nexus/security/*" --precision=2 --fail-under=80
107
+ uv run coverage report --include="src/nexus/application/validation.py" --precision=2 --fail-under=80
108
+ uv lock --check
109
+ uv build
110
+ ```
111
+
112
+ 真实 provider、LangSmith、Evaluation、fresh install、fixture 和真实仓库的结果,与确定性
113
+ regression evidence 分开记录在
114
+ [Day 10 发布证据](docs/day10-release-evidence.md)中。