Skip to content

refactor!: reorganize crate into domain modules and simplify LLM client API#16

Merged
tsharp merged 8 commits into
mainfrom
chore/cleanup-refactor
May 15, 2026
Merged

refactor!: reorganize crate into domain modules and simplify LLM client API#16
tsharp merged 8 commits into
mainfrom
chore/cleanup-refactor

Conversation

@tsharp
Copy link
Copy Markdown
Owner

@tsharp tsharp commented May 15, 2026

refactor!: reorganize crate into domain modules and simplify LLM client API

BREAKING CHANGE: removes the ChatClient wrapper struct, deletes all
src/bin/* demos, and moves several top-level modules into directory-based
submodules. Public re-exports are preserved where possible, but downstream
code constructing ChatClient or importing from the old paths must update.

  • refactor(llm)!: replace ChatClient wrapper with pub type LlmClient = Arc<dyn GenericChatClient>; agents now take the client via
    Agent::new(cfg).with_client(client) instead of with_llm_client
  • refactor(tools): consolidate tool.rs, tools/, and tool_loop_detection.rs
    into a single tools/ module (registry, native, mcp,
    loop_detection, builtin)
  • refactor(workflow): split workflow.rs + step.rs + step_impls.rs into
    workflow/{mod,step,steps/{agent,transform,conditional,subworkflow}}
  • refactor(context): split context.rs + context_strategies.rs into
    context/{mod,strategies/{token_budget,sliding_window,summarization, message_type}}
  • refactor(runtime): group runtime.rs, retry.rs, and timeout.rs under
    runtime/
  • refactor(agent,event): convert agent.rs and event.rs to directory
    modules with co-located tests.rs
  • fix(event): rename EventStream::from_offset -> get_from_offset to
    satisfy wrong_self_convention
  • chore: bump workspace to v0.4.0, add clippy.toml, Makefile.toml,
    rust-toolchain.toml
  • chore: drop src/bin/* demos (moved/retained via crates/agent-discourse)
  • docs(readme): rewrite as a concise crates.io-style overview with examples
    matching the new API
  • test: update all integration tests and benches to the new client API

@tsharp tsharp force-pushed the chore/cleanup-refactor branch from 2254119 to 8283f64 Compare May 15, 2026 22:26
tsharp added 5 commits May 15, 2026 15:27
Move `Workflow`, `WorkflowBuilder`, `Runtime`, `WorkflowContext`, `ContextManager` strategies, and all built-in `Step` implementations (`AgentStep`, `TransformStep`, `ConditionalStep`, `SubWorkflowStep`) behind a new `workflow` Cargo feature that is off by default.

The default build now contains only `Agent`, LLM clients, tools, events, config, and the retry/timeout utilities. Consumers that need the workflow executor must opt in: `agent-runtime = { version = \"0.4\", features = [\"workflow\"] }`.

* extract `Runtime` impl into `src/runtime/executor.rs`, gated on `workflow`; `src/runtime/mod.rs` now only re-exports it conditionally
* gate `pub mod context;`, `pub mod workflow;`, and all related re-exports + prelude entries in `src/lib.rs`
* disable `autotests` and declare each integration test target explicitly so workflow-only tests carry `required-features = [\"workflow\"]`
* gate Step-using unit tests in `src/types_test.rs` behind the feature
* mark `test_sliding_window_manager` `#[ignore]` documenting that `WorkflowBuilder::with_chat_history` is not yet wired through `build()`

BREAKING CHANGE: `Runtime`, `Workflow`, `WorkflowBuilder`, `WorkflowState`, `WorkflowContext`, `ContextManager`, all `*Manager` context strategies, the `Step` trait, and all `*Step` types are no longer available in the default build. Enable the `workflow` feature to restore them.
@tsharp tsharp merged commit b2017bc into main May 15, 2026
9 checks passed
@tsharp tsharp deleted the chore/cleanup-refactor branch May 15, 2026 23:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant