feat(sessions): route chat messages through the intent-aware backend entry point

Replace the chat window's unconditional create-session-then-send flow
with a single call to the new POST /sessions/messages endpoint: a
plain "salut ça va ?" no longer starts a fake training session, since
the backend's intent router decides that now.

Add sessions.routeMessage to the IPC/preload surface and the sessions
HTTP client. useSessionStore.sendMessage only sets sessionId/status
(fetched fresh via sessions:get) when the backend actually reports
type: "learn". The stepper-window-open + status-broadcast trigger in
main/index.ts moves from sessions:create's handler to
sessions:route-message's, since session creation now happens inside
the backend's routing logic rather than via an explicit prior call.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
william
2026-11-01 09:02:39 +01:00
co-authored by Claude Sonnet 5
parent ce25d3f290
commit 7179743d4e
9 changed files with 160 additions and 44 deletions
+2
View File
@@ -3,6 +3,7 @@ import type { VoiceTurnResult } from '../shared/voice'
import type { AuthStatus, LoginResult } from '../shared/auth'
import type {
ObjectiveMessageResponse,
RouteMessageResponse,
SessionObjectiveResponse,
SessionResponse,
SessionStatus
@@ -13,6 +14,7 @@ export interface SessionsApi {
get: (id: number) => Promise<SessionResponse>
sendObjectiveMessage: (id: number, message: string) => Promise<ObjectiveMessageResponse>
confirmObjective: (id: number) => Promise<SessionObjectiveResponse>
routeMessage: (message: string) => Promise<RouteMessageResponse>
}
export interface ForgeAvatarApi {