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

@@ -14,10 +14,8 @@ import { useState, useEffect, useCallback, useMemo } from 'react';
import { motion, AnimatePresence } from 'framer-motion';
import {
Brain,
Sparkles,
Check,
X,
Clock,
ChevronDown,
ChevronRight,
RefreshCw,
@@ -184,9 +182,8 @@ function ProposalCard({
onReject: () => void;
}) {
const [expanded, setExpanded] = useState(false);
const identityManager = getAgentIdentityManager();
const fileName = proposal.filePath.split('/').pop() || proposal.filePath;
const fileName = proposal.file.split('/').pop() || proposal.file;
const fileType = fileName.toLowerCase().replace('.md', '').toUpperCase();
return (
@@ -243,8 +240,8 @@ function ProposalCard({
</h5>
<pre className="text-xs text-gray-600 dark:text-gray-300 bg-white dark:bg-gray-800 p-2 rounded overflow-x-auto whitespace-pre-wrap">
{proposal.proposedContent.slice(0, 500)}
{proposal.proposedContent.length > 500 && '...'}
{proposal.suggestedContent.slice(0, 500)}
{proposal.suggestedContent.length > 500 && '...'}
</pre>
</div>
</div>
@@ -283,7 +280,6 @@ function ReflectionEntry({
}) {
const positivePatterns = result.patterns.filter((p) => p.sentiment === 'positive').length;
const negativePatterns = result.patterns.filter((p) => p.sentiment === 'negative').length;
const highPriorityImprovements = result.improvements.filter((i) => i.priority === 'high').length;
return (
<div className="border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden">
@@ -423,7 +419,7 @@ export function ReflectionLog({
const handleApproveProposal = useCallback(
(proposal: IdentityChangeProposal) => {
const identityManager = getAgentIdentityManager();
identityManager.approveChange(proposal.id);
identityManager.approveProposal(proposal.id);
setPendingProposals((prev) => prev.filter((p) => p.id !== proposal.id));
onProposalApprove?.(proposal);
},
@@ -433,7 +429,7 @@ export function ReflectionLog({
const handleRejectProposal = useCallback(
(proposal: IdentityChangeProposal) => {
const identityManager = getAgentIdentityManager();
identityManager.rejectChange(proposal.id);
identityManager.rejectProposal(proposal.id);
setPendingProposals((prev) => prev.filter((p) => p.id !== proposal.id));
onProposalReject?.(proposal);
},
@@ -590,7 +586,7 @@ export function ReflectionLog({
</button>
</div>
) : (
history.map((result, i) => (
history.map((result) => (
<ReflectionEntry
key={result.timestamp}
result={result}