algocode-agent 0.1.0__tar.gz → 0.1.2__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 (389) hide show
  1. algocode_agent-0.1.2/.codex_scan.py +21 -0
  2. algocode_agent-0.1.2/.github/workflows/deploy-pages.yml +44 -0
  3. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/.gitignore +3 -0
  4. algocode_agent-0.1.2/.trae-html-share-packages/docs/picture/logo-preview.html.zip +0 -0
  5. algocode_agent-0.1.2/PKG-INFO +507 -0
  6. algocode_agent-0.1.2/PROJECT_STRUCTURE.md +596 -0
  7. algocode_agent-0.1.2/README.md +470 -0
  8. algocode_agent-0.1.2/README.zh-CN.md +206 -0
  9. algocode_agent-0.1.2/README_EN.md +644 -0
  10. algocode_agent-0.1.2/docs/acceptance/P0/report.json +142 -0
  11. algocode_agent-0.1.2/docs/acceptance/P0/report.md +57 -0
  12. algocode_agent-0.1.2/docs/acceptance/P0-debug/report.json +100 -0
  13. algocode_agent-0.1.2/docs/acceptance/P0-debug/report.md +27 -0
  14. algocode_agent-0.1.2/docs/acceptance/P1-check/report.json +122 -0
  15. algocode_agent-0.1.2/docs/acceptance/P1-check/report.md +31 -0
  16. algocode_agent-0.1.2/docs/acceptance/P1-final/report.json +164 -0
  17. algocode_agent-0.1.2/docs/acceptance/P1-final/report.md +63 -0
  18. algocode_agent-0.1.2/docs/acceptance/p0-requirements.yaml +220 -0
  19. algocode_agent-0.1.2/docs/changelog/v0.1.0.md +7 -0
  20. algocode_agent-0.1.2/docs/changelog/v0.1.1.md +26 -0
  21. algocode_agent-0.1.2/docs/changelog/v0.1.2.md +26 -0
  22. algocode_agent-0.1.2/docs/commands/index.md +160 -0
  23. algocode_agent-0.1.2/docs/concepts/architecture.md +68 -0
  24. algocode_agent-0.1.2/docs/concepts/candidate-lifecycle.md +37 -0
  25. algocode_agent-0.1.2/docs/concepts/evidence-model.md +41 -0
  26. algocode_agent-0.1.2/docs/concepts/model-providers.md +21 -0
  27. algocode_agent-0.1.2/docs/concepts/policy-approval-sandbox.md +17 -0
  28. algocode_agent-0.1.2/docs/concepts/storage-and-artifacts.md +33 -0
  29. algocode_agent-0.1.2/docs/development/code-structure.md +109 -0
  30. algocode_agent-0.1.2/docs/development/release.md +93 -0
  31. algocode_agent-0.1.2/docs/development/testing.md +78 -0
  32. algocode_agent-0.1.2/docs/getting-started/configuration.md +57 -0
  33. algocode_agent-0.1.2/docs/getting-started/installation.md +76 -0
  34. algocode_agent-0.1.2/docs/getting-started/quickstart.md +55 -0
  35. algocode_agent-0.1.2/docs/getting-started/troubleshooting.md +34 -0
  36. algocode_agent-0.1.2/docs/index.md +17 -0
  37. algocode_agent-0.1.2/docs/javascripts/extra.js +19 -0
  38. algocode_agent-0.1.2/docs/picture/algocode_icon.png +0 -0
  39. algocode_agent-0.1.2/docs/picture/img.png +0 -0
  40. algocode_agent-0.1.2/docs/picture/img_ 5.png +0 -0
  41. algocode_agent-0.1.2/docs/picture/img_1.png +0 -0
  42. algocode_agent-0.1.2/docs/picture/img_2.png +0 -0
  43. algocode_agent-0.1.2/docs/picture/img_3.png +0 -0
  44. algocode_agent-0.1.2/docs/picture/img_4.png +0 -0
  45. algocode_agent-0.1.2/docs/picture/img_5.png +0 -0
  46. algocode_agent-0.1.2/docs/picture/img_6.png +0 -0
  47. algocode_agent-0.1.2/docs/reference/benchmark-spec.md +98 -0
  48. algocode_agent-0.1.2/docs/reference/cli.md +365 -0
  49. algocode_agent-0.1.2/docs/reference/config.md +213 -0
  50. algocode_agent-0.1.2/docs/reference/contract-schema.md +129 -0
  51. algocode_agent-0.1.2/docs/reference/correctness-spec.md +99 -0
  52. algocode_agent-0.1.2/docs/reference/project-layout.md +74 -0
  53. algocode_agent-0.1.2/docs/stylesheets/extra.css +35 -0
  54. algocode_agent-0.1.2/docs/user-guide/quick-workflow.md +48 -0
  55. algocode_agent-0.1.2/docs/user-guide/workflow.md +320 -0
  56. algocode_agent-0.1.2/extensions/vscode/.gitignore +2 -0
  57. algocode_agent-0.1.2/extensions/vscode/.vscode/launch.json +19 -0
  58. algocode_agent-0.1.2/extensions/vscode/.vscode/tasks.json +12 -0
  59. algocode_agent-0.1.2/extensions/vscode/algocode-vscode-0.1.2.vsix +0 -0
  60. algocode_agent-0.1.2/extensions/vscode/package-lock.json +58 -0
  61. algocode_agent-0.1.2/extensions/vscode/package.json +158 -0
  62. algocode_agent-0.1.2/extensions/vscode/src/extension.ts +794 -0
  63. algocode_agent-0.1.2/extensions/vscode/tsconfig.json +14 -0
  64. algocode_agent-0.1.2/mkdocs.yml +92 -0
  65. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/pyproject.toml +3 -0
  66. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/__init__.py +1 -1
  67. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/acceptance/probe.py +61 -1
  68. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/acceptance/service.py +19 -0
  69. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/application/services/__init__.py +6 -0
  70. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/application/services/benchmark_service.py +354 -5
  71. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/application/services/candidate_service.py +36 -1
  72. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/application/services/contract_service.py +183 -0
  73. algocode_agent-0.1.2/src/algocode/application/services/decision_service.py +499 -0
  74. algocode_agent-0.1.2/src/algocode/application/services/experiment_service.py +195 -0
  75. algocode_agent-0.1.2/src/algocode/application/services/maintenance_service.py +160 -0
  76. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/application/services/project_bootstrap_service.py +434 -47
  77. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/application/services/project_state.py +31 -6
  78. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/application/services/report_service.py +118 -3
  79. algocode_agent-0.1.2/src/algocode/application/services/search_archive_service.py +144 -0
  80. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/benchmark/__init__.py +6 -1
  81. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/benchmark/engine.py +103 -74
  82. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/benchmark/spec.py +32 -3
  83. algocode_agent-0.1.2/src/algocode/benchmark/types.py +583 -0
  84. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/bootstrap.py +30 -0
  85. algocode_agent-0.1.2/src/algocode/cli/commands/api.py +626 -0
  86. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/cli/commands/benchmark.py +6 -0
  87. algocode_agent-0.1.2/src/algocode/cli/commands/doctor.py +475 -0
  88. algocode_agent-0.1.2/src/algocode/cli/commands/gc.py +61 -0
  89. algocode_agent-0.1.2/src/algocode/cli/commands/init.py +359 -0
  90. algocode_agent-0.1.2/src/algocode/cli/commands/model.py +187 -0
  91. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/cli/commands/optimize.py +195 -8
  92. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/cli/commands/report.py +1 -0
  93. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/cli/commands/retry.py +9 -1
  94. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/cli/commands/review.py +4 -0
  95. algocode_agent-0.1.2/src/algocode/cli/commands/status.py +324 -0
  96. algocode_agent-0.1.2/src/algocode/cli/commands/vscode.py +112 -0
  97. algocode_agent-0.1.2/src/algocode/cli/live_progress.py +699 -0
  98. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/cli/main.py +4 -0
  99. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/cli/output.py +21 -1
  100. algocode_agent-0.1.2/src/algocode/cli/progress.py +448 -0
  101. algocode_agent-0.1.2/src/algocode/cli/tui.py +99 -0
  102. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/config/model.py +13 -4
  103. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/context/builder.py +17 -6
  104. algocode_agent-0.1.2/src/algocode/context/estimator.py +56 -0
  105. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/domain/events/envelope.py +2 -0
  106. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/domain/model/entities.py +1 -0
  107. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/domain/model/enums.py +1 -0
  108. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/eval/provider.py +42 -0
  109. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/eval/service.py +10 -1
  110. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/languages/cpp.py +17 -2
  111. algocode_agent-0.1.2/src/algocode/profiling/__init__.py +13 -0
  112. algocode_agent-0.1.2/src/algocode/profiling/adapters.py +281 -0
  113. algocode_agent-0.1.2/src/algocode/profiling/service.py +53 -0
  114. algocode_agent-0.1.2/src/algocode/profiling/types.py +72 -0
  115. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/providers/factory.py +11 -9
  116. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/providers/fake.py +42 -0
  117. algocode_agent-0.1.2/src/algocode/providers/model_catalog.py +59 -0
  118. algocode_agent-0.1.2/src/algocode/providers/responses.py +317 -0
  119. algocode_agent-0.1.2/src/algocode/reproducibility.py +23 -0
  120. algocode_agent-0.1.2/src/algocode/resources/vscode/__init__.py +1 -0
  121. algocode_agent-0.1.2/src/algocode/resources/vscode/algocode-vscode-0.1.2.vsix +0 -0
  122. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/runtime/agent.py +640 -75
  123. algocode_agent-0.1.2/src/algocode/runtime/analysis.py +333 -0
  124. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/runtime/planning.py +5 -0
  125. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/sandbox/runner.py +326 -10
  126. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/storage/sqlite/migrations.py +43 -0
  127. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/storage/sqlite/projections/benchmark_projection.py +8 -2
  128. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/storage/sqlite/projections/candidate_projection.py +28 -3
  129. algocode_agent-0.1.2/src/algocode/storage/sqlite/projections/experiment_projection.py +198 -0
  130. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/tools/__init__.py +7 -1
  131. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/tools/builtins/actions.py +20 -3
  132. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/tools/builtins/filesystem.py +38 -1
  133. algocode_agent-0.1.2/src/algocode/tools/builtins/shell.py +111 -0
  134. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/integration/test_acceptance_gate.py +3 -0
  135. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/integration/test_agent_runtime.py +166 -3
  136. algocode_agent-0.1.2/tests/integration/test_agent_runtime_multi_candidate.py +328 -0
  137. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/integration/test_cli_api_model.py +59 -0
  138. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/integration/test_cli_optimize.py +136 -1
  139. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/integration/test_cli_report_apply.py +4 -1
  140. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/integration/test_e2e_full.py +50 -2
  141. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/integration/test_report_apply.py +1 -1
  142. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/integration/test_report_failure_evidence.py +3 -1
  143. algocode_agent-0.1.2/tests/unit/application/test_benchmark_cache.py +116 -0
  144. algocode_agent-0.1.2/tests/unit/application/test_bootstrap_scaling.py +249 -0
  145. algocode_agent-0.1.2/tests/unit/application/test_candidate_reopen.py +108 -0
  146. algocode_agent-0.1.2/tests/unit/application/test_decision_policy.py +133 -0
  147. algocode_agent-0.1.2/tests/unit/application/test_decision_service.py +215 -0
  148. algocode_agent-0.1.2/tests/unit/application/test_experiment_service.py +90 -0
  149. algocode_agent-0.1.2/tests/unit/application/test_maintenance_service.py +103 -0
  150. algocode_agent-0.1.2/tests/unit/application/test_project_state.py +141 -0
  151. algocode_agent-0.1.2/tests/unit/application/test_search_archive_service.py +89 -0
  152. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/benchmark/test_engine.py +35 -1
  153. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/benchmark/test_spec.py +23 -0
  154. algocode_agent-0.1.2/tests/unit/benchmark/test_types.py +180 -0
  155. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/config/test_loader.py +5 -1
  156. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/context/test_builder.py +1 -1
  157. algocode_agent-0.1.2/tests/unit/context/test_estimator.py +24 -0
  158. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/languages/test_adapters.py +5 -1
  159. algocode_agent-0.1.2/tests/unit/profiling/test_adapters.py +57 -0
  160. algocode_agent-0.1.2/tests/unit/providers/test_model_catalog.py +37 -0
  161. algocode_agent-0.1.2/tests/unit/providers/test_responses.py +106 -0
  162. algocode_agent-0.1.2/tests/unit/runtime/test_analysis.py +150 -0
  163. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/runtime/test_contract_service.py +46 -0
  164. algocode_agent-0.1.2/tests/unit/runtime/test_planning.py +90 -0
  165. algocode_agent-0.1.2/tests/unit/runtime/test_refinement.py +199 -0
  166. algocode_agent-0.1.2/tests/unit/runtime/test_search_guards.py +88 -0
  167. algocode_agent-0.1.2/tests/unit/sandbox/test_runner.py +124 -0
  168. algocode_agent-0.1.2/tests/unit/test_api_config.py +165 -0
  169. algocode_agent-0.1.2/tests/unit/test_cli_init_experience.py +96 -0
  170. algocode_agent-0.1.2/tests/unit/test_cli_optimize_progress.py +399 -0
  171. algocode_agent-0.1.2/tests/unit/test_doctor.py +63 -0
  172. algocode_agent-0.1.2/tests/unit/test_progress.py +294 -0
  173. algocode_agent-0.1.2/tests/unit/test_reproducibility.py +26 -0
  174. algocode_agent-0.1.2/tests/unit/test_status_progress.py +93 -0
  175. algocode_agent-0.1.2/tests/unit/test_vscode_command.py +54 -0
  176. algocode_agent-0.1.2/tests/unit/tools/test_read_file_errors.py +59 -0
  177. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/tools/test_registry.py +5 -0
  178. algocode_agent-0.1.2/tests/unit/tools/test_shell.py +67 -0
  179. algocode_agent-0.1.2/website/.gitignore +4 -0
  180. algocode_agent-0.1.2/website/index.html +15 -0
  181. algocode_agent-0.1.2/website/package-lock.json +4453 -0
  182. algocode_agent-0.1.2/website/package.json +1 -0
  183. algocode_agent-0.1.2/website/public/algocode_icon.png +0 -0
  184. algocode_agent-0.1.2/website/src/App.jsx +1063 -0
  185. algocode_agent-0.1.2/website/src/Docs.jsx +596 -0
  186. algocode_agent-0.1.2/website/src/docs.css +673 -0
  187. algocode_agent-0.1.2/website/src/index.css +1613 -0
  188. algocode_agent-0.1.2/website/src/main.jsx +10 -0
  189. algocode_agent-0.1.2/website/vite.config.js +16 -0
  190. algocode_agent-0.1.0/PKG-INFO +0 -678
  191. algocode_agent-0.1.0/README.md +0 -643
  192. algocode_agent-0.1.0/create_outline_icon.py +0 -227
  193. algocode_agent-0.1.0/mian.py +0 -0
  194. algocode_agent-0.1.0/process_icon.py +0 -75
  195. algocode_agent-0.1.0/src/algocode/application/services/decision_service.py +0 -228
  196. algocode_agent-0.1.0/src/algocode/benchmark/types.py +0 -128
  197. algocode_agent-0.1.0/src/algocode/cli/commands/api.py +0 -220
  198. algocode_agent-0.1.0/src/algocode/cli/commands/doctor.py +0 -149
  199. algocode_agent-0.1.0/src/algocode/cli/commands/init.py +0 -133
  200. algocode_agent-0.1.0/src/algocode/cli/commands/model.py +0 -115
  201. algocode_agent-0.1.0/src/algocode/cli/commands/status.py +0 -136
  202. algocode_agent-0.1.0/src/algocode/context/estimator.py +0 -25
  203. algocode_agent-0.1.0/src/algocode/runtime/analysis.py +0 -187
  204. algocode_agent-0.1.0/tests/unit/application/test_decision_policy.py +0 -62
  205. algocode_agent-0.1.0/tests/unit/runtime/test_analysis.py +0 -56
  206. algocode_agent-0.1.0/tests/unit/runtime/test_planning.py +0 -69
  207. algocode_agent-0.1.0/tests/unit/sandbox/test_runner.py +0 -69
  208. algocode_agent-0.1.0/tests/unit/test_doctor.py +0 -32
  209. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/.github/workflows/publish.yml +0 -0
  210. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/.github/workflows/python-publish.yml +0 -0
  211. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/LICENSE +0 -0
  212. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/docker/sandbox.Dockerfile +0 -0
  213. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/docs/picture/algocode_icon.jpg +0 -0
  214. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/__main__.py +0 -0
  215. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/acceptance/__init__.py +0 -0
  216. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/acceptance/matrix.py +0 -0
  217. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/acceptance/types.py +0 -0
  218. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/application/__init__.py +0 -0
  219. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/application/services/apply_service.py +0 -0
  220. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/application/services/baseline_service.py +0 -0
  221. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/application/services/correctness_service.py +0 -0
  222. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/application/services/project_service.py +0 -0
  223. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/application/services/task_service.py +0 -0
  224. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/approval/service.py +0 -0
  225. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/approval/types.py +0 -0
  226. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/benchmark/environment.py +0 -0
  227. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/cli/__init__.py +0 -0
  228. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/cli/commands/__init__.py +0 -0
  229. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/cli/commands/accept.py +0 -0
  230. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/cli/commands/apply.py +0 -0
  231. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/cli/commands/baseline.py +0 -0
  232. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/cli/commands/candidate.py +0 -0
  233. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/cli/commands/correctness.py +0 -0
  234. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/cli/commands/diff.py +0 -0
  235. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/cli/commands/eval.py +0 -0
  236. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/cli/commands/experiment.py +0 -0
  237. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/cli/commands/gate.py +0 -0
  238. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/cli/commands/provider_test.py +0 -0
  239. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/cli/commands/task.py +0 -0
  240. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/cli/context.py +0 -0
  241. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/config/__init__.py +0 -0
  242. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/config/global_file.py +0 -0
  243. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/config/loader.py +0 -0
  244. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/context/__init__.py +0 -0
  245. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/context/facts.py +0 -0
  246. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/context/types.py +0 -0
  247. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/correctness/__init__.py +0 -0
  248. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/correctness/engine.py +0 -0
  249. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/correctness/protected.py +0 -0
  250. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/correctness/spec.py +0 -0
  251. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/correctness/types.py +0 -0
  252. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/domain/__init__.py +0 -0
  253. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/domain/commands/__init__.py +0 -0
  254. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/domain/errors/__init__.py +0 -0
  255. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/domain/events/__init__.py +0 -0
  256. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/domain/model/__init__.py +0 -0
  257. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/domain/model/ids.py +0 -0
  258. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/domain/model/values.py +0 -0
  259. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/eval/__init__.py +0 -0
  260. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/eval/harness.py +0 -0
  261. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/eval/suites.py +0 -0
  262. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/eval/types.py +0 -0
  263. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/languages/__init__.py +0 -0
  264. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/languages/discovery.py +0 -0
  265. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/languages/python.py +0 -0
  266. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/languages/registry.py +0 -0
  267. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/languages/runner.py +0 -0
  268. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/languages/types.py +0 -0
  269. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/observability/__init__.py +0 -0
  270. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/policy/__init__.py +0 -0
  271. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/policy/engine.py +0 -0
  272. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/policy/types.py +0 -0
  273. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/ports/__init__.py +0 -0
  274. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/ports/artifact_store.py +0 -0
  275. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/ports/clock.py +0 -0
  276. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/ports/event_store.py +0 -0
  277. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/ports/language.py +0 -0
  278. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/ports/policy.py +0 -0
  279. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/ports/provider.py +0 -0
  280. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/ports/resource.py +0 -0
  281. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/ports/workspace.py +0 -0
  282. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/project_layout.py +0 -0
  283. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/providers/__init__.py +0 -0
  284. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/providers/anthropic.py +0 -0
  285. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/providers/errors.py +0 -0
  286. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/providers/openai_compatible.py +0 -0
  287. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/providers/types.py +0 -0
  288. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/report/__init__.py +0 -0
  289. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/resources/__init__.py +0 -0
  290. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/resources/local.py +0 -0
  291. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/resources/types.py +0 -0
  292. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/runtime/__init__.py +0 -0
  293. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/runtime/gates.py +0 -0
  294. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/runtime/locks.py +0 -0
  295. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/runtime/model_log.py +0 -0
  296. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/runtime/optimization_record.py +0 -0
  297. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/runtime/repair_memory.py +0 -0
  298. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/runtime/task_lock.py +0 -0
  299. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/sandbox/local.py +0 -0
  300. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/security/__init__.py +0 -0
  301. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/security/credentials.py +0 -0
  302. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/security/redaction.py +0 -0
  303. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/storage/__init__.py +0 -0
  304. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/storage/artifacts/__init__.py +0 -0
  305. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/storage/artifacts/file_artifact_store.py +0 -0
  306. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/storage/events/__init__.py +0 -0
  307. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/storage/events/sqlite_event_store.py +0 -0
  308. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/storage/paths.py +0 -0
  309. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/storage/sqlite/__init__.py +0 -0
  310. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/storage/sqlite/approval_store.py +0 -0
  311. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/storage/sqlite/database.py +0 -0
  312. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/storage/sqlite/projections/__init__.py +0 -0
  313. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/storage/sqlite/projections/baseline_projection.py +0 -0
  314. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/storage/sqlite/projections/correctness_projection.py +0 -0
  315. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/storage/sqlite/projections/decision_projection.py +0 -0
  316. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/storage/sqlite/projections/project_projection.py +0 -0
  317. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/storage/sqlite/projections/task_projection.py +0 -0
  318. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/structured_output.py +0 -0
  319. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/tools/builtins/__init__.py +0 -0
  320. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/tools/registry.py +0 -0
  321. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/tools/types.py +0 -0
  322. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/workspace/__init__.py +0 -0
  323. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/workspace/git.py +0 -0
  324. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/src/algocode/workspace/types.py +0 -0
  325. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/__init__.py +0 -0
  326. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/contract/__init__.py +0 -0
  327. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/contract/test_artifact_store.py +0 -0
  328. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/contract/test_event_store.py +0 -0
  329. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/integration/__init__.py +0 -0
  330. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/integration/test_baseline_service.py +0 -0
  331. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/integration/test_benchmark_service.py +0 -0
  332. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/integration/test_cli_benchmark.py +0 -0
  333. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/integration/test_cli_contract.py +0 -0
  334. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/integration/test_cli_doctor.py +0 -0
  335. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/integration/test_cli_eval.py +0 -0
  336. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/integration/test_cli_experiment.py +0 -0
  337. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/integration/test_cli_init_baseline.py +0 -0
  338. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/integration/test_cli_task.py +0 -0
  339. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/integration/test_correctness_service.py +0 -0
  340. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/integration/test_docker_sandbox.py +0 -0
  341. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/integration/test_eval_service.py +0 -0
  342. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/integration/test_git_workspace.py +0 -0
  343. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/integration/test_project_bootstrap.py +0 -0
  344. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/integration/test_secret_redaction.py +0 -0
  345. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/integration/test_tool_actions.py +0 -0
  346. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/integration/test_tool_security.py +0 -0
  347. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/support/__init__.py +0 -0
  348. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/support/git.py +0 -0
  349. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/support/mock_openai.py +0 -0
  350. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/__init__.py +0 -0
  351. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/acceptance/__init__.py +0 -0
  352. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/acceptance/test_matrix.py +0 -0
  353. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/application/__init__.py +0 -0
  354. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/approval/__init__.py +0 -0
  355. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/approval/test_service.py +0 -0
  356. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/benchmark/__init__.py +0 -0
  357. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/benchmark/test_environment.py +0 -0
  358. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/benchmark/test_locks.py +0 -0
  359. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/config/__init__.py +0 -0
  360. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/context/__init__.py +0 -0
  361. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/correctness/__init__.py +0 -0
  362. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/correctness/test_engine.py +0 -0
  363. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/correctness/test_protected.py +0 -0
  364. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/correctness/test_spec.py +0 -0
  365. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/domain/__init__.py +0 -0
  366. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/domain/test_ids.py +0 -0
  367. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/domain/test_models.py +0 -0
  368. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/languages/__init__.py +0 -0
  369. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/policy/__init__.py +0 -0
  370. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/policy/test_engine.py +0 -0
  371. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/providers/__init__.py +0 -0
  372. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/providers/test_anthropic.py +0 -0
  373. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/providers/test_fake.py +0 -0
  374. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/providers/test_openai_compatible.py +0 -0
  375. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/resources/__init__.py +0 -0
  376. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/resources/test_local.py +0 -0
  377. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/runtime/__init__.py +0 -0
  378. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/runtime/test_gates.py +0 -0
  379. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/runtime/test_model_log.py +0 -0
  380. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/runtime/test_optimization_record.py +0 -0
  381. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/runtime/test_structured_output.py +0 -0
  382. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/runtime/test_task_lock.py +0 -0
  383. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/sandbox/__init__.py +0 -0
  384. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/sandbox/test_local.py +0 -0
  385. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/security/test_credentials.py +0 -0
  386. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/test_paths.py +0 -0
  387. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/test_project_service.py +0 -0
  388. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/test_task_service.py +0 -0
  389. {algocode_agent-0.1.0 → algocode_agent-0.1.2}/tests/unit/tools/__init__.py +0 -0
@@ -0,0 +1,21 @@
1
+ import pathlib
2
+ from datetime import datetime, timedelta
3
+
4
+ today = datetime.now().date()
5
+ rows = []
6
+ for base in ("src", "tests", "docs", "website", "extensions"):
7
+ root = pathlib.Path(base)
8
+ if not root.exists():
9
+ continue
10
+ for p in root.rglob("*"):
11
+ if not p.is_file():
12
+ continue
13
+ if ".git" in p.parts or "node_modules" in p.parts:
14
+ continue
15
+ m = datetime.fromtimestamp(p.stat().st_mtime)
16
+ if m.date() == today:
17
+ rows.append((m.strftime("%H:%M"), str(p)))
18
+ rows.sort()
19
+ print(f"files touched today: {len(rows)}")
20
+ for t, p in rows:
21
+ print(t, p)
@@ -0,0 +1,44 @@
1
+ name: Deploy Pages
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: write
11
+
12
+ concurrency:
13
+ group: pages
14
+ cancel-in-progress: true
15
+
16
+ jobs:
17
+ deploy:
18
+ name: Build website and docs
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - name: Check out repository
22
+ uses: actions/checkout@v4
23
+
24
+ - name: Set up Node
25
+ uses: actions/setup-node@v4
26
+ with:
27
+ node-version: 20
28
+ cache: npm
29
+ cache-dependency-path: website/package-lock.json
30
+
31
+ - name: Build website
32
+ working-directory: website
33
+ run: |
34
+ npm ci
35
+ npm run build
36
+
37
+ - name: Deploy to GitHub Pages
38
+ uses: peaceiris/actions-gh-pages@v4
39
+ with:
40
+ github_token: ${{ secrets.GITHUB_TOKEN }}
41
+ publish_dir: ./website/dist
42
+ publish_branch: gh-pages
43
+ cname: algocode.chat
44
+ force_orphan: true
@@ -13,3 +13,6 @@ build/
13
13
  dist/
14
14
  dist-check/
15
15
  .algocode/
16
+ site/
17
+ .playwright-cli/
18
+ output/
@@ -0,0 +1,507 @@
1
+ Metadata-Version: 2.4
2
+ Name: algocode-agent
3
+ Version: 0.1.2
4
+ Summary: A reproducible algorithm optimization agent for C++ and Python
5
+ Project-URL: Homepage, https://github.com/acd2113/Algocode
6
+ Project-URL: Repository, https://github.com/acd2113/Algocode
7
+ Project-URL: Issues, https://github.com/acd2113/Algocode/issues
8
+ Author: acd2113
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: agent,algorithm,benchmark,cpp,optimization,python
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Software Development :: Quality Assurance
21
+ Requires-Python: >=3.11
22
+ Requires-Dist: httpx<1,>=0.27
23
+ Requires-Dist: pydantic<3,>=2.12
24
+ Requires-Dist: pyyaml<7,>=6
25
+ Requires-Dist: questionary<3,>=2
26
+ Requires-Dist: tiktoken<1,>=0.7
27
+ Requires-Dist: typer<1,>=0.12
28
+ Provides-Extra: build
29
+ Requires-Dist: build<2,>=1.2; extra == 'build'
30
+ Requires-Dist: twine<7,>=6; extra == 'build'
31
+ Provides-Extra: dev
32
+ Requires-Dist: pytest<10,>=8; extra == 'dev'
33
+ Requires-Dist: ruff<1,>=0.9; extra == 'dev'
34
+ Provides-Extra: docs
35
+ Requires-Dist: markitdown; extra == 'docs'
36
+ Description-Content-Type: text/markdown
37
+
38
+ <div align="center">
39
+
40
+ <img src="docs/picture/algocode_icon.png" alt="Algocode" width="120">
41
+
42
+ # Algocode
43
+
44
+ > *面向 C++ / Python 的可验证算法优化 Agent — 本地优先,证据驱动,可回滚。*
45
+
46
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
47
+ [![Python 3.11+](https://img.shields.io/badge/Python-3.11+-blue.svg)](https://www.python.org/)
48
+ [![PyPI](https://img.shields.io/pypi/v/algocode-agent.svg)](https://pypi.org/project/algocode-agent/)
49
+ [![VS Code](https://img.shields.io/badge/VS%20Code-1.90%2B-007ACC?logo=visualstudiocode)](https://code.visualstudio.com/)
50
+ [![OpenAI Compatible](https://img.shields.io/badge/API-OpenAI_Compatible-green)](https://platform.openai.com/)
51
+
52
+ **Algocode 不是直接替你改代码的黑盒。**
53
+
54
+ 它会先建立行为契约,再在隔离 Worktree 中尝试优化,最后用 Correctness、Contract 和 Benchmark 三类证据决定候选是否值得应用。
55
+
56
+ [English](README_EN.md) · [使用守则](#使用守则优化前必看) · [快速开始](#快速开始) · [VS Code](#vs-code-扩展) · [工作流](#优化工作流) · [命令速查](#cli-命令速查)
57
+
58
+
59
+ </div>
60
+
61
+ ---
62
+
63
+ ## Algocode 是什么
64
+
65
+ Algocode 是一款面向 C++ / Python 的可验证算法优化 Agent CLI 工具。它通过契约、正确性和性能证据驱动代码优化,只需配置一个模型端点即可使用。
66
+ 它读取 Git 仓库和项目入口,通过具备工具调用能力的 Agent 分析算法热点、问题结构和复杂度,并在隔离的 Git Worktree 中生成候选实现。Agent 可以读取完整文件、搜索代码库、检查其他文件、运行构建与正确性测试、执行 Benchmark,从而进行算法级优化,而不是仅停留在表面的代码改写。
67
+ Algocode 不会直接修改用户项目。每个候选都必须通过 Correctness、Contract 和 Benchmark 验证,用户可以查看结构化的证据链、Diff、置信区间和决策结果,再显式执行 accept 和 apply。应用后如果发现问题,还可以通过 rollback 回滚。
68
+ 除了单次优化,Algocode 支持多候选搜索:当一个方向有显著正向前景但尚未满足接受条件时,会继续细化同一候选;当方向没有可测收益时,则创建新候选继续搜索。它同时提供 CLI 和 VS Code 扩展入口,适合算法竞赛代码、数据结构、图算法、字符串算法、缓存和解析器等行为可验证的程序。
69
+
70
+ ## 为什么选择 Algocode?
71
+ ### 通用 Agent 做算法优化的局限
72
+ - **只能改代码,不能证明正确性** ——模型可能改变边界条件、错误语义、返回顺序或状态转换,而这些变化不一定能被普通测试发现。
73
+ - **容易只做局部优化** ——通用 Agent 倾向于修改循环、变量和调用方式,不容易主动重新分析问题结构,寻找真正的算法级改进。
74
+ - **性能结果缺少可信依据** ——单次 time 或一次 Benchmark 很容易受到系统负载、缓存、解释器启动和环境变化影响。
75
+ - **长任务容易偏离原始目标** ——随着上下文增长,模型可能逐渐忽略行为契约、保护文件和验证约束。
76
+ - **缺少稳定的候选生命周期** ——没有隔离候选、证据门控和回滚机制时,失败尝试很难安全地继续下去。
77
+ - **难以比较不同方向** ——如果多个优化方案只存在于对话和临时命令中,就无法系统地比较性能、正确性和风险。
78
+ - **过程难以审计和复现** ——为什么接受、为什么拒绝、测试和 Benchmark 具体运行了什么,往往没有完整记录。
79
+ - **质量过度依赖模型和提示词** ——换一个模型或修改一段提示词,优化结果可能明显波动。
80
+ ### Algocode 能做的
81
+ - **建立行为契约** ——在优化前明确公开 API、输入输出、错误行为、状态转换、排序和边界条件。
82
+ - **隔离每次优化** ——在独立 Git Worktree 中创建候选,验证通过前不会修改用户项目。
83
+ - **进行算法级分析** ——分析问题结构、输入分布、操作代数和复杂度差距,并提出多个候选算法方向。
84
+ - **验证行为一致性** ——通过 Correctness、Contract 和参考实现交叉验证,确保候选没有破坏原有行为。
85
+ - **提供可信 Benchmark** ——使用 warmup、重复采样、交错运行、多规模输入和固定 harness,减少环境噪声。
86
+ - **判断提升是否真实** ——通过配对置换检验、bootstrap 置信区间和 MAD 鲁棒波动,区分真实收益与随机波动。
87
+ - **识别算法级改进** ——分析运行时间随输入规模的增长趋势,识别复杂度下降,而不只看固定输入的百分比。
88
+ - **细化有前景的候选** ——方向正确但收益不足时,重新打开同一候选继续优化。
89
+ - **继续搜索其他方向** ——当前方向没有可测收益时,基于历史记录创建新候选,而不是重复同一种失败方案。
90
+ - **约束 Agent 行为** ——阶段只暴露允许使用的工具,并持续告知剩余模型轮次、剩余工具调用数和候选自检要求。
91
+ - **保留人工控制** ——候选经过 Review 和 Diff 后,由用户显式执行 accept 和 apply。
92
+ - **支持安全回滚** ——应用后发现问题,可以执行 rollback 恢复原工作区。
93
+ - **保持模型可替换** ——支持不同模型 Provider,同时复用相同的契约、验证、Benchmark 和候选生命周期。
94
+ - **留下完整证据链** ——Contract、Correctness、Benchmark、Decision、Report、模型日志和候选记录都会持久化,便于审计和复现。
95
+
96
+ ## 性能与结果声明
97
+
98
+ Algocode 通过大模型分析源代码并生成候选优化。优化后的性能可能提升、没有明显变化,甚至下降;结果会受到源代码质量、项目结构、模型能力、输入规模、运行环境和系统负载等因素影响。
99
+
100
+ Algocode 不承诺每次优化都带来正收益,也不替代人工代码审查。请以实际的 Correctness、Contract、Benchmark、Diff 和 Review 结果为准,在确认行为正确且收益满足预期后再 Apply。
101
+
102
+
103
+ ## Algocode 如何保证正确性?
104
+ Algocode 不依赖模型自我评价,而是通过行为契约、基线冻结、Correctness、Contract Test 和参考实现交叉验证共同保证候选正确性。
105
+ - **契约先行** ——优化前明确公开 API、输入输出、错误行为、状态转换、排序和边界条件,禁止通过删除检查或修改测试获得性能提升。
106
+ - **基线冻结** ——保存原始源码快照、环境 Hash、基线输出和基线性能,所有候选必须与同一个基线比较。
107
+ - **多层验证** ——通过固定用例、参考实现、压力测试和确定性检查,验证输出、退出码、异常、API 返回和状态变化。
108
+ - **参考交叉** ——在保护目录中保存未修改的参考实现,候选必须在边界输入和小规模输入上与其行为一致。
109
+ - **阶段门禁** ——候选只有通过 Build、Correctness 和 Contract Test,才能进入 Benchmark;Apply 前还会检查 Decision、stale 状态和 Rollback Manifest。
110
+ - **人工确认** ——自动验证通过后,仍需用户查看 Diff、Review 和证据,显式执行 accept 和 apply。
111
+
112
+
113
+ ## 如何使用
114
+
115
+ ### 环境与依赖
116
+
117
+ #### 系统要求
118
+
119
+ | 依赖 | 最低版本 | 说明 |
120
+ |---|---|---|
121
+ | Python(必需) | 3.11+ | 运行环境 |
122
+ | Git(必需) | — | Worktree 隔离与版本管理 |
123
+ | C++ 编译器 | — | 优化 C++ 项目时需要,支持 `g++` 或 `clang++` |
124
+
125
+ 可选增强:
126
+ - **Docker / WSL2** — 用于更强的沙箱隔离,非强制要求。
127
+ - **VS Code** — 用于右键菜单、实时阶段进度、Diff、Apply 和 Rollback。
128
+
129
+
130
+ ### CLI
131
+
132
+ #### 安装
133
+ ```bash
134
+ pip install algocode-agent
135
+ ```
136
+
137
+ 扩展命令会自动查找本机的 `code`、`code-insiders` 或 `codium`。
138
+
139
+ 安装后,`algocode` 命令即可全局使用。
140
+
141
+ #### 快速使用
142
+
143
+ **配置模型**
144
+
145
+ ```bash
146
+ algocode api
147
+ algocode test
148
+ ```
149
+ ![img.png](docs/picture/img_ 5.png)
150
+ `algocode api` 用于选择模型厂商、Base URL、模型 ID 和 API Key。API Key 保存在本机凭证文件中,不会写入项目配置。
151
+
152
+ 切换默认模型:
153
+
154
+ ```bash
155
+ algocode model
156
+ ```
157
+ ### 环境检查
158
+
159
+ ```bash
160
+ algocode doctor
161
+ ```
162
+ ![img_5.png](docs/picture/img_5.png)
163
+ 查看是否满足条件,建议优先运行
164
+
165
+ ### 运行第一次优化
166
+
167
+ 在项目目录中执行:
168
+
169
+ ```bash
170
+ algocode init
171
+ algocode optimize
172
+ ```
173
+
174
+ 查看状态、证据和 Diff:
175
+
176
+ ```bash
177
+ algocode status
178
+ algocode review
179
+ algocode diff
180
+ ```
181
+
182
+ 应用或回滚:
183
+
184
+ ```bash
185
+ algocode apply
186
+ algocode rollback
187
+ ```
188
+
189
+ ---
190
+
191
+ ### VS Code 扩展
192
+
193
+ #### 安装
194
+ 也要先用cli安装
195
+ ```bash
196
+ pip install algocode-agent
197
+ ```
198
+
199
+ 安装扩展:
200
+ ```bash
201
+ algocode vscode install
202
+ ```
203
+
204
+ #### 使用
205
+ **配置模型** ——[同上](#快速使用)
206
+ 右键 `.py`、`.cpp`、`.cc`、`.cxx` 文件,选择:
207
+ ![img_6.png](docs/picture/img_6.png)
208
+
209
+ 各操作含义:
210
+
211
+ | 操作 | 说明 |
212
+ |---|---|
213
+ | 优化 Optimize | 启动完整优化流程,并在临时影子工作区中运行 |
214
+ | 回滚 Rollback | 撤销最近一次通过扩展应用的候选 |
215
+ | 应用 Apply | 将最近一次候选应用到原项目 |
216
+ | 差异 Show Diff | 打开 VS Code 原生 Diff |
217
+ | 检查 Review | 查看 Candidate、Correctness、Benchmark、Decision 和变更文件 |
218
+
219
+ 扩展运行时会自动打开 `Algocode` 终端,并实时显示:
220
+
221
+ ```text
222
+ [algocode] analyze | 1/10 | turn 2 | running read_file (3s) | tools 4 | 18s
223
+ [algocode] implement | 5/10 | turn 8 | running run_candidate_check (7s) | tools 14 | 47s
224
+ [algocode] benchmark | 7/10 | running benchmark | 21s
225
+ ```
226
+
227
+ ---
228
+
229
+ ## CLI 命令速查
230
+
231
+ ```bash
232
+ $ algocode --help
233
+ ```
234
+
235
+ | 命令 | 说明 |
236
+ |---|-------------------------|
237
+ | `algocode api` | 配置模型 Provider 和 API Key |
238
+ | `algocode test` | 验证模型连接 |
239
+ | `algocode model` | 切换默认模型 |
240
+ | `algocode doctor` | 检查本地环境 |
241
+ | `algocode init` | 初始化项目、生成契约、建立基线 |
242
+ | `algocode optimize` | 运行完整优化流程 |
243
+ | `algocode retry` | 基于历史记录重新规划 |
244
+ | `algocode status` | 查看当前任务、阶段与进度 |
245
+ | `algocode review` | 查看正确性、Benchmark 和决策证据 |
246
+ | `algocode diff` | 查看候选代码变更 |
247
+ | `algocode apply` | 接收并应用候选 |
248
+ | `algocode rollback` | 回滚已应用候选 |
249
+ | `algocode report` | 生成 Markdown 报告 |
250
+ | `algocode vscode install` | 安装包内携带的 VS Code 扩展 |
251
+
252
+ 大多数命令支持 `--json`:
253
+
254
+ ```bash
255
+ algocode status --json
256
+ algocode review --json
257
+ algocode optimize --json
258
+ ```
259
+
260
+ ---
261
+
262
+ ## 优化工作流
263
+
264
+ 阶段之间存在 Gate:
265
+
266
+ - Contract 或 Correctness 未通过,不进入 Benchmark。
267
+ - Benchmark 无效或无正收益,不进入接受流程。
268
+ - Apply 前会检查候选是否 stale。
269
+ - Rollback 用于撤销已应用候选。
270
+
271
+ ---
272
+
273
+ ## 验证体系
274
+
275
+ Algocode 将优化结果拆成三类证据:
276
+
277
+ | 类型 | 作用 |
278
+ |---|---|
279
+ | **Correctness** | 验证候选是否复现基线行为,支持 cases、oracle、stress、hybrid 等模式 |
280
+ | **Contract** | 保护公开 API、配置语义、错误类型、状态转换、排序和边界行为 |
281
+ | **Benchmark** | 受控测量 warmup、重复样本、median、variation、环境 hash 等 |
282
+
283
+ 优化速度和正确性发生冲突时,正确性优先。
284
+
285
+ ---
286
+
287
+ ## 架构
288
+
289
+ ```text
290
+ CLI / VS Code
291
+ ↓
292
+ Application Services
293
+ ↓
294
+ Runtime Agent
295
+ ↓
296
+ Context / Tools / Providers
297
+ ↓
298
+ Language Adapters
299
+ ↓
300
+ Git Worktree / Sandbox
301
+ ↓
302
+ Storage / Event Store / Artifacts
303
+ ```
304
+
305
+ ---
306
+
307
+ ## 项目结构
308
+
309
+ 完整源码、测试与运行时目录结构见 [PROJECT_STRUCTURE.md](PROJECT_STRUCTURE.md)。
310
+
311
+ ### 源码结构
312
+
313
+ ```text
314
+ src/algocode/
315
+ ├── cli/ # CLI 命令入口与输出
316
+ ├── application/ # Task、Candidate、Baseline、Benchmark 等服务
317
+ ├── domain/ # 实体、值对象、事件
318
+ ├── runtime/ # 阶段机、Tool Loop、Retry、模型调用日志
319
+ ├── config/ # 配置加载与模型
320
+ ├── context/ # 上下文构建、事实账本与预算
321
+ ├── tools/ # 文件、进程、校验等工具
322
+ ├── policy/ # 策略引擎
323
+ ├── approval/ # 审批服务
324
+ ├── sandbox/ # Native / Docker / WSL2 执行后端
325
+ ├── security/ # 凭证与脱敏
326
+ ├── providers/ # 模型 Provider 适配
327
+ ├── languages/ # Python / C++ 语言适配
328
+ ├── correctness/ # Correctness 验证
329
+ ├── benchmark/ # Benchmark 引擎
330
+ ├── profiling/ # 性能分析适配
331
+ ├── workspace/ # Git Worktree、Apply、Rollback
332
+ ├── storage/ # SQLite Event Store、Projection、Artifact
333
+ └── resources/ # 资源与内置 VS Code 扩展
334
+ ```
335
+
336
+ ### 项目内 .algocode
337
+
338
+ 执行 `init` 后,项目根目录生成:
339
+
340
+ ```text
341
+ .algocode/
342
+ ├── config.yaml # 项目配置
343
+ ├── config.local.yaml # 本地覆盖(可选)
344
+ ├── contract.json # 行为契约
345
+ ├── task.txt # 当前任务摘要
346
+ ├── current-task.json # 当前任务状态
347
+ ├── oracle/ # Correctness 与 Contract Test
348
+ │ ├── check.py
349
+ │ ├── correctness.yaml
350
+ │ ├── contract_test.py
351
+ │ ├── contract_test.cpp
352
+ │ └── reference/
353
+ ├── benchmarks/
354
+ │ └── benchmark.yaml
355
+ └── cache/
356
+ ├── algocode.db # Event Store 与 Projection
357
+ ├── artifacts/
358
+ ├── model-logs/
359
+ ├── optimization-records/
360
+ ├── worktrees/
361
+ ├── repair-memory/
362
+ └── rollbacks/
363
+ ```
364
+
365
+ ---
366
+
367
+ ## 配置与数据
368
+
369
+ ### Provider
370
+
371
+ 支持:
372
+
373
+ ```text
374
+ OpenAI
375
+ DeepSeek
376
+ OpenRouter
377
+ Kimi
378
+ 智谱 GLM
379
+ MiniMax
380
+ Anthropic Claude
381
+ 火山引擎豆包
382
+ 通义千问 Qwen
383
+ 自定义 OpenAI-compatible
384
+ 本地 Ollama / vLLM
385
+ ```
386
+
387
+ ### 报告
388
+
389
+ ```bash
390
+ algocode report
391
+ ```
392
+
393
+ 会在项目根目录生成:
394
+
395
+ ```text
396
+ report.md
397
+ ```
398
+
399
+ 同时在 `.algocode/cache/artifacts` 中保留内部产物。
400
+
401
+ ---
402
+
403
+ ## 安全与数据
404
+
405
+ - Algocode 默认在本机运行。
406
+ - API Key 保存在本机凭证文件中,不写入项目配置。
407
+ - 模型调用日志会经过脱敏后写入 `.algocode/cache/model-logs`。
408
+ - Contract、Correctness、Benchmark 和 Oracle 文件属于保护文件。
409
+ - Docker / WSL2 是可选隔离增强。
410
+ - 不建议在包含敏感数据、生产密钥或不可信代码的目录中直接运行。
411
+
412
+ ---
413
+
414
+ ## 开发
415
+
416
+ ```bash
417
+ git clone https://github.com/acd2113/Algocode.git
418
+ cd Algocode
419
+ python -m venv .venv
420
+ .venv/bin/python -m pip install -e ".[dev]"
421
+ .venv/bin/python -m pytest
422
+ .venv/bin/python -m ruff check .
423
+ ```
424
+
425
+ VS Code 扩展开发:
426
+
427
+ ```bash
428
+ cd extensions/vscode
429
+ npm install
430
+ npm run compile
431
+ ```
432
+
433
+ 开发调试:
434
+
435
+ ```text
436
+ 按 F5 -> Run Algocode Extension
437
+ ```
438
+
439
+ 开发完成后可打包:
440
+
441
+ ```bash
442
+ npx --yes @vscode/vsce package
443
+ ```
444
+
445
+ ---
446
+
447
+ ## 发布
448
+
449
+ Python 包发布由 GitHub Actions 完成。
450
+
451
+ 发布流程:
452
+
453
+ ```bash
454
+ git tag v0.1.2
455
+ git push origin v0.1.2
456
+ ```
457
+
458
+ 工作流会构建并发布:
459
+
460
+ ```text
461
+ algocode_agent-0.1.2.tar.gz
462
+ algocode_agent-0.1.2-py3-none-any.whl
463
+ ```
464
+
465
+ 完整变更见 [`docs/changelog/v0.1.2.md`](docs/changelog/v0.1.2.md)。
466
+
467
+ 允许用户安装:
468
+
469
+ ```bash
470
+ python -m pip install algocode-agent
471
+ algocode vscode install
472
+ ```
473
+
474
+ ---
475
+
476
+ ## 贡献
477
+
478
+ 欢迎提交 Issue 和 Pull Request。
479
+
480
+ 提交 Issue 时建议提供:
481
+
482
+ - 操作系统与 Python 版本
483
+ - Algocode 版本
484
+ - 复现步骤
485
+ - 期望行为与实际行为
486
+ - 相关日志或截图
487
+
488
+ 提交代码前建议运行:
489
+
490
+ ```bash
491
+ python -m pytest
492
+ python -m ruff check .
493
+ ```
494
+
495
+ ---
496
+
497
+ ## 许可证
498
+
499
+ 本项目使用 [MIT License](LICENSE)。
500
+
501
+ ---
502
+
503
+ <div align="center">
504
+
505
+ > **Algocode** — 让每一次算法优化都有证据。
506
+
507
+ </div>