From 4c266155785aad5050ebff7211e3d5f9e15c3238 Mon Sep 17 00:00:00 2001
From: Matthias Nott <mnott@mnsoft.org>
Date: Sun, 08 Mar 2026 07:37:45 +0100
Subject: [PATCH] feat: explicit session addressing + toast queue + solid toast styling

---
 contexts/ConnectionContext.tsx |   23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/contexts/ConnectionContext.tsx b/contexts/ConnectionContext.tsx
index f1fab69..ed245ba 100644
--- a/contexts/ConnectionContext.tsx
+++ b/contexts/ConnectionContext.tsx
@@ -23,10 +23,10 @@
   status: ConnectionStatus;
   connect: (config?: ServerConfig) => void;
   disconnect: () => void;
-  sendTextMessage: (text: string) => boolean;
-  sendVoiceMessage: (audioBase64: string, transcript?: string, messageId?: string) => boolean;
-  sendImageMessage: (imageBase64: string, caption: string, mimeType: string) => boolean;
-  sendCommand: (command: string, args?: Record<string, unknown>) => boolean;
+  sendTextMessage: (text: string, sessionId?: string) => boolean;
+  sendVoiceMessage: (audioBase64: string, transcript?: string, messageId?: string, sessionId?: string) => boolean;
+  sendImageMessage: (imageBase64: string, caption: string, mimeType: string, sessionId?: string) => boolean;
+  sendCommand: (command: string, args?: Record<string, unknown>, sessionId?: string) => boolean;
   saveServerConfig: (config: ServerConfig) => Promise<void>;
   onMessageReceived: React.MutableRefObject<
     ((data: WsIncoming) => void) | null
@@ -116,32 +116,33 @@
     setServerConfig(config);
   }, []);
 
-  const sendTextMessage = useCallback((text: string): boolean => {
-    return wsClient.send({ type: "text", content: text });
+  const sendTextMessage = useCallback((text: string, sessionId?: string): boolean => {
+    return wsClient.send({ type: "text", content: text, sessionId });
   }, []);
 
   const sendVoiceMessage = useCallback(
-    (audioBase64: string, transcript: string = "", messageId?: string): boolean => {
+    (audioBase64: string, transcript: string = "", messageId?: string, sessionId?: string): boolean => {
       return wsClient.send({
         type: "voice",
         content: transcript,
         audioBase64,
         messageId,
+        sessionId,
       });
     },
     []
   );
 
   const sendImageMessage = useCallback(
-    (imageBase64: string, caption: string = "", mimeType: string = "image/jpeg"): boolean => {
-      return wsClient.send({ type: "image", imageBase64, caption, mimeType });
+    (imageBase64: string, caption: string = "", mimeType: string = "image/jpeg", sessionId?: string): boolean => {
+      return wsClient.send({ type: "image", imageBase64, caption, mimeType, sessionId });
     },
     []
   );
 
   const sendCommand = useCallback(
-    (command: string, args?: Record<string, unknown>): boolean => {
-      const msg: WsOutgoing = { type: "command", command, args };
+    (command: string, args?: Record<string, unknown>, sessionId?: string): boolean => {
+      const msg: WsOutgoing = { type: "command", command, args, sessionId };
       return wsClient.send(msg as any);
     },
     []

--
Gitblit v1.3.1