Skip to content

feat: core types added - #12

Merged
bobrykov merged 1 commit into
masterfrom
feat/types
May 5, 2026
Merged

feat: core types added#12
bobrykov merged 1 commit into
masterfrom
feat/types

Conversation

@bobrykov

@bobrykov bobrykov commented May 5, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@coderabbitai

coderabbitai Bot commented May 5, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7fc8ef53-d883-49e2-a0bd-3896c1aa30b4

📥 Commits

Reviewing files that changed from the base of the PR and between acc14c7 and 805b539.

📒 Files selected for processing (2)
  • src/core.rs
  • src/core/types.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/core/types.rs

📝 Walkthrough

Walkthrough

Adds a new public types module defining agent config, lifecycle state, turn/session results, tool call primitives, and a correction/reflection system, then re-exports those types from src/core.rs, and updates module-level documentation to list the new exported types.

Changes

Core Type System Definition and Export

Layer / File(s) Summary
Data Shapes & Defaults
src/core/types.rs
Adds AgentConfig (public fields, Default uses Uuid::new_v4()), AgentState, CompactReason, StopReason, TurnResult, ToolCall, ToolCallResult, SessionResult, Correction, CorrectionType (serde snake_case), and CorrectionResult.
Convenience Methods / Semantics
src/core/types.rs
Adds constructors and helpers: TurnResult::completed/continuing, TurnResult::has_tool_calls, TurnResult::total_tokens(&self), SessionResult::success/failed, SessionResult::total_tokens(&self).
Serialization / Derives
src/core/types.rs
Derives Serialize/Deserialize and other traits for persistence/IPC across relevant enums/structs (e.g., ToolCall, Correction, CorrectionType, CorrectionResult).
Module Export & Docs
src/core.rs
Adds pub mod types; and pub use types::*;, and updates the module-level documentation table to include CompactReason, CorrectionType, and CorrectionResult.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive No pull request description was provided by the author, making it impossible to assess whether a description relates to the changeset. Add a meaningful pull request description explaining the purpose and scope of the new types module and its types (AgentConfig, TurnResult, SessionResult, etc.).
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: core types added' accurately reflects the main changeset, which introduces a new types module with multiple data model definitions for the agent framework.
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/types

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

🧹 Nitpick comments (1)
src/core/types.rs (1)

494-495: ⚡ Quick win

Use &self in total_tokens accessors instead of taking ownership.

Lines 494 and 775 in src/core/types.rs consume the value for a read-only operation, which is non-idiomatic and forces unnecessary moves. Change both methods to take &self.

Proposed diff
-    pub fn total_tokens(self) -> u64 {
+    pub fn total_tokens(&self) -> u64 {
         self.input_tokens.saturating_add(self.output_tokens)
     }
-    pub fn total_tokens(self) -> u64 {
+    pub fn total_tokens(&self) -> u64 {
         self.input_tokens.saturating_add(self.output_tokens)
     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/core/types.rs` around lines 494 - 495, Change the accessor signatures
that currently take ownership to borrow instead: update pub fn
total_tokens(self) -> u64 to pub fn total_tokens(&self) -> u64 and do the same
for any other read-only accessors in the same module that use self by value;
inside the method keep using
self.input_tokens.saturating_add(self.output_tokens) and then update callers to
pass a reference (or clone if an owned value is required) so you no longer move
the struct for a read-only operation.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/core.rs`:
- Around line 18-25: The "Supporting Types" documentation table is out of sync
with the public API exported by pub use types::*; — update the table that
currently lists AgentConfig, AgentState, TurnResult, SessionResult, StopReason,
ToolCall, ToolCallResult, and Correction to include all additional public types
exported from the types module so docs match the actual API; locate the table
near the top-level module docs (the block showing the vertical table of
supporting types) and add entries for each missing exported symbol (keep the
existing entries and append the new type names with brief descriptions
consistent with the table format).

---

Nitpick comments:
In `@src/core/types.rs`:
- Around line 494-495: Change the accessor signatures that currently take
ownership to borrow instead: update pub fn total_tokens(self) -> u64 to pub fn
total_tokens(&self) -> u64 and do the same for any other read-only accessors in
the same module that use self by value; inside the method keep using
self.input_tokens.saturating_add(self.output_tokens) and then update callers to
pass a reference (or clone if an owned value is required) so you no longer move
the struct for a read-only operation.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5cb22ed4-eca9-4c06-b889-4ffa92c0eebf

📥 Commits

Reviewing files that changed from the base of the PR and between 8abf327 and acc14c7.

📒 Files selected for processing (2)
  • src/core.rs
  • src/core/types.rs

Comment thread src/core.rs
@bobrykov
bobrykov merged commit f997fed into master May 5, 2026
6 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request May 13, 2026
@bobrykov
bobrykov deleted the feat/types 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