feat(M4-007,M4-008,M4-012): wire routing engine into ChatGateway, add /model override and transparency
Some checks failed
ci/woodpecker/push/ci Pipeline failed
ci/woodpecker/pr/ci Pipeline failed

M4-012: In ChatGateway.handleMessage(), call routingEngine.resolve() before
creating a new agent session when no explicit provider/model is supplied.
The routing decision's provider/model are passed to AgentService.createSession().

M4-007: Add sticky per-session /model override via ChatGateway.setModelOverride().
When active, the routing engine is bypassed entirely. CommandExecutorService
handleModel() is updated to set/clear the override. /model clear resets to
automatic routing. /model with no args shows the current override or usage hint.

M4-008: Include routingDecision in the session:info socket event.
Add RoutingDecisionInfo to SessionInfoPayload in @mosaic/types.
useSocket() tracks the routing decision in state and the BottomBar TUI component
displays a "Routed: <model> (<reason>)" line when a routing decision is present.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-22 19:48:06 -05:00
parent f22ce0096b
commit 7bf2ad1f92
6 changed files with 116 additions and 4 deletions

View File

@@ -74,6 +74,14 @@ export interface ChatMessagePayload {
agentId?: string;
}
/** Routing decision summary included in session:info for transparency */
export interface RoutingDecisionInfo {
model: string;
provider: string;
ruleName: string;
reason: string;
}
/** Session info pushed when session is created or model changes */
export interface SessionInfoPayload {
conversationId: string;
@@ -81,6 +89,8 @@ export interface SessionInfoPayload {
modelId: string;
thinkingLevel: string;
availableThinkingLevels: string[];
/** Present when automatic routing determined the model for this session */
routingDecision?: RoutingDecisionInfo;
}
/** Client request to change thinking level */

View File

@@ -9,6 +9,7 @@ export type {
ToolEndPayload,
SessionUsagePayload,
SessionInfoPayload,
RoutingDecisionInfo,
SetThinkingPayload,
ErrorPayload,
ChatMessagePayload,