feat(phase6-9): Complete modular architecture and Agent Teams

Phase 6.4 - Modular Architecture:
- Add lewooogo-brain adapters for LLM providers
- Add lewooogo-data dual memory (Redis + PostgreSQL)
- Implement consensus engine for multi-agent decisions
- Add incident memory service for historical context

Phase 9 - Agent Teams (Claude Agent SDK):
- Add base agent class with Claude Sonnet 4 integration
- Implement action planner, blast radius, and security agents
- Add agent API endpoints and proposal workflow
- Integrate ADR-009 OpenClaw Agent Teams architecture

DevOps & CI/CD:
- Add GitHub Actions CI/CD workflows (ci.yaml, cd.yaml)
- Add pre-commit hooks and secrets baseline
- Add docker-compose for local development
- Update Kubernetes network policies

Frontend Improvements:
- Add auto-healing error boundary component
- Update i18n messages for agent features
- Enhance dual-state incident card with execution feedback

Documentation:
- Add 7 ADRs covering MCP, design system, architecture decisions
- Update ARCHITECTURE_MEMORY.md with modular design
- Add GLOBAL_RULES.md and SOUL.md for project identity

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
OG T
2026-03-23 18:40:36 +08:00
parent 6eccb45757
commit 7478dc0254
169 changed files with 24613 additions and 247 deletions

View File

@@ -0,0 +1,141 @@
'use client'
import React, { Component, ErrorInfo, ReactNode } from 'react'
import { useTranslations } from 'next-intl'
import { useAgentStore } from '@/stores/agent.store'
interface ErrorBoundaryTranslations {
systemFailure: string;
criticalError: string;
escalating: string;
forceRestart: string;
detectingAnomaly: string;
autoHealingAttempt: (attempt: number) => string;
}
interface InnerProps {
children: ReactNode;
fallbackMessage?: string;
translations: ErrorBoundaryTranslations;
}
interface State {
hasError: boolean;
retryCount: number;
}
class AutoHealingErrorBoundaryInner extends Component<InnerProps, State> {
public state: State = {
hasError: false,
retryCount: 0
};
public static getDerivedStateFromError(_: Error): State {
return { hasError: true, retryCount: 0 };
}
public componentDidCatch(error: Error, errorInfo: ErrorInfo) {
console.error('[AWOOOI] Frontend component crashed:', error, errorInfo);
this.attemptAutoHealing();
}
private attemptAutoHealing = () => {
const { retryCount } = this.state;
if (retryCount >= 3) {
console.error('[AWOOOI] Auto-healing failed after 3 attempts. Escalating to L3 AIOps.');
return;
}
// L1 Auto-Healing Logic
console.log(`[AWOOOI] Attempting auto-healing (Attempt ${retryCount + 1}/3)...`);
// 1. Clear toxic stored state
if (typeof window !== 'undefined') {
try {
localStorage.clear();
sessionStorage.clear();
} catch (e) {
console.warn('Failed to clear storage:', e);
}
}
// 2. Reset Zustand store explicitly outside of React render cycle
try {
if (typeof useAgentStore.getState().reset === 'function') {
useAgentStore.getState().reset();
}
} catch (e) {
console.warn('[AWOOOI] Failed to reset Agent Store during auto-healing', e);
}
// 3. Exponential Backoff remount
const delay = Math.pow(2, retryCount) * 1000; // 1s, 2s, 4s
setTimeout(() => {
console.log('[AWOOOI] Remounting component...');
this.setState({ hasError: false, retryCount: retryCount + 1 });
}, delay);
}
public render() {
const { translations } = this.props;
if (this.state.hasError) {
if (this.state.retryCount >= 3) {
return (
<div className="flex flex-col items-center justify-center p-8 bg-[#111111] text-white border border-red-500/30 rounded-lg max-w-lg mx-auto mt-12">
<h2 className="text-xl font-mono text-red-500 mb-4">{translations.systemFailure}</h2>
<p className="font-mono text-sm text-gray-400 mb-4">{this.props.fallbackMessage || translations.criticalError}</p>
<p className="font-mono text-xs text-purple-400 mb-6">{translations.escalating}</p>
<button
onClick={() => window.location.reload()}
className="px-6 py-2 bg-white text-black font-mono text-sm rounded-full hover:bg-gray-200 transition-colors"
>
{translations.forceRestart}
</button>
</div>
);
}
return (
<div className="flex flex-col items-center justify-center p-12 space-y-4 animate-pulse">
<div className="text-red-500 font-mono text-sm font-bold tracking-widest">{translations.detectingAnomaly}</div>
<div className="text-gray-400 font-mono text-xs">{translations.autoHealingAttempt(this.state.retryCount + 1)}</div>
<div className="w-48 h-1 bg-gray-800 rounded overflow-hidden mt-4">
<div className="h-full bg-white opacity-50 animate-ping"></div>
</div>
</div>
);
}
return this.props.children;
}
}
// Wrapper component that provides translations via hook
interface Props {
children: ReactNode;
fallbackMessage?: string;
}
export function AutoHealingErrorBoundary({ children, fallbackMessage }: Props) {
const t = useTranslations('errorBoundary');
const translations: ErrorBoundaryTranslations = {
systemFailure: t('systemFailure'),
criticalError: t('criticalError'),
escalating: t('escalating'),
forceRestart: t('forceRestart'),
detectingAnomaly: t('detectingAnomaly'),
autoHealingAttempt: (attempt: number) => t('autoHealingAttempt', { attempt }),
};
return (
<AutoHealingErrorBoundaryInner
translations={translations}
fallbackMessage={fallbackMessage}
>
{children}
</AutoHealingErrorBoundaryInner>
);
}