MAESTRO: fix 6 TypeScript errors in web/mobile layer

- Card.tsx: Use Omit<HTMLAttributes, 'title'> to avoid title type conflict
- useWebSocket.ts: Add 'user_input' to ServerMessageType union
- App.tsx: Remove non-standard renotify property from NotificationOptions
- useMobileKeyboardHandler.ts: Use type alias for MobileKeyboardSession
- CommandInputBar.tsx: Use proper double-cast for ref typing
- serviceWorker.ts: Extract registration.active to guarded local variable
This commit is contained in:
Pedram Amini
2025-12-20 09:46:46 -06:00
parent ec2ed7dcd0
commit 7497644d7b
6 changed files with 12 additions and 10 deletions

View File

@@ -261,8 +261,8 @@ export const Card = forwardRef<HTMLDivElement, CardProps>(function Card(
* </Card>
* ```
*/
export interface CardHeaderProps extends HTMLAttributes<HTMLDivElement> {
/** Main title text */
export interface CardHeaderProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
/** Main title text (overrides HTML title attribute to support ReactNode) */
title?: ReactNode;
/** Subtitle or secondary text */
subtitle?: ReactNode;

View File

@@ -25,15 +25,16 @@ import type { AITabData } from './useWebSocket';
/**
* Session type for the mobile keyboard handler
* Only includes fields needed for keyboard handling
* Kept minimal to accept any object with these optional fields
*/
export interface MobileKeyboardSession {
export type MobileKeyboardSession = {
/** Current input mode */
inputMode?: 'ai' | 'terminal';
inputMode?: string;
/** Array of AI tabs */
aiTabs?: AITabData[];
/** Currently active tab ID */
activeTabId?: string;
}
};
/**
* Input mode type for the handler

View File

@@ -105,6 +105,7 @@ export type ServerMessageType =
| 'active_session_changed'
| 'session_output'
| 'session_exit'
| 'user_input'
| 'theme'
| 'custom_commands'
| 'autorun_state'

View File

@@ -406,10 +406,9 @@ export default function MobileApp() {
const notification = showNotification(title, {
body: firstLine,
tag: `maestro-response-${session.id}`, // Prevent duplicate notifications for same session
renotify: true, // Allow notification to be re-shown if same tag
silent: false,
requireInteraction: false, // Auto-dismiss on mobile
});
} as NotificationOptions);
if (notification) {
webLogger.debug(`Notification shown for session: ${session.name}`, 'Mobile');

View File

@@ -719,7 +719,7 @@ export function CommandInputBar({
$
</span>
<input
ref={textareaRef as React.RefObject<HTMLInputElement>}
ref={textareaRef as unknown as React.RefObject<HTMLInputElement>}
type="text"
value={value}
onChange={(e) => handleChange(e as unknown as React.ChangeEvent<HTMLTextAreaElement>)}

View File

@@ -159,7 +159,8 @@ export async function pingServiceWorker(): Promise<boolean> {
try {
const registration = await navigator.serviceWorker.ready;
if (!registration.active) return false;
const activeWorker = registration.active;
if (!activeWorker) return false;
return new Promise((resolve) => {
const messageChannel = new MessageChannel();
@@ -170,7 +171,7 @@ export async function pingServiceWorker(): Promise<boolean> {
// Timeout after 1 second
setTimeout(() => resolve(false), 1000);
registration.active.postMessage('ping', [messageChannel.port2]);
activeWorker.postMessage('ping', [messageChannel.port2]);
});
} catch {
return false;