Skip to content

feat: add message module - #2

Merged
bobrykov merged 1 commit into
masterfrom
feat/add-message
May 4, 2026
Merged

feat: add message module#2
bobrykov merged 1 commit into
masterfrom
feat/add-message

Conversation

@bobrykov

@bobrykov bobrykov commented May 4, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Comprehensive messaging framework for agent interactions with user and assistant roles
    • Messages now support multiple content types: text, images (base64), tool calls, and multipart tool results
    • Human-readable display formatting for messages, roles, and tool results
    • Built-in serialization/deserialization for all message and result types
  • Chores

    • Library crate name updated to "loopctl"

@coderabbitai

coderabbitai Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f0c89dac-36a5-4b44-9b3d-261d76d7e662

📥 Commits

Reviewing files that changed from the base of the PR and between 17c50af and 10f39dc.

📒 Files selected for processing (3)
  • Cargo.toml
  • src/lib.rs
  • src/message.rs
✅ Files skipped from review due to trivial changes (1)
  • src/lib.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/message.rs

📝 Walkthrough

Walkthrough

Adds a new serializable conversation schema and related types (Message, MessagePart, Role, ToolResult, ImageSource) with constructors, Display impls, serde support, unit tests, and exports the message module from the crate root. Also renames the library in Cargo.toml from agentloop to loopctl.

Changes

Agent Message Framework

Layer / File(s) Summary
Data Shape
src/message.rs
Adds Message { role: Role, parts: Vec<MessagePart> }, Role enum (user/assistant), and MessagePart tagged enum variants (Text, Image, ToolCall, ToolResult) with serde derives.
Tool & Image Types
src/message.rs
Adds ImageSource (base64 encoding via new_base64), ToolResult (untagged: Text or Multipart), and ToolResultPart (text/image) with constructors and serde rules.
Methods & Predicates
src/message.rs
Implements constructors and helpers: Message::user/assistant/new, MessagePart::text/tool_call/tool_result, ToolResult::from_string/from_multipart, and predicates/accessors (is_text, is_tool_call, is_tool_result, as_text, is_string).
Display & Formatting
src/message.rs
Implements fmt::Display for Message, Role, and ToolResult; renders parts line-by-line, serializes tool-call input to JSON when possible, formats tool results and images human-readably.
Tests / Validation
src/message.rs
Adds unit tests covering constructors, predicates, ImageSource::new_base64, ToolResult conversions/display, and serde JSON round-trips for Message and Vec<MessagePart>.
Crate Export / Docs
src/lib.rs
Replaces crate-level placeholder docs with module documentation describing the trait-based agent-loop framework and publicly exports pub mod message;.
Manifest
Cargo.toml
Updates [lib].name from agentloop to loopctl.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐇 I hopped through structs, parts, and a test,

Base64 carrots tucked in my nest.
Tools chat and images gleam, neat and bright—
Messages line up, ready for flight.
— your rabbit, nibbling code by moonlight

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add message module' directly and accurately describes the main change: introducing a new message module with conversation message schema and related types.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/add-message

Review rate limit: 8/10 reviews remaining, refill in 10 minutes and 43 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/message.rs`:
- Around line 350-353: The doc comment references a non-existent intra-doc link
`crate::stream::DeltaContent::Text`; update the comment in src/message.rs to
remove the intra-doc link and use plain code text instead (e.g.,
DeltaContent::Text) so rustdoc stops resolving `crate::stream`. Locate the
comment around the doc for the assembled text and replace the `[`...`]` link
(`[`DeltaContent::Text`](crate::stream::DeltaContent::Text)`) with an inline
code mention like DeltaContent::Text.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: af503b73-c0db-4a2c-a245-9a2e676b719b

📥 Commits

Reviewing files that changed from the base of the PR and between 2c6709a and df1b609.

📒 Files selected for processing (2)
  • src/lib.rs
  • src/message.rs

Comment thread src/message.rs Outdated
@bobrykov
bobrykov force-pushed the feat/add-message branch from df1b609 to 17c50af Compare May 4, 2026 01:55
@bobrykov
bobrykov force-pushed the feat/add-message branch from 17c50af to 10f39dc Compare May 4, 2026 01:58
@bobrykov
bobrykov merged commit 8746fdb into master May 4, 2026
6 checks passed
@bobrykov
bobrykov deleted the feat/add-message branch July 1, 2026 06:35
bobrykov added a commit that referenced this pull request Aug 18, 2026
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