abyss-cli 2.0.3__tar.gz → 2.0.4__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 (196) hide show
  1. abyss_cli-2.0.4/PKG-INFO +165 -0
  2. abyss_cli-2.0.4/README.md +144 -0
  3. abyss_cli-2.0.4/pyproject.toml +91 -0
  4. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/__init__.py +1 -1
  5. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/_globals.py +65 -65
  6. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/agent_loop.py +581 -526
  7. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/ansi_menu.py +2394 -2180
  8. abyss_cli-2.0.4/src/abyss/api_client.py +1033 -0
  9. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/commands/ai_analysis.py +194 -194
  10. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/commands/compact.py +59 -42
  11. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/commands/cron.py +162 -162
  12. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/commands/diff.py +134 -134
  13. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/commands/git.py +185 -183
  14. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/commands/info.py +246 -246
  15. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/commands/knowledge.py +211 -211
  16. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/commands/logs.py +272 -272
  17. abyss_cli-2.0.4/src/abyss/commands/plan.py +210 -0
  18. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/commands/retry.py +82 -82
  19. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/commands/undo.py +102 -102
  20. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/concurrency/__init__.py +15 -15
  21. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/concurrency/abort.py +225 -225
  22. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/config/__init__.py +22 -22
  23. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/config/legacy.py +189 -164
  24. abyss_cli-2.0.4/src/abyss/constants.py +10 -0
  25. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/context/__init__.py +2 -2
  26. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/context/attachment_resolver.py +259 -211
  27. abyss_cli-2.0.4/src/abyss/context/image_input.py +169 -0
  28. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/context/project_context.py +438 -434
  29. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/context/snip.py +98 -98
  30. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/context_engine.py +193 -15
  31. abyss_cli-2.0.4/src/abyss/context_summarizer.py +143 -0
  32. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/curator.py +539 -497
  33. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/extension_context.py +89 -89
  34. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/history/__init__.py +31 -31
  35. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/history/file_history.py +600 -525
  36. abyss_cli-2.0.4/src/abyss/indexing/__init__.py +30 -0
  37. abyss_cli-2.0.4/src/abyss/indexing/embedding.py +314 -0
  38. abyss_cli-2.0.4/src/abyss/indexing/ignore.py +259 -0
  39. abyss_cli-2.0.4/src/abyss/indexing/semantic.py +321 -0
  40. abyss_cli-2.0.4/src/abyss/indexing/service.py +233 -0
  41. abyss_cli-2.0.4/src/abyss/indexing/symbols.py +308 -0
  42. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/interrupt.py +25 -2
  43. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/knowledge/__init__.py +14 -14
  44. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/knowledge/curator.py +373 -338
  45. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/knowledge/loader.py +257 -257
  46. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/llm/__init__.py +23 -17
  47. abyss_cli-2.0.4/src/abyss/llm/exceptions.py +46 -0
  48. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/llm/resilience.py +398 -399
  49. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/llm/thinking_budget.py +206 -188
  50. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/logger.py +608 -604
  51. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/main.py +4051 -3302
  52. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/mcp/manager.py +13 -3
  53. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/memory/__init__.py +28 -24
  54. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/memory/bm25.py +253 -256
  55. abyss_cli-2.0.4/src/abyss/memory/dedup.py +362 -0
  56. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/memory/reranker.py +173 -204
  57. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/memory/store.py +251 -199
  58. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/prompts/__init__.py +201 -164
  59. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/prompts/methodologies.py +267 -200
  60. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/prompts/system_prompt.md +168 -126
  61. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/runtime/__init__.py +9 -9
  62. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/runtime/host.py +254 -242
  63. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/security/__init__.py +5 -5
  64. abyss_cli-2.0.4/src/abyss/security/constants.py +54 -0
  65. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/security/path_security.py +394 -376
  66. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/security/sensitive_filter.py +181 -181
  67. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/security/tool_safety_guard.py +411 -419
  68. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/session.py +49 -14
  69. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/skills/loader.py +4 -0
  70. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/subagent/__init__.py +8 -8
  71. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/subagent/protocol.py +198 -207
  72. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/subagent/runner.py +579 -422
  73. abyss_cli-2.0.4/src/abyss/tokenizer.py +195 -0
  74. abyss_cli-2.0.4/src/abyss/tokenizer_files/tokenizer.json +263174 -0
  75. abyss_cli-2.0.4/src/abyss/tokenizer_files/tokenizer_config.json +35 -0
  76. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/tools/__init__.py +10 -0
  77. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/tools/base.py +20 -30
  78. abyss_cli-2.0.4/src/abyss/tools/code_search.py +231 -0
  79. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/tools/cron_service.py +290 -286
  80. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/tools/file_cache.py +156 -150
  81. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/tools/file_edit.py +90 -70
  82. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/tools/file_io.py +297 -284
  83. abyss_cli-2.0.4/src/abyss/tools/file_read.py +162 -0
  84. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/tools/file_write.py +64 -60
  85. abyss_cli-2.0.4/src/abyss/tools/find_symbols.py +202 -0
  86. abyss_cli-2.0.4/src/abyss/tools/glob_files.py +100 -0
  87. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/tools/knowledge_fetch.py +73 -73
  88. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/tools/knowledge_save.py +274 -250
  89. abyss_cli-2.0.4/src/abyss/tools/memory_save.py +161 -0
  90. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/tools/memory_search.py +157 -135
  91. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/tools/registry.py +35 -25
  92. abyss_cli-2.0.4/src/abyss/tools/run_tests.py +147 -0
  93. abyss_cli-2.0.4/src/abyss/tools/search_common.py +84 -0
  94. abyss_cli-2.0.4/src/abyss/tools/semantic_search.py +140 -0
  95. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/tools/shell_exec.py +442 -399
  96. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/tools/spawn_subagents.py +227 -165
  97. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/tools/todo_write.py +187 -176
  98. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/tools/tracking.py +217 -215
  99. abyss_cli-2.0.4/src/abyss/tools/web_fetch.py +191 -0
  100. abyss_cli-2.0.4/src/abyss/tools/web_search.py +222 -0
  101. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/ui/__init__.py +65 -65
  102. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/ui/renderer.py +1061 -863
  103. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/ui/themes.py +75 -75
  104. abyss_cli-2.0.4/src/abyss/ui/token_rate.py +144 -0
  105. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/utils/__init__.py +1 -1
  106. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/utils/text.py +45 -35
  107. abyss_cli-2.0.4/src/abyss/utils/text_metrics.py +69 -0
  108. abyss_cli-2.0.4/src/abyss/validation/__init__.py +30 -0
  109. abyss_cli-2.0.4/src/abyss/validation/runner.py +457 -0
  110. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/vcs/__init__.py +17 -17
  111. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/vcs/commit_attribution.py +317 -317
  112. abyss_cli-2.0.4/src/abyss_cli.egg-info/PKG-INFO +165 -0
  113. abyss_cli-2.0.4/src/abyss_cli.egg-info/SOURCES.txt +185 -0
  114. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss_cli.egg-info/requires.txt +9 -1
  115. abyss_cli-2.0.4/tests/test_ansi_prompt_wrap.py +361 -0
  116. abyss_cli-2.0.4/tests/test_api_client_compliance.py +111 -0
  117. abyss_cli-2.0.4/tests/test_consume_stream_ui.py +58 -0
  118. abyss_cli-2.0.4/tests/test_context_summarizer.py +150 -0
  119. abyss_cli-2.0.4/tests/test_curator_cron.py +69 -0
  120. abyss_cli-2.0.4/tests/test_effort_levels.py +104 -0
  121. abyss_cli-2.0.4/tests/test_file_history_redo.py +170 -0
  122. abyss_cli-2.0.4/tests/test_file_read_streaming.py +122 -0
  123. abyss_cli-2.0.4/tests/test_image_input.py +264 -0
  124. abyss_cli-2.0.4/tests/test_indexing_embedding.py +167 -0
  125. abyss_cli-2.0.4/tests/test_indexing_ignore.py +167 -0
  126. abyss_cli-2.0.4/tests/test_indexing_service.py +165 -0
  127. abyss_cli-2.0.4/tests/test_indexing_symbols.py +258 -0
  128. abyss_cli-2.0.4/tests/test_inline_refs.py +388 -0
  129. abyss_cli-2.0.4/tests/test_interrupt.py +68 -0
  130. abyss_cli-2.0.4/tests/test_memory_dedup.py +603 -0
  131. abyss_cli-2.0.4/tests/test_native_client.py +272 -0
  132. abyss_cli-2.0.4/tests/test_paste_burst_completion.py +59 -0
  133. abyss_cli-2.0.4/tests/test_path_security_thread_local.py +67 -0
  134. abyss_cli-2.0.4/tests/test_plan_mode.py +242 -0
  135. abyss_cli-2.0.4/tests/test_pricing.py +113 -0
  136. abyss_cli-2.0.4/tests/test_protected_paths_single_source.py +89 -0
  137. abyss_cli-2.0.4/tests/test_registry_cleanup.py +50 -0
  138. abyss_cli-2.0.4/tests/test_reranker_llm.py +40 -0
  139. abyss_cli-2.0.4/tests/test_responses_client.py +526 -0
  140. abyss_cli-2.0.4/tests/test_running_summary_engine.py +168 -0
  141. abyss_cli-2.0.4/tests/test_self_correction.py +73 -0
  142. abyss_cli-2.0.4/tests/test_semantic_index.py +166 -0
  143. abyss_cli-2.0.4/tests/test_session_protocol.py +97 -0
  144. abyss_cli-2.0.4/tests/test_shell_guards_pipeline.py +85 -0
  145. abyss_cli-2.0.4/tests/test_subagent_budget_pricing.py +137 -0
  146. abyss_cli-2.0.4/tests/test_subagent_runner_timeout.py +126 -0
  147. abyss_cli-2.0.4/tests/test_subagent_token_optimization.py +196 -0
  148. abyss_cli-2.0.4/tests/test_term_width_zero.py +80 -0
  149. abyss_cli-2.0.4/tests/test_text_metrics.py +193 -0
  150. abyss_cli-2.0.4/tests/test_token_counter.py +35 -0
  151. abyss_cli-2.0.4/tests/test_token_rate.py +183 -0
  152. abyss_cli-2.0.4/tests/test_tokenizer.py +127 -0
  153. abyss_cli-2.0.4/tests/test_tool_execution_unified.py +113 -0
  154. abyss_cli-2.0.4/tests/test_tool_loop_reasoning.py +115 -0
  155. abyss_cli-2.0.4/tests/test_tool_preview_ui.py +215 -0
  156. abyss_cli-2.0.4/tests/test_tools_base_coerce.py +323 -0
  157. abyss_cli-2.0.4/tests/test_tools_code_search.py +129 -0
  158. abyss_cli-2.0.4/tests/test_tools_cron_service.py +435 -0
  159. abyss_cli-2.0.4/tests/test_tools_file_cache.py +311 -0
  160. abyss_cli-2.0.4/tests/test_tools_file_edit_write.py +307 -0
  161. abyss_cli-2.0.4/tests/test_tools_file_io.py +349 -0
  162. abyss_cli-2.0.4/tests/test_tools_find_symbols.py +181 -0
  163. abyss_cli-2.0.4/tests/test_tools_glob_files.py +63 -0
  164. abyss_cli-2.0.4/tests/test_tools_knowledge.py +501 -0
  165. abyss_cli-2.0.4/tests/test_tools_memory.py +473 -0
  166. abyss_cli-2.0.4/tests/test_tools_registry.py +470 -0
  167. abyss_cli-2.0.4/tests/test_tools_run_tests.py +107 -0
  168. abyss_cli-2.0.4/tests/test_tools_semantic_search.py +124 -0
  169. abyss_cli-2.0.4/tests/test_tools_shell_exec_guards.py +565 -0
  170. abyss_cli-2.0.4/tests/test_tools_spawn_subagents.py +493 -0
  171. abyss_cli-2.0.4/tests/test_tools_todo_write.py +329 -0
  172. abyss_cli-2.0.4/tests/test_tools_tracking.py +432 -0
  173. abyss_cli-2.0.4/tests/test_tools_web_fetch.py +394 -0
  174. abyss_cli-2.0.4/tests/test_tools_web_search_parsers.py +461 -0
  175. abyss_cli-2.0.4/tests/test_validation_runner.py +218 -0
  176. abyss_cli-2.0.4/tests/test_web_search_fallback.py +104 -0
  177. abyss_cli-2.0.3/PKG-INFO +0 -13
  178. abyss_cli-2.0.3/pyproject.toml +0 -32
  179. abyss_cli-2.0.3/src/abyss/api_client.py +0 -283
  180. abyss_cli-2.0.3/src/abyss/tools/file_read.py +0 -113
  181. abyss_cli-2.0.3/src/abyss/tools/memory_save.py +0 -97
  182. abyss_cli-2.0.3/src/abyss/tools/web_fetch.py +0 -102
  183. abyss_cli-2.0.3/src/abyss/tools/web_search.py +0 -126
  184. abyss_cli-2.0.3/src/abyss_cli.egg-info/PKG-INFO +0 -13
  185. abyss_cli-2.0.3/src/abyss_cli.egg-info/SOURCES.txt +0 -96
  186. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/MANIFEST.in +0 -0
  187. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/setup.cfg +0 -0
  188. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/commands/__init__.py +0 -0
  189. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/commands/slash.py +0 -0
  190. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/hooks/__init__.py +0 -0
  191. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/hooks/runner.py +0 -0
  192. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/mcp/__init__.py +0 -0
  193. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss/skills/__init__.py +0 -0
  194. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss_cli.egg-info/dependency_links.txt +0 -0
  195. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss_cli.egg-info/entry_points.txt +0 -0
  196. {abyss_cli-2.0.3 → abyss_cli-2.0.4}/src/abyss_cli.egg-info/top_level.txt +0 -0
@@ -0,0 +1,165 @@
1
+ Metadata-Version: 2.4
2
+ Name: abyss-cli
3
+ Version: 2.0.4
4
+ Summary: 终端AI开发助手
5
+ Author: Abyss Team
6
+ Requires-Python: >=3.9
7
+ Description-Content-Type: text/markdown
8
+ Requires-Dist: click>=8.0.0
9
+ Requires-Dist: prompt-toolkit>=3.0.0
10
+ Requires-Dist: ddgs>=9.0.0
11
+ Requires-Dist: httpx>=0.20.0
12
+ Requires-Dist: mcp>=1.0.0
13
+ Requires-Dist: tiktoken>=0.5.0
14
+ Requires-Dist: tokenizers>=0.15.0
15
+ Requires-Dist: jinja2>=3.0.0
16
+ Provides-Extra: openai
17
+ Requires-Dist: openai>=1.0.0; extra == "openai"
18
+ Provides-Extra: indexing
19
+ Requires-Dist: onnxruntime>=1.17; extra == "indexing"
20
+ Requires-Dist: numpy>=1.24; extra == "indexing"
21
+
22
+ # Abyss CLI
23
+
24
+ > 终端 AI 开发助手 · 类似 Claude Code,一个命令启动,一切在工具内完成。
25
+
26
+ ![Python](https://img.shields.io/badge/Python-3.9%2B-blue)
27
+ ![Version](https://img.shields.io/badge/version-2.0.4-green)
28
+
29
+ Abyss 是一个运行在终端里的 AI 开发助手:启动后通过自然语言驱动文件读写、Shell 执行、网页搜索等内置工具完成开发任务,并内置**长期记忆**、**知识库**、**子代理**、**Skill**、**MCP**、**Hook** 等扩展能力。默认采用复古 CRT 黑客风格 UI(绿色荧光 + 扫描线底纹)。
30
+
31
+ ## ✨ 功能特性
32
+
33
+ - **对话式开发**:多轮对话驱动工具调用,支持流式输出、思考过程显示(可开关)
34
+ - **内置工具**:`file_read` / `file_write` / `file_edit` / `shell_exec` / `web_search` / `web_fetch` / `todo_write`
35
+ - **子代理(Subagent)**:并行拆分复杂任务,内置 Token 预算与费用核算
36
+ - **长期记忆**:跨会话记忆,BM25 检索 + LLM 重排(`/memory`)
37
+ - **知识库**:沉淀与归档经验知识,支持搜索、固定、统计(`/knowledge`)
38
+ - **Skill 系统**:可加载方法论(TDD、调试纪律、架构扫描等),自带 Curator 生命周期管理(`/skills`、`/curator`)
39
+ - **MCP 支持**:接入外部 MCP Server 与工具(`/mcp`)
40
+ - **Hook 机制**:PreToolUse 拦截、PostToolUse 审计,可安装扩展包(如 `security-hooks` 安全加固)
41
+ - **上下文管理**:自动/手动上下文压缩(`/compact`)、会话统计(`/stats`)
42
+ - **Token 计费面板**:累计/逐轮明细与费用(`/token`),集成 DeepSeek 官方定价
43
+ - **Git 集成**:`/git` 归因命令族、`/diff` 查看差异、`/undo` / `/redo` 文件编辑回滚
44
+ - **AI 分析命令**:`/bug-hunter`、`/pr-review`、`/security-scan`、`/explain`、`/advisor`
45
+ - **Plan Mode**:只读规划模式,写/执行工具被门控(`/plan-mode`)
46
+ - **自适应思考预算**:根据上下文动态调节 `reasoning_effort`,省 token
47
+ - **自纠错循环**:工具调用失败自动重试修正(SelfCorrectionLoop)
48
+ - **安全防护**:路径安全校验、敏感信息过滤、危险命令黑名单、工具安全门卫
49
+
50
+ ## 🚀 安装
51
+
52
+ 要求 Python ≥ 3.9。
53
+
54
+ ```bash
55
+ # 从源码安装(推荐开发模式)
56
+ pip install -e .
57
+
58
+ # 或仅安装
59
+ pip install .
60
+ ```
61
+
62
+ 安装完成后即可使用 `abyss` 命令:
63
+
64
+ ```bash
65
+ abyss
66
+ ```
67
+
68
+ ## ⚙️ 配置
69
+
70
+ 首次启动需要配置 API Key(默认使用 DeepSeek):
71
+
72
+ ```bash
73
+ # 启动后在交互界面中设置
74
+ /config set api-key sk-xxxx
75
+
76
+ # 或直接编辑配置文件 ~/.abyss/config.json
77
+ ```
78
+
79
+ | 配置项 | 默认值 | 说明 |
80
+ | --- | --- | --- |
81
+ | `api_key` | 空 | API Key |
82
+ | `base_url` | `https://api.deepseek.com` | API 地址 |
83
+ | `api_format` | `responses` | LLM 接口格式(Responses / Chat Completions) |
84
+ | `model` | `deepseek-v4-pro` | 默认模型 |
85
+ | `model_fallbacks` | `["deepseek-v4-flash"]` | 模型自动降级链 |
86
+ | `thinking` | `true` | 是否开启思考模式 |
87
+ | `reasoning_effort` | `medium` | 思考强度 |
88
+ | `ui.theme` | `hacker` | 界面主题(`hacker` / `default`) |
89
+ | `ui.show_tps` | `true` | 输出速率(tok/s)展示:实时状态行 + 轮末 STREAM 汇总 + `/token` 速率列 |
90
+ | `plan_mode` | `false` | 只读规划模式 |
91
+
92
+ ### 命令行参数
93
+
94
+ ```bash
95
+ abyss # 启动
96
+ abyss -m deepseek-v4-flash # 指定模型
97
+ abyss -r # 恢复上次会话
98
+ abyss -r 会话名 # 恢复指定会话
99
+ abyss --hide-reasoning # 隐藏思考过程
100
+ abyss -v # 显示版本
101
+ ```
102
+
103
+ ## 📖 Slash 命令
104
+
105
+ | 分类 | 命令 |
106
+ | --- | --- |
107
+ | 基础 | `/help` `/clear` `/exit` `/session` |
108
+ | 会话 | `/retry` `/compact` `/undo` `/redo` `/stats` `/token` `/logs` |
109
+ | Git | `/diff` `/git` |
110
+ | AI 分析 | `/bug-hunter` `/pr-review` `/security-scan` `/explain` `/advisor` |
111
+ | 扩展 | `/skills` `/mcp` `/hooks` `/curator` `/knowledge` |
112
+ | 记忆 | `/memory` |
113
+ | 方法论 | `/diagnose` `/tdd` `/review` `/audit` `/architecture` `/prototype` `/domain` |
114
+ | 配置 | `/model` `/effort` `/thinking` `/show-reasoning` `/plan-mode` `/config` `/version` |
115
+
116
+ 自定义命令:在 `~/.abyss/commands/` 下放置 `.md` 文件即可注册新的 slash 命令。
117
+
118
+ ## 🔌 Hook 扩展包
119
+
120
+ `security-hooks` 是通过 Hook 机制实现的安全加固包,**不修改核心代码**:
121
+
122
+ - **PreToolUse**:拦截危险 `shell_exec` 调用、禁止写入敏感目录、防知识库路径遍历
123
+ - **PostToolUse**:记录全部工具调用到 `~/.abyss/logs/tool-audit.log`
124
+
125
+ ```bash
126
+ # 安装
127
+ abyss extension install file://./security-hooks --id security-hooks --type hook
128
+
129
+ # 卸载
130
+ abyss extension remove security-hooks
131
+ ```
132
+
133
+ ## 🧪 测试
134
+
135
+ ```bash
136
+ pip install pytest
137
+ pytest tests/
138
+ ```
139
+
140
+ ## 📂 项目结构
141
+
142
+ ```
143
+ src/abyss/
144
+ ├── main.py # CLI 主入口
145
+ ├── agent_loop.py # 工具执行循环 / 自纠错
146
+ ├── ansi_menu.py # ANSI 补全菜单
147
+ ├── api_client.py # 原生 httpx LLM 客户端
148
+ ├── session.py # 会话管理
149
+ ├── context_engine.py # 上下文压缩
150
+ ├── commands/ # slash 命令实现
151
+ ├── tools/ # 内置工具
152
+ ├── subagent/ # 子代理
153
+ ├── memory/ # 长期记忆(BM25 + 重排)
154
+ ├── knowledge/ # 知识库
155
+ ├── skills/ # Skill 加载
156
+ ├── mcp/ # MCP 管理
157
+ ├── hooks/ # Hook 运行器
158
+ ├── security/ # 安全防护
159
+ ├── ui/ # 主题渲染(hacker CRT)
160
+ └── llm/ # LLM 弹性重试
161
+ ```
162
+
163
+ ## 📄 License
164
+
165
+ 本项目尚未指定开源许可证。上传到 GitHub 前请自行选择(如 MIT / Apache-2.0)并添加 LICENSE 文件。
@@ -0,0 +1,144 @@
1
+ # Abyss CLI
2
+
3
+ > 终端 AI 开发助手 · 类似 Claude Code,一个命令启动,一切在工具内完成。
4
+
5
+ ![Python](https://img.shields.io/badge/Python-3.9%2B-blue)
6
+ ![Version](https://img.shields.io/badge/version-2.0.4-green)
7
+
8
+ Abyss 是一个运行在终端里的 AI 开发助手:启动后通过自然语言驱动文件读写、Shell 执行、网页搜索等内置工具完成开发任务,并内置**长期记忆**、**知识库**、**子代理**、**Skill**、**MCP**、**Hook** 等扩展能力。默认采用复古 CRT 黑客风格 UI(绿色荧光 + 扫描线底纹)。
9
+
10
+ ## ✨ 功能特性
11
+
12
+ - **对话式开发**:多轮对话驱动工具调用,支持流式输出、思考过程显示(可开关)
13
+ - **内置工具**:`file_read` / `file_write` / `file_edit` / `shell_exec` / `web_search` / `web_fetch` / `todo_write`
14
+ - **子代理(Subagent)**:并行拆分复杂任务,内置 Token 预算与费用核算
15
+ - **长期记忆**:跨会话记忆,BM25 检索 + LLM 重排(`/memory`)
16
+ - **知识库**:沉淀与归档经验知识,支持搜索、固定、统计(`/knowledge`)
17
+ - **Skill 系统**:可加载方法论(TDD、调试纪律、架构扫描等),自带 Curator 生命周期管理(`/skills`、`/curator`)
18
+ - **MCP 支持**:接入外部 MCP Server 与工具(`/mcp`)
19
+ - **Hook 机制**:PreToolUse 拦截、PostToolUse 审计,可安装扩展包(如 `security-hooks` 安全加固)
20
+ - **上下文管理**:自动/手动上下文压缩(`/compact`)、会话统计(`/stats`)
21
+ - **Token 计费面板**:累计/逐轮明细与费用(`/token`),集成 DeepSeek 官方定价
22
+ - **Git 集成**:`/git` 归因命令族、`/diff` 查看差异、`/undo` / `/redo` 文件编辑回滚
23
+ - **AI 分析命令**:`/bug-hunter`、`/pr-review`、`/security-scan`、`/explain`、`/advisor`
24
+ - **Plan Mode**:只读规划模式,写/执行工具被门控(`/plan-mode`)
25
+ - **自适应思考预算**:根据上下文动态调节 `reasoning_effort`,省 token
26
+ - **自纠错循环**:工具调用失败自动重试修正(SelfCorrectionLoop)
27
+ - **安全防护**:路径安全校验、敏感信息过滤、危险命令黑名单、工具安全门卫
28
+
29
+ ## 🚀 安装
30
+
31
+ 要求 Python ≥ 3.9。
32
+
33
+ ```bash
34
+ # 从源码安装(推荐开发模式)
35
+ pip install -e .
36
+
37
+ # 或仅安装
38
+ pip install .
39
+ ```
40
+
41
+ 安装完成后即可使用 `abyss` 命令:
42
+
43
+ ```bash
44
+ abyss
45
+ ```
46
+
47
+ ## ⚙️ 配置
48
+
49
+ 首次启动需要配置 API Key(默认使用 DeepSeek):
50
+
51
+ ```bash
52
+ # 启动后在交互界面中设置
53
+ /config set api-key sk-xxxx
54
+
55
+ # 或直接编辑配置文件 ~/.abyss/config.json
56
+ ```
57
+
58
+ | 配置项 | 默认值 | 说明 |
59
+ | --- | --- | --- |
60
+ | `api_key` | 空 | API Key |
61
+ | `base_url` | `https://api.deepseek.com` | API 地址 |
62
+ | `api_format` | `responses` | LLM 接口格式(Responses / Chat Completions) |
63
+ | `model` | `deepseek-v4-pro` | 默认模型 |
64
+ | `model_fallbacks` | `["deepseek-v4-flash"]` | 模型自动降级链 |
65
+ | `thinking` | `true` | 是否开启思考模式 |
66
+ | `reasoning_effort` | `medium` | 思考强度 |
67
+ | `ui.theme` | `hacker` | 界面主题(`hacker` / `default`) |
68
+ | `ui.show_tps` | `true` | 输出速率(tok/s)展示:实时状态行 + 轮末 STREAM 汇总 + `/token` 速率列 |
69
+ | `plan_mode` | `false` | 只读规划模式 |
70
+
71
+ ### 命令行参数
72
+
73
+ ```bash
74
+ abyss # 启动
75
+ abyss -m deepseek-v4-flash # 指定模型
76
+ abyss -r # 恢复上次会话
77
+ abyss -r 会话名 # 恢复指定会话
78
+ abyss --hide-reasoning # 隐藏思考过程
79
+ abyss -v # 显示版本
80
+ ```
81
+
82
+ ## 📖 Slash 命令
83
+
84
+ | 分类 | 命令 |
85
+ | --- | --- |
86
+ | 基础 | `/help` `/clear` `/exit` `/session` |
87
+ | 会话 | `/retry` `/compact` `/undo` `/redo` `/stats` `/token` `/logs` |
88
+ | Git | `/diff` `/git` |
89
+ | AI 分析 | `/bug-hunter` `/pr-review` `/security-scan` `/explain` `/advisor` |
90
+ | 扩展 | `/skills` `/mcp` `/hooks` `/curator` `/knowledge` |
91
+ | 记忆 | `/memory` |
92
+ | 方法论 | `/diagnose` `/tdd` `/review` `/audit` `/architecture` `/prototype` `/domain` |
93
+ | 配置 | `/model` `/effort` `/thinking` `/show-reasoning` `/plan-mode` `/config` `/version` |
94
+
95
+ 自定义命令:在 `~/.abyss/commands/` 下放置 `.md` 文件即可注册新的 slash 命令。
96
+
97
+ ## 🔌 Hook 扩展包
98
+
99
+ `security-hooks` 是通过 Hook 机制实现的安全加固包,**不修改核心代码**:
100
+
101
+ - **PreToolUse**:拦截危险 `shell_exec` 调用、禁止写入敏感目录、防知识库路径遍历
102
+ - **PostToolUse**:记录全部工具调用到 `~/.abyss/logs/tool-audit.log`
103
+
104
+ ```bash
105
+ # 安装
106
+ abyss extension install file://./security-hooks --id security-hooks --type hook
107
+
108
+ # 卸载
109
+ abyss extension remove security-hooks
110
+ ```
111
+
112
+ ## 🧪 测试
113
+
114
+ ```bash
115
+ pip install pytest
116
+ pytest tests/
117
+ ```
118
+
119
+ ## 📂 项目结构
120
+
121
+ ```
122
+ src/abyss/
123
+ ├── main.py # CLI 主入口
124
+ ├── agent_loop.py # 工具执行循环 / 自纠错
125
+ ├── ansi_menu.py # ANSI 补全菜单
126
+ ├── api_client.py # 原生 httpx LLM 客户端
127
+ ├── session.py # 会话管理
128
+ ├── context_engine.py # 上下文压缩
129
+ ├── commands/ # slash 命令实现
130
+ ├── tools/ # 内置工具
131
+ ├── subagent/ # 子代理
132
+ ├── memory/ # 长期记忆(BM25 + 重排)
133
+ ├── knowledge/ # 知识库
134
+ ├── skills/ # Skill 加载
135
+ ├── mcp/ # MCP 管理
136
+ ├── hooks/ # Hook 运行器
137
+ ├── security/ # 安全防护
138
+ ├── ui/ # 主题渲染(hacker CRT)
139
+ └── llm/ # LLM 弹性重试
140
+ ```
141
+
142
+ ## 📄 License
143
+
144
+ 本项目尚未指定开源许可证。上传到 GitHub 前请自行选择(如 MIT / Apache-2.0)并添加 LICENSE 文件。
@@ -0,0 +1,91 @@
1
+ [build-system]
2
+ requires = ["setuptools>=45", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "abyss-cli"
7
+ version = "2.0.4"
8
+ description = "终端AI开发助手"
9
+ readme = "README.md"
10
+ authors = [{name = "Abyss Team"}]
11
+ requires-python = ">=3.9"
12
+ dependencies = [
13
+ "click>=8.0.0",
14
+ "prompt-toolkit>=3.0.0",
15
+ "ddgs>=9.0.0",
16
+ "httpx>=0.20.0",
17
+ "mcp>=1.0.0",
18
+ "tiktoken>=0.5.0",
19
+ "tokenizers>=0.15.0",
20
+ "jinja2>=3.0.0",
21
+ ]
22
+
23
+ [project.optional-dependencies]
24
+ # openai SDK 已由原生 httpx 客户端替代(src/abyss/api_client.py),
25
+ # 保留为可选 extras 仅供需要旧 SDK 的场景手动安装,代码零运行时引用。
26
+ openai = ["openai>=1.0.0"]
27
+ # 语义检索(A3):本地 ONNX embedding + 向量运算。核心功能不依赖此 extra。
28
+ indexing = ["onnxruntime>=1.17", "numpy>=1.24"]
29
+
30
+ [project.scripts]
31
+ abyss = "abyss.main:cli"
32
+
33
+ [tool.setuptools]
34
+ package-dir = {"" = "src"}
35
+ include-package-data = true
36
+
37
+ [tool.setuptools.packages.find]
38
+ where = ["src"]
39
+
40
+ [tool.setuptools.package-data]
41
+ abyss = ["prompts/system_prompt.md", "tokenizer_files/*.json"]
42
+
43
+ # ---------------------------------------------------------------------------
44
+ # 测试配置(pytest + coverage)
45
+ # 大型项目测试规范:
46
+ # - pytest 收集 tests/ 下所有 test_*.py
47
+ # - 严格标记:markers 区分 unit / integration / slow
48
+ # - 覆盖率:tools 包目标 90%+,整体逐步提升
49
+ # ---------------------------------------------------------------------------
50
+ [tool.pytest.ini_options]
51
+ minversion = "7.0"
52
+ testpaths = ["tests"]
53
+ python_files = ["test_*.py"]
54
+ python_classes = ["Test*"]
55
+ python_functions = ["test_*"]
56
+ addopts = [
57
+ "-ra",
58
+ "--strict-markers",
59
+ "--strict-config",
60
+ "-W error::DeprecationWarning",
61
+ ]
62
+ markers = [
63
+ "unit: 纯函数/单类单元测试,无外部依赖(默认全部运行)",
64
+ "integration: 集成测试,涉及真实文件系统或多组件协作",
65
+ "concurrency: 并发安全测试,多线程压测",
66
+ "slow: 较慢的测试(重试退避、网络模拟),可用 -m 'not slow' 跳过",
67
+ ]
68
+
69
+ [tool.coverage.run]
70
+ source = ["src/abyss"]
71
+ branch = true
72
+ omit = [
73
+ "*/tokenizer_files/*",
74
+ "*/__pycache__/*",
75
+ "*/setup.py",
76
+ ]
77
+
78
+ [tool.coverage.report]
79
+ precision = 1
80
+ show_missing = true
81
+ skip_covered = false
82
+ exclude_lines = [
83
+ "pragma: no cover",
84
+ "raise NotImplementedError",
85
+ "if __name__ == .__main__.:",
86
+ "if TYPE_CHECKING:",
87
+ "@abstractmethod",
88
+ ]
89
+
90
+ [tool.coverage.html]
91
+ directory = "htmlcov"
@@ -1,4 +1,4 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  """Abyss - 终端AI开发助手"""
3
- __version__ = "2.0.3"
3
+ __version__ = "2.0.4"
4
4
 
@@ -1,65 +1,65 @@
1
- # -*- coding: utf-8 -*-
2
- """
3
- 懒访问上下文(Lazy Access Context)
4
-
5
- 借鉴 Hermes Agent 的 _ra() 懒导入模式,将模块级全局变量的访问封装为函数,
6
- 解决:
7
- 1. 测试 mock:无需导入整个 main.py,通过 set_context() 注入
8
- 2. 循环导入:延迟解析引用,避免模块初始化顺序依赖
9
-
10
- 使用方式:
11
- from abyss._globals import ctx
12
-
13
- tool = ctx().registry.get("file_read") # 懒访问 registry
14
- host = ctx().host # 懒访问 lifecycle host
15
-
16
- # 测试中:
17
- ctx.override(registry=mock_reg, host=mock_host)
18
- """
19
-
20
- from __future__ import annotations
21
-
22
- from typing import Any
23
-
24
-
25
- class _Context:
26
- """持有 agent 运行时的共享状态。"""
27
-
28
- def __init__(self):
29
- self.registry: Any = None
30
- self.host: Any = None
31
- self.esc: Any = None
32
- self.engine: Any = None
33
- self.curator_daemon: Any = None
34
-
35
- def is_ready(self) -> bool:
36
- """registry 是否已初始化。"""
37
- return self.registry is not None
38
-
39
-
40
- class _LazyAccessor:
41
- """懒访问器:返回当前线程的 Context,测试可用 override 替换。"""
42
-
43
- def __init__(self):
44
- self._default = _Context()
45
- self._override: _Context | None = None
46
-
47
- def __call__(self) -> _Context:
48
- return self._override or self._default
49
-
50
- def override(self, **kwargs) -> _Context:
51
- """用给定属性创建覆盖 context。用于测试注入。"""
52
- ctx = _Context()
53
- for k, v in kwargs.items():
54
- if hasattr(ctx, k):
55
- setattr(ctx, k, v)
56
- self._override = ctx
57
- return ctx
58
-
59
- def restore(self) -> None:
60
- """清除覆盖,恢复默认 context。"""
61
- self._override = None
62
-
63
-
64
- # 全局单例
65
- ctx = _LazyAccessor()
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ 懒访问上下文(Lazy Access Context)
4
+
5
+ 借鉴 Hermes Agent 的 _ra() 懒导入模式,将模块级全局变量的访问封装为函数,
6
+ 解决:
7
+ 1. 测试 mock:无需导入整个 main.py,通过 set_context() 注入
8
+ 2. 循环导入:延迟解析引用,避免模块初始化顺序依赖
9
+
10
+ 使用方式:
11
+ from abyss._globals import ctx
12
+
13
+ tool = ctx().registry.get("file_read") # 懒访问 registry
14
+ host = ctx().host # 懒访问 lifecycle host
15
+
16
+ # 测试中:
17
+ ctx.override(registry=mock_reg, host=mock_host)
18
+ """
19
+
20
+ from __future__ import annotations
21
+
22
+ from typing import Any
23
+
24
+
25
+ class _Context:
26
+ """持有 agent 运行时的共享状态。"""
27
+
28
+ def __init__(self):
29
+ self.registry: Any = None
30
+ self.host: Any = None
31
+ self.esc: Any = None
32
+ self.engine: Any = None
33
+ self.curator_daemon: Any = None
34
+
35
+ def is_ready(self) -> bool:
36
+ """registry 是否已初始化。"""
37
+ return self.registry is not None
38
+
39
+
40
+ class _LazyAccessor:
41
+ """懒访问器:返回当前线程的 Context,测试可用 override 替换。"""
42
+
43
+ def __init__(self):
44
+ self._default = _Context()
45
+ self._override: _Context | None = None
46
+
47
+ def __call__(self) -> _Context:
48
+ return self._override or self._default
49
+
50
+ def override(self, **kwargs) -> _Context:
51
+ """用给定属性创建覆盖 context。用于测试注入。"""
52
+ ctx = _Context()
53
+ for k, v in kwargs.items():
54
+ if hasattr(ctx, k):
55
+ setattr(ctx, k, v)
56
+ self._override = ctx
57
+ return ctx
58
+
59
+ def restore(self) -> None:
60
+ """清除覆盖,恢复默认 context。"""
61
+ self._override = None
62
+
63
+
64
+ # 全局单例
65
+ ctx = _LazyAccessor()