feat: add terminal panel components and Zustand store for state management

- Created a barrel export file for terminal panel components.
- Implemented Zustand store for managing terminal panel UI state, including visibility, active terminal, view mode, and terminal ordering.
- Added actions for opening/closing the terminal panel, setting the active terminal, changing view modes, and managing terminal order.
- Introduced selectors for accessing terminal panel state properties.
This commit is contained in:
catlog22
2026-02-12 23:53:11 +08:00
parent e44a97e812
commit ddbe12b7af
72 changed files with 1055 additions and 254 deletions

View File

@@ -108,7 +108,6 @@ export function useActiveCliExecutions(
const removeExecution = useCliStreamStore(state => state.removeExecution);
const executions = useCliStreamStore(state => state.executions);
const setCurrentExecution = useCliStreamStore(state => state.setCurrentExecution);
const markExecutionClosedByUser = useCliStreamStore(state => state.markExecutionClosedByUser);
const isExecutionClosedByUser = useCliStreamStore(state => state.isExecutionClosedByUser);
const cleanupUserClosedExecutions = useCliStreamStore(state => state.cleanupUserClosedExecutions);

View File

@@ -44,10 +44,8 @@ import {
type ProviderCredential,
type CustomEndpoint,
type CacheStats,
type GlobalCacheSettings,
type ModelPoolConfig,
type ModelPoolType,
type DiscoveredProvider,
type CliSettingsEndpoint,
type SaveCliSettingsRequest,
} from '../lib/api';

View File

@@ -9,15 +9,10 @@ import {
fetchGraphImpact,
type GraphDependenciesRequest,
type GraphDependenciesResponse,
type GraphImpactRequest,
type GraphImpactResponse,
} from '../lib/api';
import type {
GraphData,
GraphNode,
GraphEdge,
GraphFilters,
GraphMetadata,
NodeType,
EdgeType,
} from '../types/graph-explorer';
@@ -132,7 +127,7 @@ function filterGraphData(
// Filter by minimum complexity
if (filters.minComplexity !== undefined) {
filteredNodes = filteredNodes.filter(node => {
filteredNodes = filteredNodes.filter(_node => {
// This would require complexity data to be available
// For now, we'll skip this filter
return true;
@@ -239,7 +234,6 @@ export function useGraphData(options: UseGraphDataOptions = {}): UseGraphDataRet
rootPath,
maxDepth,
nodeTypes,
edgeTypes,
} = options;
const queryClient = useQueryClient();

View File

@@ -8,7 +8,6 @@ import { renderHook, waitFor } from '@testing-library/react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import {
useIssueQueue,
useIssueMutations,
useQueueMutations,
useIssueDiscovery,
} from './useIssues';

View File

@@ -25,7 +25,6 @@ import {
exportDiscoveryFindingsAsIssues,
type Issue,
type IssueQueue,
type IssuesResponse,
type QueueHistoryIndex,
type DiscoverySession,
type Finding,

View File

@@ -24,7 +24,6 @@ import {
type McpProjectConfigType,
type McpTemplate,
type McpTemplateInstallRequest,
type AllProjectsResponse,
type OtherProjectsServersResponse,
type CrossCliCopyRequest,
type CrossCliCopyResponse,
@@ -439,7 +438,7 @@ export function useCodexMutations(): UseCodexMutationsReturn {
// Optimistic update could be added here if needed
return { serverName, enabled };
},
onError: (_error, _vars, context) => {
onError: (_error, _vars, _context) => {
// Rollback on error
console.error('Failed to toggle Codex MCP server:', _error);
},

View File

@@ -168,7 +168,7 @@ export function useCreateSession(): UseCreateSessionReturn {
const mutation = useMutation({
mutationFn: createSession,
onSuccess: (newSession) => {
onSuccess: () => {
// Invalidate sessions cache to trigger refetch
queryClient.invalidateQueries({ queryKey: ['workspace'] });
// Invalidate dashboard stats

View File

@@ -9,7 +9,6 @@ import {
enableSkill,
disableSkill,
type Skill,
type SkillsResponse,
} from '../lib/api';
import { useWorkflowStore, selectProjectPath } from '@/stores/workflowStore';
import { workspaceQueryKeys } from '@/lib/queryKeys';

View File

@@ -15,7 +15,7 @@ import {
type ExecutionLog,
} from '../types/execution';
import { SurfaceUpdateSchema } from '../packages/a2ui-runtime/core/A2UITypes';
import type { ToolCallKind } from '../types/toolCall';
import type { ToolCallKind, ToolCallExecution } from '../types/toolCall';
// Constants
const RECONNECT_DELAY_BASE = 1000; // 1 second
@@ -242,7 +242,7 @@ export function useWebSocket(options: UseWebSocketOptions = {}): UseWebSocketRet
const currentNodeId = stores.currentExecution?.currentNodeId;
if (currentNodeId && (unitType === 'stdout' || unitType === 'stderr')) {
const toolCalls = stores.getToolCallsForNode?.(currentNodeId);
const activeCall = toolCalls?.find(c => c.status === 'executing');
const activeCall = toolCalls?.find((c: ToolCallExecution) => c.status === 'executing');
if (activeCall) {
stores.updateToolCall(currentNodeId, activeCall.callId, {

View File

@@ -3,9 +3,8 @@
// ========================================
// TanStack Query hook for fetching workflow status distribution
import { useQuery, useQueryClient } from '@tanstack/react-query';
import { useQuery } from '@tanstack/react-query';
import { useWorkflowStore, selectProjectPath } from '@/stores/workflowStore';
import { workspaceQueryKeys } from '@/lib/queryKeys';
/**
* Workflow status count data structure