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

@@ -1,3 +1,4 @@
import { useState } from 'react';
import { format } from 'date-fns';
import { motion, AnimatePresence } from 'framer-motion';
import { Clock, CheckCircle, AlertCircle, Hourglass, Trash2, ChevronDown, ChevronUp } from 'lucide-react';
@@ -14,7 +15,7 @@ const statusConfig: Record<FeedbackStatus, { label: string; color: string; icon:
const typeLabels: Record<string, string> = {
bug: 'Bug Report',
feature: 'Feature Request';
feature: 'Feature Request',
general: 'General Feedback',
};
const priorityLabels: Record<string, string> = {
@@ -27,7 +28,7 @@ interface FeedbackHistoryProps {
onViewDetails?: (feedback: FeedbackSubmission) => void;
}
export function FeedbackHistory({ onViewDetails }: FeedbackHistoryProps) {
export function FeedbackHistory({ onViewDetails: _onViewDetails }: FeedbackHistoryProps) {
const { feedbackItems, deleteFeedback, updateFeedbackStatus } = useFeedbackStore();
const [expandedId, setExpandedId] = useState<string | null>(null);
@@ -147,7 +148,7 @@ export function FeedbackHistory({ onViewDetails }: FeedbackHistoryProps) {
<div className="text-xs text-gray-500 dark:text-gray-400 space-y-1">
<p>App Version: {feedback.metadata.appVersion}</p>
<p>OS: {feedback.metadata.os}</p>
<p>Submitted: {format(feedback.createdAt)}</p>
<p>Submitted: {formatDate(feedback.createdAt)}</p>
</div>
</div>

View File

@@ -1,9 +1,10 @@
import { useState, useRef } from 'react';
import { motion, AnimatePresence } from 'framer-motion';
import { X, Send, Bug, Lightbulb, MessageSquare, AlertCircle, Upload, Trash2 } from 'lucide-react';
import { useFeedbackStore, type FeedbackType, type FeedbackPriority } from './feedbackStore';
import { useFeedbackStore, type FeedbackType, type FeedbackPriority, type FeedbackAttachment } from './feedbackStore';
import { Button } from '../ui';
import { useToast } from '../ui/Toast';
import { silentErrorHandler } from '../../lib/error-utils';
interface FeedbackModalProps {
onClose: () => void;
@@ -39,9 +40,9 @@ export function FeedbackModal({ onClose }: FeedbackModalProps) {
}
// Convert files to base64 for storage
const processedAttachments = await Promise.all(
const processedAttachments: FeedbackAttachment[] = await Promise.all(
attachments.map(async (file) => {
return new Promise((resolve) => {
return new Promise<FeedbackAttachment>((resolve) => {
const reader = new FileReader();
reader.onload = () => {
resolve({
@@ -57,7 +58,7 @@ export function FeedbackModal({ onClose }: FeedbackModalProps) {
);
try {
const result = await submitFeedback({
await submitFeedback({
type,
title: title.trim(),
description: description.trim(),
@@ -70,16 +71,14 @@ export function FeedbackModal({ onClose }: FeedbackModalProps) {
},
});
if (result) {
toast('Feedback submitted successfully!', 'success');
// Reset form
setTitle('');
setDescription('');
setAttachments([]);
setType('bug');
setPriority('medium');
onClose();
}
toast('Feedback submitted successfully!', 'success');
// Reset form
setTitle('');
setDescription('');
setAttachments([]);
setType('bug');
setPriority('medium');
onClose();
} catch (err) {
toast('Failed to submit feedback. Please try again.', 'error');
}
@@ -277,7 +276,7 @@ export function FeedbackModal({ onClose }: FeedbackModalProps) {
</Button>
<Button
variant="primary"
onClick={() => { handleSubmit().catch(() => {}); }}
onClick={() => { handleSubmit().catch(silentErrorHandler('FeedbackModal')); }}
loading={isLoading}
disabled={!title.trim() || !description.trim()}
>

View File

@@ -78,7 +78,7 @@ export const useFeedbackStore = create<FeedbackStore>()(
openModal: () => set({ isModalOpen: true }),
closeModal: () => set({ isModalOpen: false }),
submitFeedback: async (feedback) => {
submitFeedback: async (feedback): Promise<void> => {
const { feedbackItems } = get();
set({ isLoading: true, error: null });
@@ -106,8 +106,6 @@ export const useFeedbackStore = create<FeedbackStore>()(
isLoading: false,
isModalOpen: false,
});
return newFeedback;
} catch (err) {
set({
isLoading: false,