| chore(core): 清理 hook/agent 模块的未用导入与死字段
消除 atomcode-core 的 9 个编译 warning,纯清理、无行为变更:
- 移除未用 import:HookEngine(background/parallel_edit)、Arc(hook mod/built_in)、AsyncWebhookConfig(webhook)
- 删除从不读取的字段:AsyncWebhookBatcher.client(后台任务用自己的 clone)、SessionSummaryHook.start_time
- 删除 finish_turn 中算出却未用的 wd_str(白白获取一次读锁)
- TurnStatsHook::on_turn_start 未用参数 ctx → _ctx
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
| 6 天前 |
| feat: suppress Windows console windows & pass --client mode to daemon
- Add process_utils module with CREATE_NO_WINDOW helpers for Windows
- Apply suppress_console_window to all child process spawns (git, curl,
rg, find, LSP servers, MCP servers, hooks, bash tool, etc.)
- Add --client CLI arg to daemon, propagate SessionMode to API handlers
- Enhance build_api_system_prompt to align with TUI (instructions,
memory, git snapshot, platform rules, model identity)
- Bump vscode extension to 0.0.3
| 24 天前 |
| refactor(agent): drop file_read_counts re-read warning machinery
Completes the alignment started in 9339cf1 (which removed
detect_call_loop for the same reason). The post-turn
apply_post_turn_discipline warning was the last remaining
framework-side educational nudge — it injected a hard-toned
[You are stuck — STOP reading. Re-plan from scratch...] user
message whenever the same 50-line region was read 2+ times in a
single user request.
Why remove rather than soften:
- The warning text confused weak models (GLM-5.1, Qwen-Coder)
into thinking read_file was being denied, prompting them to
fall back to cat/head/sed via bash to "bypass the block"
— the exact symptom in the user-reported regression.
- The threshold (>= 2) and bucket size (50 lines) are too
aggressive for normal exploration: read a function, read the
caller, both land in the same bucket if offsets are close.
- Same design philosophy 9339cf1 codified: "CC has zero
tool-loop blockers ... the model is trusted to read its own
previous outputs." This warning was the same shape of
framework intervention 9339cf1 explicitly rejected.
- pr_119 just merged tried to half-disable this by clearing the
counter every turn — leaving dead code that maintainers would
later wonder about. Cleaner to delete.
Removed:
- DisciplineState::file_read_counts field + clear() at
user-message boundary
- apply_post_turn_discipline function + its call site in
AgentLoop::run
- READ_REGION_BUCKET constant
- read_region_key + transitive helpers
(read_file_key, canonical_or_lexical_path_key,
expand_home_for_loop_key, lexical_normalize_for_loop_key)
- The increment site in the agent's tool-event closure +
working_dir_for_read_counts plumbing
- Stale Path/PathBuf import on runner.rs
Kept:
- files_read_this_turn (used elsewhere for Working Set)
- targeted_read_count (different mechanism, still tracked)
- check_step_limit 200-call hard cap (cost protection only)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
| 28 天前 |
| feat: add Ctrl+O verbose mode to show reasoning and tool output
- Add ReasoningDelta event to TurnEvent and AgentEvent for streaming model thinking content (DeepSeek-R1, MiniMax-M2.7, o1-series, etc.)
- Forward ReasoningDelta through AgentLoop to TUI
- Add show_reasoning state to UiState, toggled together with show_tool_output
- Update Ctrl+O hint messages to indicate verbose mode (reasoning + tool output)
- Handle ReasoningDelta in CLI verbose mode and daemon ChatEvent
Closes #171
| 1 个月前 |
| feat: suppress Windows console windows & pass --client mode to daemon
- Add process_utils module with CREATE_NO_WINDOW helpers for Windows
- Apply suppress_console_window to all child process spawns (git, curl,
rg, find, LSP servers, MCP servers, hooks, bash tool, etc.)
- Add --client CLI arg to daemon, propagate SessionMode to API handlers
- Enhance build_api_system_prompt to align with TUI (instructions,
memory, git snapshot, platform rules, model identity)
- Bump vscode extension to 0.0.3
| 24 天前 |
| feat: suppress Windows console windows & pass --client mode to daemon
- Add process_utils module with CREATE_NO_WINDOW helpers for Windows
- Apply suppress_console_window to all child process spawns (git, curl,
rg, find, LSP servers, MCP servers, hooks, bash tool, etc.)
- Add --client CLI arg to daemon, propagate SessionMode to API handlers
- Enhance build_api_system_prompt to align with TUI (instructions,
memory, git snapshot, platform rules, model identity)
- Bump vscode extension to 0.0.3
| 24 天前 |
| feat(undo): UndoToPrompt command + ConversationTruncated/UndoFailed events
Agent truncates the authoritative conversation and replies; TUI persists the
truncated session, replays scrollback, and refills the input box.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
| 1 天前 |
| chore(core): 清理 hook/agent 模块的未用导入与死字段
消除 atomcode-core 的 9 个编译 warning,纯清理、无行为变更:
- 移除未用 import:HookEngine(background/parallel_edit)、Arc(hook mod/built_in)、AsyncWebhookConfig(webhook)
- 删除从不读取的字段:AsyncWebhookBatcher.client(后台任务用自己的 clone)、SessionSummaryHook.start_time
- 删除 finish_turn 中算出却未用的 wd_str(白白获取一次读锁)
- TurnStatsHook::on_turn_start 未用参数 ctx → _ctx
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
| 6 天前 |
| fix(prompt,ctx): Plan Mode 与压缩摘要移出 system,保住前缀缓存
承接会话级 system 冻结(3cda63dc)。litellm 线上 175 对 system 断裂抽样
归类 + 逐字节 diff 证据(systemA/B/D):冻结 build_system_prompt 还不够,
有两处动态内容仍进了 system 第0条。
== systemA:Plan Mode 指令进 system(占 system 断裂 12%) ==
prompt.rs 在 plan_mode 时往 system 注入整段 "=== PLAN MODE (ACTIVE) ===";
中途切换 plan mode 就重写 messages[0]、整会话缓存归零。
修复:从 system 删除该段;改为在 AgentCommand::SetPlanMode 状态切换时,
通过 add_synthetic_user_message 往历史注入一次说明(进入/退出各一条),
system 保持会话级常量;read-only 工具门控(use_read_only)继续每轮强制约束。
不再在 SetPlanMode 里失效 cached_system_prompt。
== systemB:压缩摘要被合并器折进 messages[0] ==
cold_summaries / 溢出 digest 原以 Role::System push(render.rs),被
clean_message_pipeline 的"合并连续 system 消息"折进 messages[0] → 每次压缩
连 ~16K system 前缀一起失效。改成 Role::User:合并器不再污染 messages[0],
冻结的 system 跨压缩字节稳定。影响:摘要现以 user 角色呈现(标注
"[Earlier conversation history…]"/"[Context overflow…]"),会并入相邻 user
消息;压缩时仍从 messages[1] 断一次(历史确实变了,不可避免),但 system
前缀保住。truncate(cold_msgs)/microcompact 的位置逻辑与角色无关,已验证。
未处理(下游已确认、单独任务):systemC/E —— 主/子 agent、工具型短请求共用
session_id(约占 system 断裂 22%),非改写 bug,需独立缓存归属,另议。
回归测试:
- agent/mod.rs::plan_mode_is_not_in_system_prompt(plan_mode 不进 system 且
不改变 system 一个字节)。
- ctx/render.rs::test_no_consecutive_system_messages_after_compression(更新:
断言摘要不在 system、改骑在 user 消息上)。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
| 1 天前 |
| fix(prompt): 冻结会话级 system 提示 + 锁定 assistant 序列化确定性,稳住前缀缓存
Part 2,承接 read_file 历史冻结(86e73592)。线上 920 个"好轮→坏轮"逐字节
比对:system(第0条)占缓存塌缩 19.8%,assistant 历史占被改写消息 23.3%。
== A. system 提示逐轮改写(已修) ==
build_system_prompt 每轮用 live 输入重建:working_dir 在模型每次 cd
(tool/cd.rs、tool/bash.rs 直接写 working_dir)后变化、被插进 4 行
(SCOPE/CONFIG/Working directory);plan_mode 切换增删 PLAN MODE 段;
memory / layered-instructions 每轮重读磁盘。system 是 messages[0],变 1 字节
整条会话缓存归零。
修复:会话级冻结——build_system_prompt 首轮 assemble 后缓存,后续原样复用;
仅在显式契约边界失效重建(SetPlanMode / ClearConversation / ReloadConfig /
change_dir 即 /cd)。模型自己的 cd 工具不失效——最新 cwd 仍通过 cd/bash
工具结果到达模型,冻结 system 不致盲。hook 扩展仍每轮收集(行为不变),但冻结后
只在冷缓存(首建/失效后)被消费;刻意保持无条件收集,避免某构建路径(如
RefreshContextStats)在 SystemPromptHook 收集前抢先冻结。
== B. assistant 历史重新序列化(排查结论:openai 路径本就确定,无需改) ==
provider/openai.rs format_messages 复用存储的 tool_call.arguments 原始字符串
(不重新 stringify)、serde_json 键序确定、无任何按 recency 裁剪历史
reasoning_content 的逻辑。故 deepseek-v4(Include)下历史 assistant 序列化
本就逐字节稳定;23.3% 主要是 system/tool 断点后的下游位移。加测试锁死该不变量
防回归(有人重编码 args / 重排键 / 裁剪历史 reasoning)。
回归测试:
- agent/mod.rs::system_prompt_is_frozen_across_model_cwd_change
改 working_dir 后 system 逐字节不变;显式失效后重建并反映新 cwd。
- provider/openai.rs::format_messages_is_deterministic_and_prefix_stable
同输入两轮字节一致;会话增长后旧前缀消息序列化不变。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
| 1 天前 |
| fix(subtask_driver): include Chinese punctuation in extract_from_plan splitter
2026-05-03 atomgr datalog showed deepseek-v4-flash produced this turn-3
plan text:
现在逐一处理 4 个文件。先处理 constants.rs 和 types.rs,它们已经
有一些中文注释但不够完整。platform.rs 和 mod.rs 也需要补全。
The splitter only honoured ASCII punct, so types.rs,它们已经...完整。platform.rs
collapsed into one giant token ending in .rs — passed is_source_file
and was added as a single "filename" that doesn't exist on disk.
try_sub_agent_dispatch then read the bogus path, file lookup failed,
and the dispatcher silently fell back to serial mode. User sees
sub-agent dispatch never trigger despite all conditions being
conceptually met.
Add the 14 most common Chinese full-width punctuation chars (, 。
、 ; : ( ) 《》 「」 ? ! —) plus [ ] to
the splitter. Now 4 files extract cleanly from the example.
Regression test pins the exact failing sentence from datalog so future
splitter changes can't reintroduce the regression.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
| 1 个月前 |
| feat(tuix): light/dark theme switch with OSC 11 auto-detection
UI palette now adapts to the terminal's background colour. Adds a
[ui] theme config field ("auto" default, "light", "dark"),
re-routes the markdown / syntect / pill SGR layer through runtime
accessors instead of compile-time constants, and ships a second
contrast-corrected palette designed for #FFFFFF backgrounds.
Auto-detection (UiTheme::Auto):
- After raw mode is on, write OSC 11 \x1b]11;?\x07 to stdout.
- libc::poll on stdin with a 100ms budget.
- Parse rgb:RRRR/GGGG/BBBB, compute Rec. 709 luminance, > 128/255
→ light.
- No response (Mac Terminal.app, Windows conhost, OSC-stripping SSH
relay) → silently fall back to dark; matches the legacy behaviour.
highlight/theme.rs: 10 token-colour constants become atomic-backed
accessor fns; close codes / bold / italic / muted stay const because
they're attribute toggles, not colours. highlight/mod.rs: syntect
Theme is built per palette and cached in two OnceLock<Theme>s
selected at call time.
Light palette RGB values are picked for ≥ 4.5:1 WCAG AA contrast on
#FFFFFF. The screenshot trigger — fn main rendering the main
identifier invisible because of the old #61AFEF (2.04:1) — now uses
#0D47A1 (8.8:1).
Pill SGR (session-name badge on input box top rule) adapts too:
dark stays at \x1b[7;96m (reverse + bright cyan); light switches
to \x1b[1;35m (bold + standard magenta) — the reverse-cyan chip
turns into pale-aqua-on-white in light terminal profiles and the
chip disappears, the no-reverse bold-magenta form stays readable.
Includes 12 OSC 11 parser tests (pure-white/black, 8-bit/16-bit
emulator variants, ST vs. BEL terminators, leading-garbage tolerance,
threshold boundaries, Rec. 709 weighting verification) plus 13 new
theme palette tests. All 26 highlight + 40 markdown + 206 render
tests pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
| 14 天前 |
| refactor(agent): 代码格式化与可读性优化
主要改进:
- 统一链式方法调用格式,提升可读性
- 优化复杂条件判断的换行与缩进
- 改进数组/向量初始化的格式化风格
- 规范错误检查逻辑的代码布局
涉及模块:
- diagnose: 诊断错误检测逻辑
- execute: 命令执行流程
- tool_dispatch: 工具调度处理
- subtask_driver: 子任务驱动
- verify: 结果验证
- mod: 核心agent循环
- services: 服务管理
- git_checkpoint: Git检查点
- prompt/discipline: 辅助模块
总修改:11个文件,+965/-347行
| 1 个月前 |