fix(team): resolve TypeScript errors in team collaboration module

- Remove unused imports and variables in Team components
- Fix CollaborationEvent type import in useTeamEvents
- Add proper type guards for Hand status in gatewayStore
- Fix Session status type compatibility in gateway-client
- Remove unused getGatewayClient import from teamStore
- Handle unknown payload types in TeamCollaborationView

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
iven
2026-03-15 09:20:58 +08:00
parent 4802eb7d6a
commit fc30290b1c
9 changed files with 93 additions and 47 deletions

View File

@@ -967,12 +967,42 @@ export class GatewayClient {
// === OpenFang Hands API ===
/** List available Hands */
async listHands(): Promise<{ hands: { id: string; name: string; description: string; status: string; requirements_met?: boolean; category?: string }[] }> {
async listHands(): Promise<{
hands: {
id?: string;
name: string;
description?: string;
status?: string;
requirements_met?: boolean;
category?: string;
icon?: string;
tool_count?: number;
tools?: string[];
metric_count?: number;
metrics?: string[];
}[]
}> {
return this.restGet('/api/hands');
}
/** Get Hand details */
async getHand(name: string): Promise<{ name: string; description: string; config: Record<string, unknown> }> {
async getHand(name: string): Promise<{
id?: string;
name?: string;
description?: string;
status?: string;
requirements_met?: boolean;
category?: string;
icon?: string;
provider?: string;
model?: string;
requirements?: { description?: string; name?: string; met?: boolean; satisfied?: boolean; details?: string; hint?: string }[];
tools?: string[];
metrics?: string[];
config?: Record<string, unknown>;
tool_count?: number;
metric_count?: number;
}> {
return this.restGet(`/api/hands/${name}`);
}
@@ -1097,7 +1127,7 @@ export class GatewayClient {
created_at: string;
updated_at?: string;
message_count?: number;
status?: string;
status?: 'active' | 'archived' | 'expired';
}>;
}> {
const params = new URLSearchParams();
@@ -1113,7 +1143,7 @@ export class GatewayClient {
created_at: string;
updated_at?: string;
message_count?: number;
status?: string;
status?: 'active' | 'archived' | 'expired';
metadata?: Record<string, unknown>;
}> {
return this.restGet(`/api/sessions/${sessionId}`);

View File

@@ -23,6 +23,9 @@ import type {
TeamMetrics,
} from '../types/team';
// Re-export types for consumers
export type { CollaborationEvent } from '../types/team';
// === Configuration ===
const API_BASE = '/api'; // Uses Vite proxy

View File

@@ -10,7 +10,7 @@
import { useEffect, useRef, useCallback } from 'react';
import { useTeamStore } from '../store/teamStore';
import { useGatewayStore } from '../store/gatewayStore';
import type { TeamEventMessage, TeamEventType } from '../lib/team-client';
import type { TeamEventMessage, TeamEventType, CollaborationEvent } from '../lib/team-client';
interface UseTeamEventsOptions {
/** Subscribe to specific team only, or null for all teams */
@@ -25,12 +25,11 @@ interface UseTeamEventsOptions {
* Hook for subscribing to real-time team collaboration events
*/
export function useTeamEvents(options: UseTeamEventsOptions = {}) {
const { teamId = null, eventTypes, maxEvents = 100 } = options;
const { teamId = null, eventTypes } = options;
const unsubscribeRef = useRef<(() => void) | null>(null);
const {
addEvent,
setActiveTeam,
updateTaskStatus,
updateLoopState,
loadTeams,