Skip to content

[BE] Persona Marketplace - PersonaManager (#16)#45

Closed
SaharBarak wants to merge 2 commits into
mainfrom
feat/persona-manager-16
Closed

[BE] Persona Marketplace - PersonaManager (#16)#45
SaharBarak wants to merge 2 commits into
mainfrom
feat/persona-manager-16

Conversation

@SaharBarak
Copy link
Copy Markdown
Owner

Summary

Implements the PersonaManager infrastructure for the Persona Marketplace epic.

Changes

  • src/lib/personas/types.ts: Defines CustomPersona interface extending AgentPersona with marketplace metadata (version, author, industry, tags, favorites, usage count, etc.)
  • src/lib/personas/PersonaManager.ts: Full CRUD operations for custom personas
  • src/lib/personas/index.ts: Module exports
  • src/lib/personas/__tests__/PersonaManager.test.ts: 79 comprehensive tests

Features

CustomPersona Interface

  • Extends AgentPersona with marketplace-specific fields
  • Version tracking, author info, industry categorization
  • Tags for search and filtering
  • Favorites and usage analytics
  • Custom prompts and domain expertise

PersonaManager Class

  • CRUD Operations: Create, read, update, delete personas
  • Persistence: Load/save from ~/.forge/personas/
  • Validation: Comprehensive validation with errors and warnings
  • Filtering: By industry, tags, author, favorites, search query
  • Sorting: By name, creation date, update date, usage count
  • Import/Export: JSON import/export with conflict-free ID generation
  • Persona Sets: Group personas for specific domains/projects
  • Session Integration: applyToSession() registers personas for debates
  • Event Emitter: Emits change events for UI updates

Validation Rules

  • Required fields: name, nameHe, role, age, background, personality, biases, strengths, weaknesses, speakingStyle, color
  • Age range: 18-120
  • Personality traits: 2-10
  • Valid colors: pink, green, purple, orange, blue, cyan, yellow, red, gray
  • Warnings for missing optional fields (description, tags, industry)

Tests

79 tests covering:

  • Initialization and directory creation
  • All CRUD operations
  • Filtering and sorting
  • Validation (valid/invalid inputs)
  • Import/export functionality
  • Favorites and usage tracking
  • Persona sets management
  • Session integration
  • Edge cases (special characters, Hebrew, concurrent operations)

Usage Example

import { getPersonaManager } from './lib/personas';

const manager = getPersonaManager();
await manager.initialize();

// Create a persona
const persona = await manager.create({
  name: 'Developer Dan',
  nameHe: 'דן המפתח',
  role: 'The Skeptical Developer',
  age: 32,
  background: 'Senior developer with 10 years experience...',
  personality: ['Technical', 'Detail-oriented'],
  biases: ['Prefers code over marketing'],
  strengths: ['Technical accuracy'],
  weaknesses: ['May over-engineer'],
  speakingStyle: 'Technical, precise',
  color: 'blue',
  description: 'A developer persona for tech products',
  industry: 'Technology',
  tags: ['tech', 'developer'],
});

// Apply to session
await manager.applyToSession([persona.id]);

Part of Epic

Persona Marketplace (#3)

Related Issues

Closes #16

Dependencies

None - this is foundational infrastructure for the marketplace.

- Add VirtualMessageList component using react-window 2.x
- Implement dynamic row height calculation with useDynamicRowHeight
- Auto-scroll to bottom on new messages (when already at bottom)
- Scroll-to-bottom button when user scrolls up
- Falls back to regular rendering for <50 messages (better UX)
- Supports 500+ messages efficiently
- Full RTL/Hebrew support maintained
Add PersonaManager for custom persona CRUD operations:

- Define CustomPersona interface extending AgentPersona
- Create PersonaManager class with full CRUD operations
- Load/save personas from ~/.forge/personas/
- Comprehensive validation logic with errors and warnings
- Support persona sets for grouping
- Session integration with applyToSession()
- Import/export functionality
- Favorites and usage tracking
- Filter and sort capabilities
- 79 comprehensive tests covering all functionality

Part of Epic: Persona Marketplace (#3)
Closes #16
@SaharBarak SaharBarak added backend Backend tasks epic-3 Epic: Persona Marketplace labels Feb 6, 2026
@SaharBarak
Copy link
Copy Markdown
Owner Author

APPROVED - Ready to merge

@SaharBarak
Copy link
Copy Markdown
Owner Author

⚠️ Mixed commits detected

This PR contains commits from different issues:

  1. 894d497 - feat(performance): Virtual scrolling for message lists ([FE] Performance - Virtual scrolling #25)
  2. e23002b - feat(personas): PersonaManager infrastructure ([BE] Persona Marketplace - PersonaManager #16)

The virtual scrolling commit (#25) is causing frontend conflicts. Recommend:

  1. Create a separate PR for [FE] Performance - Virtual scrolling #25
  2. Rebase this PR to only include the PersonaManager commit

Also has conflicts in:

  • package.json
  • package-lock.json
  • src/components/chat/ChatView.tsx
  • src/components/chat/VirtualMessageList.tsx

@SaharBarak
Copy link
Copy Markdown
Owner Author

Closing in favor of clean PR without mixed commits. The virtual scrolling commit (#25) was already merged in #50. Creating new clean PR with only the PersonaManager work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Backend tasks epic-3 Epic: Persona Marketplace

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BE] Persona Marketplace - PersonaManager

1 participant