feat: StreamingMessageTracker + AgentProtocol (#14, #23) #130

Closed
charles wants to merge 8 commits from feat/14-23-streaming-protocol into main
Owner

Closes #14
Closes #23

Summary

  • streaming.rsStreamingMessageTracker backed by DashMap<String, StreamState>. Handles on_edit with 30 s stream window, strips the animated cursor from the body, returns UpdateInPlace for known agents and NormalEdit otherwise. is_streaming, register_message, mark_complete, and gc are all provided.
  • protocol.rsAgentProtocol async trait (agent_type, get_capabilities, get_status); AgentStatus enum (Active/Idle/Unavailable); MatrixAgentProtocol (always Active); OpenClawProtocol; OpenClawResponseParser (extracts/strips <!-- meta --> JSON blocks).
  • detector.rs — added AgentDetector::with_defaults(HashSet<String>) convenience constructor and made is_agent public with Option<bool> bot-flag (used by the streaming tracker when only the sender ID is available).
  • Workspace Cargo.toml — added dashmap = "6" and regex = "1" to [workspace.dependencies].
  • fractal-ai/Cargo.toml — switched dashmap and regex to { workspace = true }.
  • lib.rs — re-exports all new public types.

Test plan

  • cargo test -p fractal-ai — all unit tests pass (streaming + protocol + detector)
  • StreamingMessageTracker::on_edit with unknown sender returns NormalEdit
  • StreamingMessageTracker::on_edit with @my-bot:matrix.org returns UpdateInPlace
  • Cursor is stripped from body and show_cursor = true
  • is_streaming returns false after mark_complete
  • OpenClawResponseParser::parse_meta extracts model/token fields from <!-- meta --> block
  • MatrixAgentProtocol::get_status returns Active

🤖 Generated with Claude Code

Closes #14 Closes #23 ## Summary - **`streaming.rs`** — `StreamingMessageTracker` backed by `DashMap<String, StreamState>`. Handles `on_edit` with 30 s stream window, strips the animated `▋` cursor from the body, returns `UpdateInPlace` for known agents and `NormalEdit` otherwise. `is_streaming`, `register_message`, `mark_complete`, and `gc` are all provided. - **`protocol.rs`** — `AgentProtocol` async trait (`agent_type`, `get_capabilities`, `get_status`); `AgentStatus` enum (`Active`/`Idle`/`Unavailable`); `MatrixAgentProtocol` (always `Active`); `OpenClawProtocol`; `OpenClawResponseParser` (extracts/strips `<!-- meta -->` JSON blocks). - **`detector.rs`** — added `AgentDetector::with_defaults(HashSet<String>)` convenience constructor and made `is_agent` public with `Option<bool>` bot-flag (used by the streaming tracker when only the sender ID is available). - **Workspace `Cargo.toml`** — added `dashmap = "6"` and `regex = "1"` to `[workspace.dependencies]`. - **`fractal-ai/Cargo.toml`** — switched `dashmap` and `regex` to `{ workspace = true }`. - **`lib.rs`** — re-exports all new public types. ## Test plan - [ ] `cargo test -p fractal-ai` — all unit tests pass (streaming + protocol + detector) - [ ] `StreamingMessageTracker::on_edit` with unknown sender returns `NormalEdit` - [ ] `StreamingMessageTracker::on_edit` with `@my-bot:matrix.org` returns `UpdateInPlace` - [ ] Cursor `▋` is stripped from body and `show_cursor = true` - [ ] `is_streaming` returns false after `mark_complete` - [ ] `OpenClawResponseParser::parse_meta` extracts model/token fields from `<!-- meta -->` block - [ ] `MatrixAgentProtocol::get_status` returns `Active` 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(fractal-ai): add AgentProtocol trait, MatrixAgentProtocol, OpenClawProtocol (#23)
Some checks are pending
CI / cargo check (pull_request) Waiting to run
CI / cargo test (pull_request) Blocked by required conditions
CI / clippy + rustfmt (pull_request) Waiting to run
01d49fdd3d
feat(fractal-ai): expose protocol and streaming modules in lib.rs (#14, #23)
Some checks are pending
CI / cargo check (pull_request) Waiting to run
CI / cargo test (pull_request) Blocked by required conditions
CI / clippy + rustfmt (pull_request) Waiting to run
48456507fd
feat(ai): StreamingExtension — Extension trackant les m.replace agents (#14)
Some checks are pending
CI / cargo check (pull_request) Waiting to run
CI / cargo test (pull_request) Blocked by required conditions
CI / clippy + rustfmt (pull_request) Waiting to run
0dc2b343de
charles changed title from feat(ai): StreamingMessageTracker + AgentProtocol trait (#14, #23) to feat: StreamingMessageTracker + AgentProtocol (#14, #23) 2026-04-06 02:14:08 +00:00
feat(ai): export streaming_ext module (#14)
Some checks failed
CI / cargo check (pull_request) Has been cancelled
CI / cargo test (pull_request) Has been cancelled
CI / clippy + rustfmt (pull_request) Has been cancelled
36afc17757
charles closed this pull request 2026-04-06 02:17:21 +00:00
Some checks are pending
CI / cargo check (pull_request) Has been cancelled
CI / cargo test (pull_request) Has been cancelled
CI / clippy + rustfmt (pull_request) Has been cancelled
qa
Required

Pull request closed

Sign in to join this conversation.
No description provided.