Commit Graph

3 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 8ed56c3952 feat(providers): rewrite Anthropic and OpenAI providers
- Anthropic Messages API (2023-06-01) SSE streaming: text/thinking/tool_use
  blocks, cache usage, stop-reason mapping, errors encoded as events
- OpenAI Responses API + Chat Completions (switchable), tool_calls delta
  accumulation, include_usage, reasoning_content -> thinking
- ProviderConfig with base_url/api_key/context_window/timeout; known-model
  context-window table with three-layer resolution
- background current-thread runtime bridges sync agent loop to async I/O
- mock-transport replay tests (chunks straddle SSE boundaries) + full agent
  integration test
2026-08-09 20:59:49 +08:00