zall 0.4.1__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 (182) hide show
  1. zall-0.4.1/LICENSE +21 -0
  2. zall-0.4.1/PKG-INFO +243 -0
  3. zall-0.4.1/README.md +199 -0
  4. zall-0.4.1/pyproject.toml +95 -0
  5. zall-0.4.1/setup.cfg +4 -0
  6. zall-0.4.1/src/zall/__init__.py +7 -0
  7. zall-0.4.1/src/zall/__main__.py +3 -0
  8. zall-0.4.1/src/zall/_util/__init__.py +15 -0
  9. zall-0.4.1/src/zall/_util/file.py +115 -0
  10. zall-0.4.1/src/zall/_util/file_state.py +123 -0
  11. zall-0.4.1/src/zall/_util/logging.py +130 -0
  12. zall-0.4.1/src/zall/_util/model_registry.py +225 -0
  13. zall-0.4.1/src/zall/_util/path.py +74 -0
  14. zall-0.4.1/src/zall/_util/string.py +22 -0
  15. zall-0.4.1/src/zall/_util/toml.py +223 -0
  16. zall-0.4.1/src/zall/_util/win32.py +91 -0
  17. zall-0.4.1/src/zall/adapters/__init__.py +26 -0
  18. zall-0.4.1/src/zall/adapters/anthropic.py +399 -0
  19. zall-0.4.1/src/zall/adapters/base.py +208 -0
  20. zall-0.4.1/src/zall/adapters/gemini.py +343 -0
  21. zall-0.4.1/src/zall/adapters/ollama.py +305 -0
  22. zall-0.4.1/src/zall/adapters/openai_compat.py +446 -0
  23. zall-0.4.1/src/zall/cli/__init__.py +8 -0
  24. zall-0.4.1/src/zall/cli/app.py +131 -0
  25. zall-0.4.1/src/zall/cli/commands/__init__.py +159 -0
  26. zall-0.4.1/src/zall/cli/commands/_common.py +1029 -0
  27. zall-0.4.1/src/zall/cli/commands/_legacy.py +101 -0
  28. zall-0.4.1/src/zall/cli/commands/files.py +318 -0
  29. zall-0.4.1/src/zall/cli/commands/git.py +210 -0
  30. zall-0.4.1/src/zall/cli/commands/model.py +697 -0
  31. zall-0.4.1/src/zall/cli/commands/reload.py +92 -0
  32. zall-0.4.1/src/zall/cli/commands/session.py +474 -0
  33. zall-0.4.1/src/zall/cli/commands/system.py +460 -0
  34. zall-0.4.1/src/zall/cli/commands/v040.py +428 -0
  35. zall-0.4.1/src/zall/cli/config.py +419 -0
  36. zall-0.4.1/src/zall/cli/config_layers.py +246 -0
  37. zall-0.4.1/src/zall/cli/environment.py +738 -0
  38. zall-0.4.1/src/zall/cli/init_wizard.py +284 -0
  39. zall-0.4.1/src/zall/cli/judge.py +206 -0
  40. zall-0.4.1/src/zall/cli/orchestrator.py +527 -0
  41. zall-0.4.1/src/zall/cli/prompt.py +268 -0
  42. zall-0.4.1/src/zall/cli/render.py +966 -0
  43. zall-0.4.1/src/zall/cli/repl_ui.py +439 -0
  44. zall-0.4.1/src/zall/cli/replay.py +310 -0
  45. zall-0.4.1/src/zall/cli/responder.py +247 -0
  46. zall-0.4.1/src/zall/cli/session.py +650 -0
  47. zall-0.4.1/src/zall/cli/update.py +263 -0
  48. zall-0.4.1/src/zall/codegraph/__init__.py +919 -0
  49. zall-0.4.1/src/zall/core/__init__.py +40 -0
  50. zall-0.4.1/src/zall/core/accountability.py +318 -0
  51. zall-0.4.1/src/zall/core/action.py +66 -0
  52. zall-0.4.1/src/zall/core/agent.py +530 -0
  53. zall-0.4.1/src/zall/core/builder.py +407 -0
  54. zall-0.4.1/src/zall/core/chat_state.py +596 -0
  55. zall-0.4.1/src/zall/core/checkpoint.py +416 -0
  56. zall-0.4.1/src/zall/core/compactor.py +460 -0
  57. zall-0.4.1/src/zall/core/context.py +117 -0
  58. zall-0.4.1/src/zall/core/events.py +148 -0
  59. zall-0.4.1/src/zall/core/executor.py +361 -0
  60. zall-0.4.1/src/zall/core/extension.py +238 -0
  61. zall-0.4.1/src/zall/core/gate.py +337 -0
  62. zall-0.4.1/src/zall/core/goal.py +420 -0
  63. zall-0.4.1/src/zall/core/lifecycle.py +262 -0
  64. zall-0.4.1/src/zall/core/loop.py +1597 -0
  65. zall-0.4.1/src/zall/core/memory.py +216 -0
  66. zall-0.4.1/src/zall/core/model.py +241 -0
  67. zall-0.4.1/src/zall/core/refiner.py +320 -0
  68. zall-0.4.1/src/zall/core/safety.py +316 -0
  69. zall-0.4.1/src/zall/core/tool.py +159 -0
  70. zall-0.4.1/src/zall/core/toolset.py +223 -0
  71. zall-0.4.1/src/zall/core/verifiability.py +571 -0
  72. zall-0.4.1/src/zall/eval/__init__.py +15 -0
  73. zall-0.4.1/src/zall/eval/metrics.py +349 -0
  74. zall-0.4.1/src/zall/extensions/__init__.py +1 -0
  75. zall-0.4.1/src/zall/extensions/auto_learn.py +507 -0
  76. zall-0.4.1/src/zall/extensions/usage_tracker.py +91 -0
  77. zall-0.4.1/src/zall/lsp/__init__.py +849 -0
  78. zall-0.4.1/src/zall/mcp/__init__.py +22 -0
  79. zall-0.4.1/src/zall/mcp/client.py +270 -0
  80. zall-0.4.1/src/zall/mcp/config.py +191 -0
  81. zall-0.4.1/src/zall/mcp/tool.py +124 -0
  82. zall-0.4.1/src/zall/plugin/__init__.py +585 -0
  83. zall-0.4.1/src/zall/safety/__init__.py +10 -0
  84. zall-0.4.1/src/zall/safety/config.py +162 -0
  85. zall-0.4.1/src/zall/safety/rules_file.py +579 -0
  86. zall-0.4.1/src/zall/sandbox/__init__.py +599 -0
  87. zall-0.4.1/src/zall/skills/__init__.py +11 -0
  88. zall-0.4.1/src/zall/skills/loader.py +202 -0
  89. zall-0.4.1/src/zall/tools/__init__.py +11 -0
  90. zall-0.4.1/src/zall/tools/_bash_semantics.py +257 -0
  91. zall-0.4.1/src/zall/tools/_diff.py +24 -0
  92. zall-0.4.1/src/zall/tools/bash.py +633 -0
  93. zall-0.4.1/src/zall/tools/batch_edit.py +315 -0
  94. zall-0.4.1/src/zall/tools/code_understanding.py +249 -0
  95. zall-0.4.1/src/zall/tools/codegraph.py +330 -0
  96. zall-0.4.1/src/zall/tools/edit_file.py +188 -0
  97. zall-0.4.1/src/zall/tools/git_protect.py +189 -0
  98. zall-0.4.1/src/zall/tools/glob.py +133 -0
  99. zall-0.4.1/src/zall/tools/grep.py +271 -0
  100. zall-0.4.1/src/zall/tools/list_dir.py +151 -0
  101. zall-0.4.1/src/zall/tools/lsp_diagnostics.py +315 -0
  102. zall-0.4.1/src/zall/tools/project_analysis.py +217 -0
  103. zall-0.4.1/src/zall/tools/pty_executor.py +253 -0
  104. zall-0.4.1/src/zall/tools/read_file.py +257 -0
  105. zall-0.4.1/src/zall/tools/read_image.py +312 -0
  106. zall-0.4.1/src/zall/tools/search.py +397 -0
  107. zall-0.4.1/src/zall/tools/spawn_subagent.py +687 -0
  108. zall-0.4.1/src/zall/tools/todo.py +137 -0
  109. zall-0.4.1/src/zall/tools/web_fetch.py +488 -0
  110. zall-0.4.1/src/zall/tools/write_file.py +141 -0
  111. zall-0.4.1/src/zall.egg-info/PKG-INFO +243 -0
  112. zall-0.4.1/src/zall.egg-info/SOURCES.txt +180 -0
  113. zall-0.4.1/src/zall.egg-info/dependency_links.txt +1 -0
  114. zall-0.4.1/src/zall.egg-info/entry_points.txt +2 -0
  115. zall-0.4.1/src/zall.egg-info/requires.txt +24 -0
  116. zall-0.4.1/src/zall.egg-info/top_level.txt +1 -0
  117. zall-0.4.1/tests/test_action_invariants.py +57 -0
  118. zall-0.4.1/tests/test_adapter_mock_invariants.py +487 -0
  119. zall-0.4.1/tests/test_agent_builder.py +275 -0
  120. zall-0.4.1/tests/test_agent_definition.py +274 -0
  121. zall-0.4.1/tests/test_auto_compact_v018.py +369 -0
  122. zall-0.4.1/tests/test_bash_invariants.py +162 -0
  123. zall-0.4.1/tests/test_bash_pty.py +132 -0
  124. zall-0.4.1/tests/test_batch_edit_invariants.py +190 -0
  125. zall-0.4.1/tests/test_bugfix_regressions.py +326 -0
  126. zall-0.4.1/tests/test_chat_state_invariants.py +355 -0
  127. zall-0.4.1/tests/test_checkpoint_invariants.py +233 -0
  128. zall-0.4.1/tests/test_cli_app.py +710 -0
  129. zall-0.4.1/tests/test_cli_interaction_v012.py +320 -0
  130. zall-0.4.1/tests/test_cli_interaction_v013.py +202 -0
  131. zall-0.4.1/tests/test_cli_judge.py +129 -0
  132. zall-0.4.1/tests/test_cli_missing_commands.py +258 -0
  133. zall-0.4.1/tests/test_cli_new_commands.py +507 -0
  134. zall-0.4.1/tests/test_cli_render.py +373 -0
  135. zall-0.4.1/tests/test_cli_responder.py +148 -0
  136. zall-0.4.1/tests/test_codegraph_invariants.py +495 -0
  137. zall-0.4.1/tests/test_compactor_invariants.py +448 -0
  138. zall-0.4.1/tests/test_config_layers.py +253 -0
  139. zall-0.4.1/tests/test_confirm_gate_invariants.py +265 -0
  140. zall-0.4.1/tests/test_context_invariants.py +156 -0
  141. zall-0.4.1/tests/test_context_judge_invariants.py +296 -0
  142. zall-0.4.1/tests/test_edit_bash_invariants.py +105 -0
  143. zall-0.4.1/tests/test_edit_file_invariants.py +235 -0
  144. zall-0.4.1/tests/test_eval_invariants.py +150 -0
  145. zall-0.4.1/tests/test_git_rules_invariants.py +79 -0
  146. zall-0.4.1/tests/test_glob_invariants.py +76 -0
  147. zall-0.4.1/tests/test_goal_invariants.py +597 -0
  148. zall-0.4.1/tests/test_grep_invariants.py +92 -0
  149. zall-0.4.1/tests/test_integration.py +234 -0
  150. zall-0.4.1/tests/test_integration_v040.py +592 -0
  151. zall-0.4.1/tests/test_interaction_v020.py +401 -0
  152. zall-0.4.1/tests/test_judge_invariants.py +305 -0
  153. zall-0.4.1/tests/test_lifecycle_hooks.py +648 -0
  154. zall-0.4.1/tests/test_list_dir_invariants.py +92 -0
  155. zall-0.4.1/tests/test_loop_invariants.py +522 -0
  156. zall-0.4.1/tests/test_loop_observer_invariants.py +400 -0
  157. zall-0.4.1/tests/test_loop_step_invariants.py +334 -0
  158. zall-0.4.1/tests/test_loop_stream_invariants.py +293 -0
  159. zall-0.4.1/tests/test_lsp_invariants.py +244 -0
  160. zall-0.4.1/tests/test_mcp_registration_v017.py +290 -0
  161. zall-0.4.1/tests/test_model_invariants.py +217 -0
  162. zall-0.4.1/tests/test_openai_compat_invariants.py +399 -0
  163. zall-0.4.1/tests/test_plugin_system.py +290 -0
  164. zall-0.4.1/tests/test_project_memory_invariants.py +74 -0
  165. zall-0.4.1/tests/test_read_file_invariants.py +142 -0
  166. zall-0.4.1/tests/test_read_image_invariants.py +230 -0
  167. zall-0.4.1/tests/test_real_api_v030.py +356 -0
  168. zall-0.4.1/tests/test_refiner_invariants.py +338 -0
  169. zall-0.4.1/tests/test_replay_invariants.py +213 -0
  170. zall-0.4.1/tests/test_rules_file_invariants.py +243 -0
  171. zall-0.4.1/tests/test_sandbox_invariants.py +261 -0
  172. zall-0.4.1/tests/test_skills.py +206 -0
  173. zall-0.4.1/tests/test_streaming_invariants.py +262 -0
  174. zall-0.4.1/tests/test_subagent_authority_v014.py +215 -0
  175. zall-0.4.1/tests/test_subagent_mcp_inheritance.py +104 -0
  176. zall-0.4.1/tests/test_thinking_display.py +291 -0
  177. zall-0.4.1/tests/test_timeline_completeness.py +249 -0
  178. zall-0.4.1/tests/test_tool_invariants.py +185 -0
  179. zall-0.4.1/tests/test_verifiability_invariants.py +303 -0
  180. zall-0.4.1/tests/test_web_fetch_invariants.py +153 -0
  181. zall-0.4.1/tests/test_windows_encoding.py +324 -0
  182. zall-0.4.1/tests/test_write_file_invariants.py +81 -0
zall-0.4.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-2026 zall contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
zall-0.4.1/PKG-INFO ADDED
@@ -0,0 +1,243 @@
1
+ Metadata-Version: 2.4
2
+ Name: zall
3
+ Version: 0.4.1
4
+ Summary: zall — a falsifiable, reproducible coding agent CLI. Model-agnostic, chain-hashed, replayable.
5
+ Author: zall contributors
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/qinrayn/zall
8
+ Project-URL: Repository, https://github.com/qinrayn/zall
9
+ Project-URL: Documentation, https://github.com/qinrayn/zall
10
+ Project-URL: Issues, https://github.com/qinrayn/zall/issues
11
+ Keywords: coding-agent,cli,ai,llm,developer-tools,reproducible
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.10
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 :: Build Tools
21
+ Classifier: Topic :: Software Development :: Debuggers
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: pydantic>=2.5
26
+ Requires-Dist: cryptography>=42
27
+ Requires-Dist: httpx>=0.24
28
+ Requires-Dist: rich>=13
29
+ Requires-Dist: prompt_toolkit>=3.0
30
+ Requires-Dist: tomli>=2.0; python_version < "3.11"
31
+ Requires-Dist: pyyaml>=6.0
32
+ Provides-Extra: dev
33
+ Requires-Dist: pytest>=7.4; extra == "dev"
34
+ Requires-Dist: mypy>=1.7; extra == "dev"
35
+ Requires-Dist: ruff>=0.1; extra == "dev"
36
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
37
+ Provides-Extra: bs4
38
+ Requires-Dist: beautifulsoup4>=4.0; extra == "bs4"
39
+ Provides-Extra: images
40
+ Requires-Dist: pillow>=10.0; extra == "images"
41
+ Provides-Extra: all
42
+ Requires-Dist: zall[bs4,dev,images]; extra == "all"
43
+ Dynamic: license-file
44
+
45
+ <p align="center">
46
+ <picture>
47
+ <source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/badge/zall-v0.4.1-blue?style=for-the-badge&logo=python&logoColor=white&labelColor=1a1a2e">
48
+ <img alt="zall" src="https://img.shields.io/badge/zall-v0.4.1-blue?style=for-the-badge&logo=python&logoColor=white&labelColor=1a1a2e">
49
+ </picture>
50
+ </p>
51
+
52
+ <p align="center">
53
+ <em>A falsifiable, reproducible coding agent CLI — model-agnostic, engineering-grade</em>
54
+ </p>
55
+
56
+ <p align="center">
57
+ <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/license-MIT-green" alt="MIT License"></a>
58
+ <a href="https://python.org"><img src="https://img.shields.io/badge/python-≥3.10-blue" alt="Python ≥3.10"></a>
59
+ <a href="https://github.com/Qinrayn/zall/actions/workflows/ci.yml"><img src="https://github.com/Qinrayn/zall/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
60
+ <a href="https://pypi.org/project/zall/"><img src="https://img.shields.io/pypi/v/zall" alt="PyPI"></a>
61
+ <br>
62
+ <a href="#quick-start">Quick Start</a> •
63
+ <a href="#architecture">Architecture</a> •
64
+ <a href="#features">Features</a> •
65
+ <a href="#commands">Commands</a> •
66
+ <a href="#comparison">Comparison</a>
67
+ </p>
68
+
69
+ ---
70
+
71
+ ## Quick Start
72
+
73
+ ```bash
74
+ # Install
75
+ pip install zall
76
+
77
+ # Set API key (OpenAI-compatible)
78
+ export ZALL_API_KEY="sk-..."
79
+ export ZALL_MODEL="gpt-4o"
80
+
81
+ # One-shot task
82
+ zall "refactor the auth module to use async"
83
+
84
+ # Interactive REPL
85
+ zall
86
+ > /help
87
+ > /lsp status # live code diagnostics
88
+ > /codegraph index # build symbol index
89
+ > /codegraph search MyClass # find symbols
90
+ > /sandbox process # isolated execution
91
+ > /eval # evaluate sessions
92
+ > /replay <id> # replay a session
93
+ ```
94
+
95
+ ---
96
+
97
+ ## Features
98
+
99
+ ### 🧠 Code Intelligence
100
+ - **LSP Integration** — live diagnostics, go-to-definition, hover info, completions. Supports pyright, typescript-language-server, rust-analyzer, gopls, clangd.
101
+ - **CodeGraph** — multi-language symbol indexer for Python/JS/TS/Rust/Go/Java/C++/Ruby/PHP/Swift. Search, outline, and navigate your codebase.
102
+ - **`code_understanding` tool** — combine search + outline + read in one agent call.
103
+
104
+ ### 🛡️ Safety & Reproducibility
105
+ - **PR-0**: Architectural hallucination detection — `stop_reason=STOP` with no `tool_calls` → flagged.
106
+ - **Chain-hash timeline** — every session is cryptographically chained and replayable.
107
+ - **ConfirmGate** — three-layer safety (rule engine + gate + override audit).
108
+ - **Sandbox** — process isolation with worktree/process modes, resource limits.
109
+
110
+ ### 🔌 Extensibility
111
+ - **Plugin system** — manifest-based plugins with git install, Python entry points.
112
+ - **21 agent tools** — read/write/edit/bash/grep/glob/list_dir/search/web_fetch/spawn_subagent + LSP + CodeGraph.
113
+ - **MCP support** — connect any MCP server.
114
+ - **AgentDefinition** — YAML-based agent profiles with toolset presets.
115
+
116
+ ### 🎯 Agent Architecture
117
+ - **ChatState** — actor-based message management with events, usage tracking, compaction.
118
+ - **AgentBuilder** — fluent builder for AgentLoop construction.
119
+ - **Subagent** — typed sub-agents (general-purpose, explore, plan) with capability isolation.
120
+ - **5 toolset presets** — `zall`, `explore`, `plan`, `codex`, `opencode`.
121
+
122
+ ---
123
+
124
+ ## Architecture
125
+
126
+ ```
127
+ zall/
128
+ ├── core/ # Primitives: model, agent, chat_state, gate, goal, safety, tool
129
+ │ ├── loop.py # AgentLoop orchestrator
130
+ │ ├── agent.py # AgentDefinition + ToolsetPreset + CapabilityMode
131
+ │ ├── chat_state.py # Actor-based message management (NEW)
132
+ │ ├── safety.py # Three-state context_judge
133
+ │ ├── gate.py # ConfirmGate state machine
134
+ │ └── verifiability.py # RunRecorder (chain-hash) + TrustAnchor
135
+ ├── cli/ # Rich REPL, 25+ slash commands, replay
136
+ ├── tools/ # 21 tools: read/write/edit/bash/grep/lsp/codegraph/…
137
+ ├── adapters/ # OpenAI-compat, Anthropic, Gemini, Ollama
138
+ ├── codegraph/ # Multi-language symbol indexer (NEW)
139
+ ├── lsp/ # LSP client (pyright, rust-analyzer, etc.) (NEW)
140
+ ├── sandbox/ # Process isolation (NEW)
141
+ ├── plugin/ # Plugin system (NEW)
142
+ ├── mcp/ # MCP client
143
+ ├── safety/ # Rule loader
144
+ ├── eval/ # 5-dimensional R-Metric evaluation
145
+ └── skills/ # Skill loader
146
+ ```
147
+
148
+ ---
149
+
150
+ ## Commands
151
+
152
+ ### Built-in (25+)
153
+
154
+ | Command | Description |
155
+ |---------|-------------|
156
+ | `/help` | Show all commands |
157
+ | `/model` | Switch model |
158
+ | `/plan` | Toggle plan mode |
159
+ | `/lsp` | LSP diagnostics & servers (NEW) |
160
+ | `/codegraph` | Code search & outline (NEW) |
161
+ | `/sandbox` | Isolation mode control (NEW) |
162
+ | `/chatstate` | ChatState diagnostics (NEW) |
163
+ | `/plugin` | Plugin management (NEW) |
164
+ | `/add` | Add file(s) to context |
165
+ | `/drop` | Remove file(s) |
166
+ | `/diff` | Show git diff |
167
+ | `/search` | Web search |
168
+ | `/web` | Fetch URL |
169
+ | `/git` | Git commands |
170
+ | `/commit` | Stage + commit |
171
+ | `/sessions` | List sessions |
172
+ | `/resume` | Resume session |
173
+ | `/replay` | Replay session |
174
+ | `/eval` | Evaluate session |
175
+ | `/cost` | Token usage |
176
+ | `/compact` | Compress context |
177
+ | `/undo` | Undo last tool |
178
+ | `/retry` | Retry last response |
179
+ | `/doctor` | Diagnose setup |
180
+ | `/checkpoint` | File snapshots |
181
+ | `/clear` | Clear conversation |
182
+
183
+ ### Agent Tools (21)
184
+
185
+ | Tool | Purpose |
186
+ |------|---------|
187
+ | `read_file` | Read file content |
188
+ | `write_file` | Create/overwrite file |
189
+ | `edit_file` | Targeted string replacement |
190
+ | `batch_edit` | Multi-file batch edit |
191
+ | `bash` | Shell commands |
192
+ | `grep` | Search file contents |
193
+ | `glob` | Find files by pattern |
194
+ | `list_dir` | List directory |
195
+ | `web_fetch` | Fetch web page |
196
+ | `search` | Web search |
197
+ | `read_image` | Read image content |
198
+ | `spawn_subagent` | Delegate sub-task |
199
+ | `todo_list` | Track progress |
200
+ | `lsp_diagnostics` | Code errors/warnings (NEW) |
201
+ | `lsp_hover` | Symbol info (NEW) |
202
+ | `lsp_goto_definition` | Jump to definition (NEW) |
203
+ | `codegraph_search` | Find symbols (NEW) |
204
+ | `codegraph_outline` | File structure (NEW) |
205
+ | `codegraph_index` | Build index (NEW) |
206
+ | `code_understanding` | Deep code analysis (NEW) |
207
+ | `project_analysis` | Project stats (NEW) |
208
+
209
+ ---
210
+
211
+ ## Comparison
212
+
213
+ ### vs Claude Code / Copilot
214
+
215
+ | Feature | zall | Claude Code |
216
+ |---------|------|------------|
217
+ | Hallucination detection | **Architectural** (PR-0) | Prompt-based |
218
+ | Reproducibility | Chain-hash + Replay | Log files only |
219
+ | Safety | 3-layer gate | Implicit |
220
+ | Model independence | 4 adapters (Protocol) | Anthropic-only |
221
+ | Code intelligence | LSP + CodeGraph | Limited |
222
+ | Sandbox isolation | Process/Worktree modes | None |
223
+ | Plugin system | Manifest-based | None |
224
+ | Open source | ✅ MIT | ❌ |
225
+
226
+ ---
227
+
228
+ ## Contributing
229
+
230
+ ```bash
231
+ git clone https://github.com/Qinrayn/zall.git
232
+ cd zall
233
+ pip install -e ".[dev,bs4]"
234
+ python -m pytest tests/
235
+ ```
236
+
237
+ See [CONTRIBUTING.md](.github/CONTRIBUTING.md) for guidelines.
238
+
239
+ ---
240
+
241
+ ## License
242
+
243
+ [MIT](LICENSE) © 2026 zall contributors
zall-0.4.1/README.md ADDED
@@ -0,0 +1,199 @@
1
+ <p align="center">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/badge/zall-v0.4.1-blue?style=for-the-badge&logo=python&logoColor=white&labelColor=1a1a2e">
4
+ <img alt="zall" src="https://img.shields.io/badge/zall-v0.4.1-blue?style=for-the-badge&logo=python&logoColor=white&labelColor=1a1a2e">
5
+ </picture>
6
+ </p>
7
+
8
+ <p align="center">
9
+ <em>A falsifiable, reproducible coding agent CLI — model-agnostic, engineering-grade</em>
10
+ </p>
11
+
12
+ <p align="center">
13
+ <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/license-MIT-green" alt="MIT License"></a>
14
+ <a href="https://python.org"><img src="https://img.shields.io/badge/python-≥3.10-blue" alt="Python ≥3.10"></a>
15
+ <a href="https://github.com/Qinrayn/zall/actions/workflows/ci.yml"><img src="https://github.com/Qinrayn/zall/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
16
+ <a href="https://pypi.org/project/zall/"><img src="https://img.shields.io/pypi/v/zall" alt="PyPI"></a>
17
+ <br>
18
+ <a href="#quick-start">Quick Start</a> •
19
+ <a href="#architecture">Architecture</a> •
20
+ <a href="#features">Features</a> •
21
+ <a href="#commands">Commands</a> •
22
+ <a href="#comparison">Comparison</a>
23
+ </p>
24
+
25
+ ---
26
+
27
+ ## Quick Start
28
+
29
+ ```bash
30
+ # Install
31
+ pip install zall
32
+
33
+ # Set API key (OpenAI-compatible)
34
+ export ZALL_API_KEY="sk-..."
35
+ export ZALL_MODEL="gpt-4o"
36
+
37
+ # One-shot task
38
+ zall "refactor the auth module to use async"
39
+
40
+ # Interactive REPL
41
+ zall
42
+ > /help
43
+ > /lsp status # live code diagnostics
44
+ > /codegraph index # build symbol index
45
+ > /codegraph search MyClass # find symbols
46
+ > /sandbox process # isolated execution
47
+ > /eval # evaluate sessions
48
+ > /replay <id> # replay a session
49
+ ```
50
+
51
+ ---
52
+
53
+ ## Features
54
+
55
+ ### 🧠 Code Intelligence
56
+ - **LSP Integration** — live diagnostics, go-to-definition, hover info, completions. Supports pyright, typescript-language-server, rust-analyzer, gopls, clangd.
57
+ - **CodeGraph** — multi-language symbol indexer for Python/JS/TS/Rust/Go/Java/C++/Ruby/PHP/Swift. Search, outline, and navigate your codebase.
58
+ - **`code_understanding` tool** — combine search + outline + read in one agent call.
59
+
60
+ ### 🛡️ Safety & Reproducibility
61
+ - **PR-0**: Architectural hallucination detection — `stop_reason=STOP` with no `tool_calls` → flagged.
62
+ - **Chain-hash timeline** — every session is cryptographically chained and replayable.
63
+ - **ConfirmGate** — three-layer safety (rule engine + gate + override audit).
64
+ - **Sandbox** — process isolation with worktree/process modes, resource limits.
65
+
66
+ ### 🔌 Extensibility
67
+ - **Plugin system** — manifest-based plugins with git install, Python entry points.
68
+ - **21 agent tools** — read/write/edit/bash/grep/glob/list_dir/search/web_fetch/spawn_subagent + LSP + CodeGraph.
69
+ - **MCP support** — connect any MCP server.
70
+ - **AgentDefinition** — YAML-based agent profiles with toolset presets.
71
+
72
+ ### 🎯 Agent Architecture
73
+ - **ChatState** — actor-based message management with events, usage tracking, compaction.
74
+ - **AgentBuilder** — fluent builder for AgentLoop construction.
75
+ - **Subagent** — typed sub-agents (general-purpose, explore, plan) with capability isolation.
76
+ - **5 toolset presets** — `zall`, `explore`, `plan`, `codex`, `opencode`.
77
+
78
+ ---
79
+
80
+ ## Architecture
81
+
82
+ ```
83
+ zall/
84
+ ├── core/ # Primitives: model, agent, chat_state, gate, goal, safety, tool
85
+ │ ├── loop.py # AgentLoop orchestrator
86
+ │ ├── agent.py # AgentDefinition + ToolsetPreset + CapabilityMode
87
+ │ ├── chat_state.py # Actor-based message management (NEW)
88
+ │ ├── safety.py # Three-state context_judge
89
+ │ ├── gate.py # ConfirmGate state machine
90
+ │ └── verifiability.py # RunRecorder (chain-hash) + TrustAnchor
91
+ ├── cli/ # Rich REPL, 25+ slash commands, replay
92
+ ├── tools/ # 21 tools: read/write/edit/bash/grep/lsp/codegraph/…
93
+ ├── adapters/ # OpenAI-compat, Anthropic, Gemini, Ollama
94
+ ├── codegraph/ # Multi-language symbol indexer (NEW)
95
+ ├── lsp/ # LSP client (pyright, rust-analyzer, etc.) (NEW)
96
+ ├── sandbox/ # Process isolation (NEW)
97
+ ├── plugin/ # Plugin system (NEW)
98
+ ├── mcp/ # MCP client
99
+ ├── safety/ # Rule loader
100
+ ├── eval/ # 5-dimensional R-Metric evaluation
101
+ └── skills/ # Skill loader
102
+ ```
103
+
104
+ ---
105
+
106
+ ## Commands
107
+
108
+ ### Built-in (25+)
109
+
110
+ | Command | Description |
111
+ |---------|-------------|
112
+ | `/help` | Show all commands |
113
+ | `/model` | Switch model |
114
+ | `/plan` | Toggle plan mode |
115
+ | `/lsp` | LSP diagnostics & servers (NEW) |
116
+ | `/codegraph` | Code search & outline (NEW) |
117
+ | `/sandbox` | Isolation mode control (NEW) |
118
+ | `/chatstate` | ChatState diagnostics (NEW) |
119
+ | `/plugin` | Plugin management (NEW) |
120
+ | `/add` | Add file(s) to context |
121
+ | `/drop` | Remove file(s) |
122
+ | `/diff` | Show git diff |
123
+ | `/search` | Web search |
124
+ | `/web` | Fetch URL |
125
+ | `/git` | Git commands |
126
+ | `/commit` | Stage + commit |
127
+ | `/sessions` | List sessions |
128
+ | `/resume` | Resume session |
129
+ | `/replay` | Replay session |
130
+ | `/eval` | Evaluate session |
131
+ | `/cost` | Token usage |
132
+ | `/compact` | Compress context |
133
+ | `/undo` | Undo last tool |
134
+ | `/retry` | Retry last response |
135
+ | `/doctor` | Diagnose setup |
136
+ | `/checkpoint` | File snapshots |
137
+ | `/clear` | Clear conversation |
138
+
139
+ ### Agent Tools (21)
140
+
141
+ | Tool | Purpose |
142
+ |------|---------|
143
+ | `read_file` | Read file content |
144
+ | `write_file` | Create/overwrite file |
145
+ | `edit_file` | Targeted string replacement |
146
+ | `batch_edit` | Multi-file batch edit |
147
+ | `bash` | Shell commands |
148
+ | `grep` | Search file contents |
149
+ | `glob` | Find files by pattern |
150
+ | `list_dir` | List directory |
151
+ | `web_fetch` | Fetch web page |
152
+ | `search` | Web search |
153
+ | `read_image` | Read image content |
154
+ | `spawn_subagent` | Delegate sub-task |
155
+ | `todo_list` | Track progress |
156
+ | `lsp_diagnostics` | Code errors/warnings (NEW) |
157
+ | `lsp_hover` | Symbol info (NEW) |
158
+ | `lsp_goto_definition` | Jump to definition (NEW) |
159
+ | `codegraph_search` | Find symbols (NEW) |
160
+ | `codegraph_outline` | File structure (NEW) |
161
+ | `codegraph_index` | Build index (NEW) |
162
+ | `code_understanding` | Deep code analysis (NEW) |
163
+ | `project_analysis` | Project stats (NEW) |
164
+
165
+ ---
166
+
167
+ ## Comparison
168
+
169
+ ### vs Claude Code / Copilot
170
+
171
+ | Feature | zall | Claude Code |
172
+ |---------|------|------------|
173
+ | Hallucination detection | **Architectural** (PR-0) | Prompt-based |
174
+ | Reproducibility | Chain-hash + Replay | Log files only |
175
+ | Safety | 3-layer gate | Implicit |
176
+ | Model independence | 4 adapters (Protocol) | Anthropic-only |
177
+ | Code intelligence | LSP + CodeGraph | Limited |
178
+ | Sandbox isolation | Process/Worktree modes | None |
179
+ | Plugin system | Manifest-based | None |
180
+ | Open source | ✅ MIT | ❌ |
181
+
182
+ ---
183
+
184
+ ## Contributing
185
+
186
+ ```bash
187
+ git clone https://github.com/Qinrayn/zall.git
188
+ cd zall
189
+ pip install -e ".[dev,bs4]"
190
+ python -m pytest tests/
191
+ ```
192
+
193
+ See [CONTRIBUTING.md](.github/CONTRIBUTING.md) for guidelines.
194
+
195
+ ---
196
+
197
+ ## License
198
+
199
+ [MIT](LICENSE) © 2026 zall contributors
@@ -0,0 +1,95 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "zall"
7
+ version = "0.4.1"
8
+ description = "zall — a falsifiable, reproducible coding agent CLI. Model-agnostic, chain-hashed, replayable."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "MIT"
12
+ authors = [{ name = "zall contributors" }]
13
+ keywords = ["coding-agent", "cli", "ai", "llm", "developer-tools", "reproducible"]
14
+ classifiers = [
15
+ "Development Status :: 3 - Alpha",
16
+ "Environment :: Console",
17
+ "Intended Audience :: Developers",
18
+ "Operating System :: OS Independent",
19
+ "Programming Language :: Python :: 3.10",
20
+ "Programming Language :: Python :: 3.11",
21
+ "Programming Language :: Python :: 3.12",
22
+ "Programming Language :: Python :: 3.13",
23
+ "Topic :: Software Development :: Build Tools",
24
+ "Topic :: Software Development :: Debuggers",
25
+ ]
26
+ dependencies = [
27
+ "pydantic>=2.5",
28
+ "cryptography>=42",
29
+ "httpx>=0.24",
30
+ "rich>=13",
31
+ "prompt_toolkit>=3.0",
32
+ "tomli>=2.0; python_version < '3.11'",
33
+ "pyyaml>=6.0",
34
+ ]
35
+
36
+ [project.optional-dependencies]
37
+ dev = [
38
+ "pytest>=7.4",
39
+ "mypy>=1.7",
40
+ "ruff>=0.1",
41
+ "pytest-cov>=4.0",
42
+ ]
43
+ bs4 = [
44
+ "beautifulsoup4>=4.0",
45
+ ]
46
+ images = [
47
+ "pillow>=10.0",
48
+ ]
49
+ all = [
50
+ "zall[dev,bs4,images]",
51
+ ]
52
+
53
+ [project.urls]
54
+ Homepage = "https://github.com/qinrayn/zall"
55
+ Repository = "https://github.com/qinrayn/zall"
56
+ Documentation = "https://github.com/qinrayn/zall"
57
+ Issues = "https://github.com/qinrayn/zall/issues"
58
+
59
+ [project.scripts]
60
+ zall = "zall.cli:main"
61
+
62
+ [tool.setuptools.packages.find]
63
+ where = ["src"]
64
+
65
+ [tool.mypy]
66
+ strict = true
67
+ warn_unused_ignores = true
68
+ warn_redundant_casts = true
69
+ disallow_untyped_defs = true
70
+ disallow_any_generics = true
71
+ # 模型无关的 CI 即使是 mypy 检验也强约束 (见 IMPL.md IPR-3)
72
+
73
+ [tool.ruff]
74
+ line-length = 100
75
+ target-version = "py310"
76
+
77
+ [tool.ruff.lint]
78
+ # CI 将加自定义规则禁止 core/ 出现 openai / anthropic 等 import (IPR-3)
79
+ # 见 scripts/check_ipr3.py (实现层下轮)
80
+
81
+ [tool.pytest.ini_options]
82
+ testpaths = ["tests"]
83
+ addopts = "-v --tb=short"
84
+
85
+ [tool.coverage.run]
86
+ source = ["zall"]
87
+ omit = ["*/tests/*", "*/__pycache__/*"]
88
+
89
+ [tool.coverage.report]
90
+ exclude_lines = [
91
+ "pragma: no cover",
92
+ "if __name__ == .__main__.:",
93
+ "raise AssertionError",
94
+ "raise NotImplementedError",
95
+ ]
zall-0.4.1/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,7 @@
1
+ """zall — model-agnostic engineering agent.
2
+
3
+ Model-agnostic engineering agent. This package MUST NOT import any model SDK;
4
+ Model adapters reside in `zall.adapters`. See IMPL.md IPR-3.
5
+ """
6
+
7
+ __version__ = "0.2.7"
@@ -0,0 +1,3 @@
1
+ from zall.cli import main
2
+
3
+ raise SystemExit(main())
@@ -0,0 +1,15 @@
1
+ """zall._util — 内部共享toolfunction库。
2
+
3
+ 本包为 zall 内部使用的工具函数, 不构成 public API。
4
+ 各模块消除重复代码用 (B22/B23/B24 等)。
5
+ """
6
+
7
+ from zall._util.file import is_binary, read_text_file
8
+ from zall._util.path import NOISE_DIRS, is_noise, skip_noise_dirs
9
+ from zall._util.string import unquote
10
+
11
+ __all__ = [
12
+ "is_binary", "read_text_file",
13
+ "NOISE_DIRS", "is_noise", "skip_noise_dirs",
14
+ "unquote",
15
+ ]