ata-coder 2.4.5__tar.gz → 2.4.7__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.
- {ata_coder-2.4.5 → ata_coder-2.4.7}/PKG-INFO +155 -3
- ata_coder-2.4.5/ata_coder.egg-info/PKG-INFO → ata_coder-2.4.7/README.md +972 -843
- {ata_coder-2.4.5 → ata_coder-2.4.7}/agent.py +39 -30
- ata_coder-2.4.7/agent_compact.py +159 -0
- ata_coder-2.4.5/README.md → ata_coder-2.4.7/ata_coder.egg-info/PKG-INFO +995 -820
- {ata_coder-2.4.5 → ata_coder-2.4.7}/ata_coder.egg-info/SOURCES.txt +2 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/config.py +7 -0
- ata_coder-2.4.7/context_manager.py +230 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/main.py +1 -1
- {ata_coder-2.4.5 → ata_coder-2.4.7}/memory.py +73 -20
- {ata_coder-2.4.5 → ata_coder-2.4.7}/pyproject.toml +1 -1
- {ata_coder-2.4.5 → ata_coder-2.4.7}/settings.py +101 -22
- {ata_coder-2.4.5 → ata_coder-2.4.7}/setup_wizard.py +20 -5
- {ata_coder-2.4.5 → ata_coder-2.4.7}/system_prompt_builder.py +94 -34
- {ata_coder-2.4.5 → ata_coder-2.4.7}/token_counter.py +79 -43
- ata_coder-2.4.5/agent_compact.py +0 -195
- {ata_coder-2.4.5 → ata_coder-2.4.7}/LICENSE +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/MANIFEST.in +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/__init__.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/agent_controller.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/agent_extension.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/agent_routing.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/agent_subsystems.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/agent_tools.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/agent_undo.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/anthropic_client.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/ata_coder.egg-info/dependency_links.txt +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/ata_coder.egg-info/entry_points.txt +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/ata_coder.egg-info/requires.txt +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/ata_coder.egg-info/top_level.txt +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/change_tracker.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/clawd_integration.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/commands/__init__.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/commands/_core.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/commands/_safety.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/commands/_settings.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/commands/_workflow.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/core/__init__.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/core/events.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/core/queue.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/core/state.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/event_queue.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/extension.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/extensions/__init__.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/extensions/hello_skill.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/fool_proof.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/git_workflow.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/gui.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/llm_client.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/mcp_client.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/model_registry.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/model_router.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/permissions.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/privilege.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/project.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/prompt_template.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/prompts/auto-mode.md +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/prompts/coding-rules.md +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/prompts/execution-guardrails.md +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/prompts/memory-system.md +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/prompts/output-style.md +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/prompts/safety.md +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/prompts/slash-commands.md +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/prompts/sub-agents.md +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/prompts/system-reminders.md +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/prompts/system.md +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/prompts/tool-policy.md +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/py.typed +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/repl_theme.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/repl_tracker.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/repl_ui.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/safety_guard.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/self_correct.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/server.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/server_session.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/server_shell.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/session.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/setup.cfg +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/skill_extension.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/skills/architect/SKILL.md +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/skills/code-reviewer/SKILL.md +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/skills/codecraft/SKILL.md +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/skills/debugger/SKILL.md +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/skills/doc-writer/SKILL.md +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/skills/general-coder/SKILL.md +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/skills/math-calculator/README.md +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/skills/math-calculator/SKILL.md +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/skills/math-calculator/handler.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/skills/math-calculator/prompts/system.md +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/skills/math-calculator/requirements.txt +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/skills/math-calculator/resources/constants.json +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/skills/math-calculator/tests/test_handler.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/skills/security-auditor/SKILL.md +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/skills/test-writer/SKILL.md +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/skills/weather-skill/README.md +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/skills/weather-skill/handler.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/skills/weather-skill/manifest.json +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/skills/weather-skill/prompts/system_prompt.txt +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/skills/weather-skill/prompts/user_prompt_template.txt +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/skills/weather-skill/requirements.txt +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/skills/weather-skill/resources/city_list.json +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/skills/weather-skill/resources/error_messages.json +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/skills/weather-skill/tests/test_handler.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/skills/weather-skill/weather_utils.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/skills.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/sub_agent.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/sub_agent_manager.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/task_planner.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/terminal.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/tests/test_agent.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/tests/test_change_tracker.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/tests/test_config.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/tests/test_event_queue.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/tests/test_extension.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/tests/test_fibonacci.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/tests/test_fool_proof.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/tests/test_llm_client.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/tests/test_memory.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/tests/test_model_registry.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/tests/test_permissions.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/tests/test_privilege.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/tests/test_prompt_template.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/tests/test_safety_guard.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/tests/test_server.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/tests/test_skill_handlers.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/tests/test_sub_agent.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/tests/test_tools.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/tools/__init__.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/tools/definitions.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/tools/executor.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/tools/result.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/tools/strategy.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/tools/subagent.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/tools/web.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/types.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/utils.py +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/web/css/style.css +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/web/index.html +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/web/js/app.js +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/web/package-lock.json +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/web/package.json +0 -0
- {ata_coder-2.4.5 → ata_coder-2.4.7}/web/tsconfig.json +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ata-coder
|
|
3
|
-
Version: 2.4.
|
|
3
|
+
Version: 2.4.7
|
|
4
4
|
Summary: ATA Coder — AI-powered coding assistant
|
|
5
5
|
Author: ATA Coder Team
|
|
6
6
|
License-Expression: MIT
|
|
@@ -21,13 +21,17 @@ Requires-Dist: pytest-timeout>=2.0; extra == "dev"
|
|
|
21
21
|
Requires-Dist: tiktoken>=0.5.0; extra == "dev"
|
|
22
22
|
Dynamic: license-file
|
|
23
23
|
|
|
24
|
-
# ATA Coder v2.4.
|
|
24
|
+
# ATA Coder v2.4.7
|
|
25
25
|
|
|
26
26
|
**AI-powered coding assistant — async, AST-aware, single config file.**
|
|
27
27
|
|
|
28
28
|
[English](#english) | [中文](#中文)
|
|
29
29
|
|
|
30
|
-
> **v2.4.
|
|
30
|
+
> **v2.4.7** — ⚡ **Context Memory Refactor**: O(1) token tracking, ContextManager, section-level prompt caching, pre-tokenized TF-IDF, LRU token cache. ~60% less overhead in the hot loop.
|
|
31
|
+
>
|
|
32
|
+
> > **v2.4.6** — 🔐 **OS-Native Credential Store**: API key encrypted at rest via Windows DPAPI / macOS Keychain / Linux secret-tool. Auto-migrates plaintext keys. Zero dependencies.
|
|
33
|
+
>
|
|
34
|
+
> > **v2.4.5** — 🤖 **Self-Bootstrapped Audit**: ATA Coder found 19 bugs in its own source code and fixed them all — thread safety, SSRF IPv6, rate limiter leak, auth hardening, DRY refactoring, CI coverage. 12 files changed.
|
|
31
35
|
>
|
|
32
36
|
> > **v2.4.4** — 🔒 **Security Hardening**: 19 fixes across safety, storage, and reliability.
|
|
33
37
|
>
|
|
@@ -310,6 +314,28 @@ curl -X POST http://localhost:8080/chat \
|
|
|
310
314
|
| **Token Budget** | Auto-compact at 200k effective tokens, force-truncate at 95% of 1M max |
|
|
311
315
|
| **Diff Preview** | `difflib.unified_diff` + Rich colored output before file writes |
|
|
312
316
|
|
|
317
|
+
### 🤖 v2.4.5 Self-Bootstrapped Audit
|
|
318
|
+
|
|
319
|
+
ATA Coder audited its own source code and found **19 bugs across 8 categories**. All self-found, all self-fixed. 12 files changed.
|
|
320
|
+
|
|
321
|
+
| # | Area | Detail |
|
|
322
|
+
|---|------|--------|
|
|
323
|
+
| 1 | 🐛 **Bug Fixes** | Test assertion sync, thread counter atomicity (Lock), rate limiter memory leak, MCP config clarity |
|
|
324
|
+
| 2 | 🔒 **Security** | Auto-generated API token for localhost, audit logging + CRITICAL hard blocks in allow-all, IPv6 SSRF (12 ranges) |
|
|
325
|
+
| 3 | 🔁 **DRY** | `create_llm_client()` factory, `_init_subsystem()` helper, sys.path.insert standardized |
|
|
326
|
+
| 4 | 🧱 **Quality** | extension.py Chinese→English, class attr types, `py.typed` marker, file cache 50→200 |
|
|
327
|
+
| 5 | 🧪 **CI** | Python 3.14 in matrix, skip reasons documented |
|
|
328
|
+
|
|
329
|
+
### 🔒 v2.4.4 Security Hardening
|
|
330
|
+
|
|
331
|
+
19 fixes across safety, storage, and reliability.
|
|
332
|
+
|
|
333
|
+
| # | Area | Detail |
|
|
334
|
+
|---|------|--------|
|
|
335
|
+
| 1 | 🛡️ **Safety** | Timing-safe auth comparison, path traversal hardening, shell argument escaping |
|
|
336
|
+
| 2 | 💾 **Storage** | Atomic session writes, surrogate-safe JSONL, corrupted file recovery |
|
|
337
|
+
| 3 | ⚡ **Reliability** | Subprocess pipe cleanup, thread cap enforcement, connection pool limits |
|
|
338
|
+
|
|
313
339
|
### 🧠 v2.4.3 Comprehensive Refactoring
|
|
314
340
|
|
|
315
341
|
60+ issues fixed across 15 files. Memory overhaul, unified token counting, safety pipeline unification.
|
|
@@ -526,6 +552,32 @@ All 6 findings in this release were discovered by **ATA Coder scanning its own s
|
|
|
526
552
|
|
|
527
553
|
## 中文
|
|
528
554
|
|
|
555
|
+
> **v2.4.7** — ⚡ **上下文记忆重构**: O(1) Token 追踪、ContextManager、章节级提示缓存、预分词 TF-IDF、LRU Token 缓存。热路径开销降低约 60%。
|
|
556
|
+
>
|
|
557
|
+
> > **v2.4.6** — 🔐 **操作系统凭据存储**: API Key 通过 Windows DPAPI / macOS Keychain / Linux secret-tool 加密存储。自动迁移明文密钥。零依赖。
|
|
558
|
+
>
|
|
559
|
+
> > **v2.4.5** — 🤖 **自举审计**: ATA Coder 审计自身源码发现 19 个 bug 并全部修复 — 线程安全、SSRF IPv6、速率限制器泄漏、认证加固、DRY 重构、CI 覆盖。12 个文件变更。
|
|
560
|
+
>
|
|
561
|
+
> > **v2.4.4** — 🔒 **安全加固**: 19 项修复,覆盖安全、存储与可靠性。
|
|
562
|
+
>
|
|
563
|
+
> > **v2.4.3** — 🧠 **全面重构**: 记忆系统重写、统一 Token 计数、安全管线、工具调用优化。修复 60+ 问题。
|
|
564
|
+
>
|
|
565
|
+
> > **v2.4.2** — 🐾 **Clawd 工作状态 + 窗口 Token**: Clawd 即时显示"工作中"。状态栏显示窗口 token (~120k) 而非累计值 (7.8M)。会话保存支持代理对安全。
|
|
566
|
+
>
|
|
567
|
+
> > **v2.4.1** — 🗂️ **三段哈希会话 ID + /resume**: 会话 ID: `xxxxxxxx-xxxxxxxx-xxxxxxxx`(工作区·时间戳·任务)。`/resume` 列出当前项目目录的会话。支持 8 位哈希恢复。
|
|
568
|
+
>
|
|
569
|
+
> > **v2.4.0** — 💾 **会话自动保存**: 每次对话自动保存至 `~/.ata_coder/sessions/`。基于哈希的会话 ID。通过哈希恢复: `ata --resume xxxxxxxx`。第 9 轮自修复。
|
|
570
|
+
>
|
|
571
|
+
> > **v2.3.11** — ⚡ **自举流式输出 + 崩溃修复**: ATA Coder 审计自身源码发现并修复 15 个 bug — 第 7.5 轮。实时 shell/web 输出、完整命令显示、子进程挂起修复、代理对崩溃修复。
|
|
572
|
+
>
|
|
573
|
+
> > **v2.3.10** — 🐛 **自举 Bug 猎手**: ATA Coder 扫描自身源码发现 25 个 bug,修复 18 个。信号量泄漏、命令注入、缺失导入、内存泄漏 — 第 7 轮闭环自修复。
|
|
574
|
+
>
|
|
575
|
+
> > **v2.3.6** — 🧹 代码质量审计: 版本同步、CI/CD、ruff/mypy 配置。
|
|
576
|
+
> > **v2.3.5** — 🤖 安全审计 v2: 23 项发现,20 项修复。认证、shell/RCE、CORS。
|
|
577
|
+
> > **v2.3.4** — 🤖 首次自举审计。
|
|
578
|
+
|
|
579
|
+
---
|
|
580
|
+
|
|
529
581
|
### 概述
|
|
530
582
|
|
|
531
583
|
ATA Coder 是一个命令行 AI 编码助手,兼容 OpenAI / Anthropic API。基于 **单线程 asyncio 事件循环** — 无线程、无竞态、低内存。配备确定性 AST 代码编辑、子 Agent 池、MCP 支持和内置 HTTP API 服务。
|
|
@@ -582,6 +634,55 @@ ata run "添加类型注解" # 单任务
|
|
|
582
634
|
ata server --port 8080 # API 服务
|
|
583
635
|
```
|
|
584
636
|
|
|
637
|
+
### 项目结构
|
|
638
|
+
|
|
639
|
+
```
|
|
640
|
+
ata_coder/
|
|
641
|
+
├── main.py # CLI 入口 (click) + asyncio.run()
|
|
642
|
+
├── agent.py # 核心 Agent: 异步运行循环 + 工具执行
|
|
643
|
+
├── agent_controller.py # asyncio.Task 编排器
|
|
644
|
+
├── agent_subsystems.py # 子系统容器 dataclass
|
|
645
|
+
├── core/ # 从 agent.py 提取
|
|
646
|
+
│ ├── events.py # AgentEvent dataclasses
|
|
647
|
+
│ └── state.py # AgentState dataclass
|
|
648
|
+
├── tools.py # 15 个内置工具
|
|
649
|
+
├── llm_client.py # OpenAI 兼容异步客户端 (httpx.AsyncClient)
|
|
650
|
+
├── anthropic_client.py # Anthropic Messages API 异步客户端
|
|
651
|
+
├── skills.py # 基于文件夹的 Skill 管理器
|
|
652
|
+
├── skill_extension.py # Skill → Extension 适配器
|
|
653
|
+
├── extension.py # 插件/扩展系统
|
|
654
|
+
├── sub_agent.py # asyncio.Task 子 Agent
|
|
655
|
+
├── sub_agent_manager.py # asyncio.Semaphore 并发池
|
|
656
|
+
├── event_queue.py # asyncio.Queue 事件总线
|
|
657
|
+
├── mcp_client.py # 异步 MCP (stdio + HTTP/SSE)
|
|
658
|
+
├── memory.py # 持久化文件记忆
|
|
659
|
+
├── session.py # 会话保存/加载/搜索
|
|
660
|
+
├── change_tracker.py # 文件变更撤销/重做
|
|
661
|
+
├── safety_guard.py # 基于模式的风险分析
|
|
662
|
+
├── fool_proof.py # 统一执行前安全检查
|
|
663
|
+
├── permissions.py # 交互式允许/拒绝规则
|
|
664
|
+
├── privilege.py # 操作系统感知权限提升
|
|
665
|
+
├── config.py # 运行时配置(仅读 settings.json)
|
|
666
|
+
├── settings.py # ~/.ata_coder/settings.json 持久化
|
|
667
|
+
├── self_correct.py # 错误诊断 + 自动修复(8 种模式)
|
|
668
|
+
├── system_prompt_builder.py
|
|
669
|
+
├── model_registry.py # 模型元数据 + 定价
|
|
670
|
+
├── model_router.py # 基于关键词的复杂度分类
|
|
671
|
+
├── commands.py # 斜杠命令注册表(~40 条命令)
|
|
672
|
+
├── repl_ui.py # Rich/prompt-toolkit REPL + diff 预览
|
|
673
|
+
├── server.py # HTTP API 服务 + SSE 流式
|
|
674
|
+
├── utils.py # 共享工具 + API 错误助手
|
|
675
|
+
├── prompt_template.py # {% if %} 模板引擎
|
|
676
|
+
├── task_planner.py # 任务分解
|
|
677
|
+
├── git_workflow.py # Git 集成
|
|
678
|
+
├── project.py # 项目自动检测
|
|
679
|
+
├── skills/ # 内置 Skill 文件夹
|
|
680
|
+
├── extensions/ # 插件目录
|
|
681
|
+
├── examples/ # 使用示例
|
|
682
|
+
├── tests/ # pytest 测试套件
|
|
683
|
+
└── README.md
|
|
684
|
+
```
|
|
685
|
+
|
|
585
686
|
### 配置
|
|
586
687
|
|
|
587
688
|
**settings.json 是唯一配置源。** 所有配置在 `~/.ata_coder/settings.json`:
|
|
@@ -603,6 +704,20 @@ ata server --port 8080 # API 服务
|
|
|
603
704
|
- 模型名自动剥离 `[1m]` 后缀
|
|
604
705
|
- API 错误自动附带友好修复建议
|
|
605
706
|
|
|
707
|
+
### 技能系统
|
|
708
|
+
|
|
709
|
+
Skill 存放在 `skills/<名称>/` 文件夹中,使用 `SKILL.md` 清单(YAML frontmatter + markdown 正文)。通过关键词匹配单 Skill 激活 — 无需额外 LLM 调用。
|
|
710
|
+
|
|
711
|
+
```
|
|
712
|
+
skills/weather-skill/
|
|
713
|
+
├── SKILL.md # name, version, triggers, tools, I/O spec
|
|
714
|
+
├── handler.py # Python 入口
|
|
715
|
+
├── utils.py # 辅助工具
|
|
716
|
+
├── prompts/ # LLM 提示模板
|
|
717
|
+
├── resources/ # 静态数据
|
|
718
|
+
└── tests/ # pytest 测试
|
|
719
|
+
```
|
|
720
|
+
|
|
606
721
|
### 常用命令
|
|
607
722
|
|
|
608
723
|
| 命令 | 说明 |
|
|
@@ -632,6 +747,43 @@ curl -N -X POST http://localhost:8080/chat/stream \
|
|
|
632
747
|
-d '{"message": "解释 async/await"}'
|
|
633
748
|
```
|
|
634
749
|
|
|
750
|
+
### 设计模式
|
|
751
|
+
|
|
752
|
+
| 模式 | 实现 |
|
|
753
|
+
|------|------|
|
|
754
|
+
| **异步 LLM** | `BaseLLMClient` ABC — `LLMClient` 和 `AnthropicClient` 使用 `httpx.AsyncClient` |
|
|
755
|
+
| **工具管线** | SafetyCheck → PermissionCheck → PrivilegeCheck → Execute → SelfCorrect |
|
|
756
|
+
| **AST 编辑** | libcst `CSTTransformer` — 解析、匹配、替换、保留格式 |
|
|
757
|
+
| **取消** | `asyncio.Task.cancel()` + `asyncio.CancelledError` — 无线程事件 |
|
|
758
|
+
| **并发** | `asyncio.Semaphore` 子 Agent 限制, `asyncio.gather()` 并行工具 |
|
|
759
|
+
| **事件总线** | `asyncio.Queue` — agent 任务生产, UI 任务消费 |
|
|
760
|
+
| **重试抖动** | LLM 客户端指数退避 + 随机抖动 |
|
|
761
|
+
| **熔断器** | 连续工具失败计数(5 次全失败批次 → 熔断) |
|
|
762
|
+
| **Token 预算** | 200k 有效 token 自动压缩, 1M 上限 95% 强制截断 |
|
|
763
|
+
| **Diff 预览** | `difflib.unified_diff` + Rich 彩色输出 |
|
|
764
|
+
|
|
765
|
+
### 🤖 v2.4.5 自举审计
|
|
766
|
+
|
|
767
|
+
ATA Coder 审计自身源码,发现 **8 大类 19 个 bug**。全部自发现、自修复。12 个文件变更。
|
|
768
|
+
|
|
769
|
+
| # | 领域 | 详情 |
|
|
770
|
+
|---|------|------|
|
|
771
|
+
| 1 | 🐛 **Bug 修复** | 测试断言同步、线程计数器原子性(Lock)、速率限制器内存泄漏、MCP 配置明晰 |
|
|
772
|
+
| 2 | 🔒 **安全** | localhost 自动生成 API token、allow-all 模式审计日志 + CRITICAL 硬阻断、IPv6 SSRF(12 段) |
|
|
773
|
+
| 3 | 🔁 **DRY** | `create_llm_client()` 工厂函数、`_init_subsystem()` 辅助函数、sys.path.insert 统一 |
|
|
774
|
+
| 4 | 🧱 **质量** | extension.py 中→英、类属性类型标注、`py.typed` 标记、文件缓存 50→200 |
|
|
775
|
+
| 5 | 🧪 **CI** | Python 3.14 加入矩阵、跳过原因已注明 |
|
|
776
|
+
|
|
777
|
+
### 🔒 v2.4.4 安全加固
|
|
778
|
+
|
|
779
|
+
19 项修复,覆盖安全、存储与可靠性。
|
|
780
|
+
|
|
781
|
+
| # | 领域 | 详情 |
|
|
782
|
+
|---|------|------|
|
|
783
|
+
| 1 | 🛡️ **安全** | 时序安全认证对比、路径穿越加固、shell 参数转义 |
|
|
784
|
+
| 2 | 💾 **存储** | 会话原子写入、代理对安全 JSONL、损坏文件恢复 |
|
|
785
|
+
| 3 | ⚡ **可靠性** | 子进程管道清理、线程上限执行、连接池限制 |
|
|
786
|
+
|
|
635
787
|
### 🧠 v2.4.3 全面重构
|
|
636
788
|
|
|
637
789
|
跨 15 个文件修复 60+ 问题。记忆系统重构、统一 Token 计算、安全管道优化、工具调用优化。
|