Fix MCP form input and add reactive MCP server state

- Fix space key not working in MCP add form by handling evt.name === "space"
  - Add support for multi-character paste sequences via evt.sequence
  - Add MCPServerDisplay type to types/tui.ts for UI display
  - Add mcpServers reactive state to app store with setMcpServers,
    addMcpServer, and updateMcpServerStatus actions
  - Update session.tsx to use store's mcpServers instead of static props
  - Update execute.tsx to update store when server is added/connected
  - Remove duplicate MCPServer interfaces from app.tsx, session.tsx,
    and mcp-select.tsx in favor of shared MCPServerDisplay type
This commit is contained in:
2026-02-02 14:10:19 -05:00
parent 3b277c3925
commit fbd9afa177
6 changed files with 110 additions and 30 deletions

View File

@@ -28,6 +28,7 @@ import { ToastProvider, Toast, useToast } from "@tui-solid/ui/toast";
import { Home } from "@tui-solid/routes/home";
import { Session } from "@tui-solid/routes/session";
import type { TuiInput, TuiOutput } from "@tui-solid/types";
import type { MCPServerDisplay } from "@/types/tui";
import type { PermissionScope, LearningScope } from "@/types/tui";
import type { MCPAddFormData } from "@/types/mcp";
@@ -37,13 +38,6 @@ interface AgentOption {
description?: string;
}
interface MCPServer {
id: string;
name: string;
status: "connected" | "disconnected" | "error";
description?: string;
}
interface AppProps extends TuiInput {
onExit: (output: TuiOutput) => void;
onSubmit: (input: string) => Promise<void>;
@@ -72,7 +66,7 @@ interface AppProps extends TuiInput {
} | null;
agents?: AgentOption[];
currentAgent?: string;
mcpServers?: MCPServer[];
mcpServers?: MCPServerDisplay[];
files?: string[];
}
@@ -450,7 +444,7 @@ export interface TuiRenderOptions extends TuiInput {
} | null;
agents?: AgentOption[];
currentAgent?: string;
mcpServers?: MCPServer[];
mcpServers?: MCPServerDisplay[];
files?: string[];
}