refactor(core): own primary request preparation - #5300
Draft
Hmbown wants to merge 1 commit into
Draft
Conversation
Move the production MessageRequest DTO closure into codewhale-core while preserving the historical TUI path through compatibility re-exports. Route both the streaming turn loop and read-only preview through one pure primary-turn constructor, and prove its prepared body matches bytes sent by the production transport. Provider-specific dialect shaping and HTTP transport remain in the TUI for the next extraction slice. Agent assistance: implemented and independently reviewed with CodeWhale sub-agents. Refs #5261
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
ChatRequestscaffold incodewhale-corewith the productionMessageRequestDTO family previously owned by the TUI crate.prepare_primary_turn_requestconstructor for provider-neutral primary-turn defaults./preview-requestthrough that constructor.crate::models::*paths through compatibility re-exports, avoiding a flag-day migration.serde_json/preserve_orderin core and covers a deliberately non-alphabetic nested schema.crates/core+ Thread/Session split #5261 work.Why
The real request contract and defaulting lived in the TUI while
crates/core/src/request.rscontained an unused parallel model. That made the proposed headless/app-server boundary fictional and allowed production and preview construction to drift.This is the smallest production slice that gives core real ownership without dragging provider routing, secret handling, HTTP transport, or response decoding across the boundary prematurely.
Impact
There is no intended user-visible behavior change. Existing TUI consumers retain their type paths, while future headless/runtime work can depend on the actual provider-neutral request contract in core.
Evidence
cargo fmt --all -- --checkcargo clippy --workspace --all-targets --locked -- -D warningsOnly the existing macOS linker
__eh_framewarning appeared. Full workspace tests and release builds were not run for this focused slice.Follow-up boundary
Raw transport capture currently covers the DeepSeek Chat path. Anthropic Messages and OpenAI Responses raw capture, then provider-specific shaping/dispatch ownership, remain later #5261 slices.
Refs #5261
No-Issue: #5261 remains open because this is one verified extraction slice, not the full engine migration.