From a0f39302919fbacf7a0d407f01b1a50413ea6f70 Mon Sep 17 00:00:00 2001
From: Matthias Nott <mnott@mnsoft.org>
Date: Mon, 02 Mar 2026 23:15:13 +0100
Subject: [PATCH] feat: on-device speech recognition, navigation screen, session picker

---
 types/index.ts |   80 ++++++++++++++++++++++++++++++++++++++-
 1 files changed, 77 insertions(+), 3 deletions(-)

diff --git a/types/index.ts b/types/index.ts
index fe5754d..aae0ecd 100644
--- a/types/index.ts
+++ b/types/index.ts
@@ -1,5 +1,5 @@
 export type MessageRole = "user" | "assistant" | "system";
-export type MessageType = "text" | "voice";
+export type MessageType = "text" | "voice" | "image";
 
 export interface Message {
   id: string;
@@ -7,6 +7,7 @@
   type: MessageType;
   content: string;
   audioUri?: string;
+  imageBase64?: string;
   timestamp: number;
   status?: "sending" | "sent" | "error";
   duration?: number;
@@ -19,8 +20,81 @@
 
 export type ConnectionStatus = "disconnected" | "connecting" | "connected";
 
-export interface WebSocketMessage {
-  type: "text" | "voice";
+// --- WebSocket protocol ---
+
+/** Outgoing from app to watcher */
+export interface WsTextMessage {
+  type: "text";
+  content: string;
+}
+
+export interface WsVoiceMessage {
+  type: "voice";
+  audioBase64: string;
+  content: string;
+}
+
+export interface WsCommandMessage {
+  type: "command";
+  command: string;
+  args?: Record<string, unknown>;
+}
+
+export type WsOutgoing = WsTextMessage | WsVoiceMessage | WsCommandMessage;
+
+/** Incoming from watcher to app */
+export interface WsIncomingText {
+  type: "text";
+  content: string;
+}
+
+export interface WsIncomingVoice {
+  type: "voice";
   content: string;
   audioBase64?: string;
 }
+
+export interface WsIncomingImage {
+  type: "image";
+  imageBase64: string;
+  caption?: string;
+}
+
+export interface WsSession {
+  index: number;
+  name: string;
+  type: "claude" | "terminal";
+  isActive: boolean;
+  id: string;
+}
+
+export interface WsIncomingSessions {
+  type: "sessions";
+  sessions: WsSession[];
+}
+
+export interface WsIncomingSessionSwitched {
+  type: "session_switched";
+  name: string;
+  sessionId: string;
+}
+
+export interface WsIncomingSessionRenamed {
+  type: "session_renamed";
+  sessionId: string;
+  name: string;
+}
+
+export interface WsIncomingError {
+  type: "error";
+  message: string;
+}
+
+export type WsIncoming =
+  | WsIncomingText
+  | WsIncomingVoice
+  | WsIncomingImage
+  | WsIncomingSessions
+  | WsIncomingSessionSwitched
+  | WsIncomingSessionRenamed
+  | WsIncomingError;

--
Gitblit v1.3.1