Commit Graph

7 Commits

Author SHA1 Message Date
DaiChaoXiong bf92590fcd chore(workspace): project-wide cleanup, dependency trimming, docs sync
deps: focus-core no longer depends on tokio at all (the core is fully
synchronous); workspace-level tokio drops the fat feature list, members
declare only what they use (transport: net/io-util/time, providers: rt/time)

code: remove dead AgentHandle (never constructed) and the dead
App::clamp_scroll; wire focus-harness' describe_plan into the TUI compaction
note (it was unused public API); clean a no-op replace_messages + confusing
comment in the compaction integration test

docs: AGENTS.md §2.2 tokio table reflects the new feature sets; README test
count 177→181, new env-var section (FOCUS_DATA_DIR / FOCUS_SHELL /
FOCUS_DEBUG_FILE), wheel + two-level expansion keybindings; add LICENSE (MIT,
matching Cargo.toml); TUI /help notes the two-level expansion and merged
tool blocks; delete the .VSCodeCounter artifact dir

verification: fmt, clippy -D warnings, 181 tests, workspace build all green
2026-08-09 23:14:21 +08:00
DaiChaoXiong 9a2d50ee58 fix(core): stream tool output live via ToolExecutionUpdate events
The agent passed None for on_update, so tools (e.g. shell) never forwarded
their incremental output — the UI only saw the final result. Now:

- EventSink: Send + Sync (the forwarding closure must satisfy ToolUpdateSink)
- ToolUpdateSink becomes lifetime-parameterized (bare trait-object aliases
  default to 'static, which forbade borrowing the caller's sink); all tool
  impls updated to &ToolUpdateSink<'_>
- Agent::execute_single forwards each tool update as a ToolExecutionUpdate
  event (Mutex provides interior mutability inside the Fn closure)
- TUI: running tools show the tail of the output live (newest lines), done
  tools show the head + remaining-line hint

regression test: a streaming tool's on_update texts appear as agent events in
order.
2026-08-09 22:55:16 +08:00
DaiChaoXiong 1d1f50d1b1 fix(providers): keep the API's real tool-call ids across turns
Multi-turn tool calls collided on replay: the reducer regenerated call_0,
call_1, ... every turn while ignoring the API's real call ids, so replayed
history had duplicate function_call/function_call_output ids that the API
cannot pair (visible once a conversation has two tool-using turns).

- ProviderEventReducer::tool_call_start_with_id(index, name, id) keeps the
  API's id; tool_call_start delegates with an auto-generated fallback
- Responses API: use item.call_id; Chat Completions: use tool_calls[].id
- regressions: real-log test asserts the captured ids, agent replay test
  asserts ids stay unique across three turns; reducer id-override test
2026-08-09 22:07:18 +08:00
DaiChaoXiong 112342c42e feat(core): agent message setters, thinking support, reducer arg-slot fix
- Agent::set_system_prompt / replace_messages (dynamic prompts + compaction)
- ProviderEventReducer::thinking_delta with per-block tracking
- fix: interleaved text/tool-call streams no longer misroute partial args
  (args aligned per content slot; regression tests added)
2026-08-09 20:59:39 +08:00
DaiChaoXiong 32b630e440 chore: remove focus-cli and obsolete provider sources
focus-cli is deleted entirely (the TUI will be a new crate later); the old
Anthropic/OpenAI/Zai provider sources and the core mock module are removed as
part of the rewrite.
2026-08-09 20:59:29 +08:00
DaiChaoXiong 5364ca004c ADD: 注释 2026-07-17 11:19:22 +08:00
DaiChaoXiong a7ddba035a INIT 2026-07-16 17:59:16 +08:00