feat(intelligence): add self-evolution UI for identity change proposals

P1.1: Identity Change Proposal UI
- Create IdentityChangeProposal.tsx with diff view for SOUL.md changes
- Add approve/reject buttons with visual feedback
- Show evolution history timeline with restore capability

P1.2: Connect Reflection Engine to Identity Proposals
- Update ReflectionLog.tsx to convert reflection proposals to identity proposals
- Add ReflectionIdentityProposal type for non-persisted proposals
- Auto-create identity proposals when reflection detects personality changes

P1.3: Evolution History and Rollback
- Display identity snapshots with timestamps
- One-click restore to previous personality versions
- Visual diff between current and proposed content

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
iven
2026-03-24 00:51:03 +08:00
parent 6c64d704d7
commit bfad61c3da
5 changed files with 526 additions and 6 deletions

View File

@@ -413,9 +413,34 @@ export function ReflectionLog({
const result = await intelligenceClient.reflection.reflect(agentId, []);
setHistory((prev) => [result, ...prev]);
// Update pending proposals
if (result.identity_proposals.length > 0) {
setPendingProposals((prev) => [...prev, ...result.identity_proposals]);
// Convert reflection identity_proposals to actual identity proposals
// The reflection result contains proposals that need to be persisted
if (result.identity_proposals && result.identity_proposals.length > 0) {
for (const proposal of result.identity_proposals) {
try {
// Determine which file to modify based on the field
const file: 'soul' | 'instructions' =
proposal.field === 'soul' || proposal.field === 'instructions'
? (proposal.field as 'soul' | 'instructions')
: proposal.field.toLowerCase().includes('soul')
? 'soul'
: 'instructions';
// Persist the proposal to the identity system
await intelligenceClient.identity.proposeChange(
agentId,
file,
proposal.proposed_value,
proposal.reason
);
} catch (err) {
console.warn('[ReflectionLog] Failed to create identity proposal:', err);
}
}
// Refresh pending proposals from the identity system
const proposals = await intelligenceClient.identity.getPendingProposals(agentId);
setPendingProposals(proposals);
}
} catch (error) {
console.error('[ReflectionLog] Reflection failed:', error);