refactor(types): comprehensive TypeScript type system improvements

Major type system refactoring and error fixes across the codebase:

**Type System Improvements:**
- Extended OpenFangStreamEvent with 'connected' and 'agents_updated' event types
- Added GatewayPong interface for WebSocket pong responses
- Added index signature to MemorySearchOptions for Record compatibility
- Fixed RawApproval interface with hand_name, run_id properties

**Gateway & Protocol Fixes:**
- Fixed performHandshake nonce handling in gateway-client.ts
- Fixed onAgentStream callback type definitions
- Fixed HandRun runId mapping to handle undefined values
- Fixed Approval mapping with proper default values

**Memory System Fixes:**
- Fixed MemoryEntry creation with required properties (lastAccessedAt, accessCount)
- Replaced getByAgent with getAll method in vector-memory.ts
- Fixed MemorySearchOptions type compatibility

**Component Fixes:**
- Fixed ReflectionLog property names (filePath→file, proposedContent→suggestedContent)
- Fixed SkillMarket suggestSkills async call arguments
- Fixed message-virtualization useRef generic type
- Fixed session-persistence messageCount type conversion

**Code Cleanup:**
- Removed unused imports and variables across multiple files
- Consolidated StoredError interface (removed duplicate)
- Deleted obsolete test files (feedbackStore.test.ts, memory-index.test.ts)

**New Features:**
- Added browser automation module (Tauri backend)
- Added Active Learning Panel component
- Added Agent Onboarding Wizard
- Added Memory Graph visualization
- Added Personality Selector
- Added Skill Market store and components

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
iven
2026-03-17 08:05:07 +08:00
parent adfd7024df
commit f4efc823e2
80 changed files with 9496 additions and 1390 deletions

View File

@@ -7,8 +7,12 @@
* @module message-virtualization
*/
import { useRef, useCallback, useMemo, useEffect, type React } from 'react';
import { VariableSizeList as List } from 'react-window';
import { useRef, useCallback, useMemo, useEffect, type CSSProperties, type ReactNode } from 'react';
import React from 'react';
import { VariableSizeList } from 'react-window';
// Type alias for convenience
type List = VariableSizeList;
/**
* Message item interface for virtualization
@@ -24,7 +28,7 @@ export interface VirtualizedMessageItem {
*/
export interface VirtualizedMessageListProps {
messages: VirtualizedMessageItem[];
renderMessage: (id: string, style: React.CSSProperties) => React.ReactNode;
renderMessage: (id: string, style: CSSProperties) => ReactNode;
height: number;
width: number | string;
overscan?: number;
@@ -49,7 +53,7 @@ const DEFAULT_HEIGHTS: Record<string, number> = {
*/
export interface UseVirtualizedMessagesReturn {
/** Reference to the VariableSizeList instance */
listRef: React.RefObject<List | null>;
listRef: React.RefObject<VariableSizeList | null>;
/** Get the current height for a message by id and role */
getHeight: (id: string, role: string) => number;
/** Update the measured height for a message */
@@ -388,7 +392,7 @@ export function useMemoizedContent<T>(
cache?: MessageCache<T>
): T {
// Use provided cache or create a default one
const cacheRef = useRef<MessageCache<T>>();
const cacheRef = useRef<MessageCache<T> | undefined>(undefined);
if (!cacheRef.current && !cache) {
cacheRef.current = new MessageCache<T>(200);
}