From aa17f25388a331daaf16b10a38b65cd08d899141 Mon Sep 17 00:00:00 2001 From: Artur Do Lago Date: Sun, 11 Jan 2026 12:44:46 +0100 Subject: [PATCH] refactor(personas): improve type safety for persona configs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Rename PersonaConfig → OrchestrationPersona in personas/types.ts to avoid confusion with agent/persona.ts:PersonaConfig - Rename PERSONAS_CONFIGS → ORCHESTRATION_PERSONAS for clarity - Remove duplicate inline configs in persona.ts, use shared constant - getPersonaConfig now returns OrchestrationPersona type Eliminates config duplication and clarifies type naming. Co-Authored-By: Claude Opus 4.5 --- src/personas/persona.ts | 68 +++-------------------------------------- src/personas/types.ts | 11 ++++--- 2 files changed, 11 insertions(+), 68 deletions(-) diff --git a/src/personas/persona.ts b/src/personas/persona.ts index 969398244df..f3f8a3a17ec 100644 --- a/src/personas/persona.ts +++ b/src/personas/persona.ts @@ -5,7 +5,8 @@ * Each persona can spawn drones that inherit their identity and capabilities. */ -import type { PersonaId, PersonaConfig } from "./types"; +import type { PersonaId, OrchestrationPersona } from "./types"; +import { ORCHESTRATION_PERSONAS } from "./types"; // Import tiara types // Note: These are from the vendor submodule @@ -220,69 +221,8 @@ export function generateDronePrompt( /** * Get persona config by ID */ -export function getPersonaConfig(id: PersonaId): PersonaConfig { - // Import here to avoid circular dependency - const configs: Record = { - zee: { - id: "zee", - displayName: "Zee", - description: "Personal assistant with memory and messaging", - domain: "personal", - defaultCapabilities: [ - "task_management", - "information_gathering", - "knowledge_synthesis", - "documentation_generation", - ], - systemPromptAdditions: [ - "You are Zee, a personal assistant.", - "You help with daily tasks, research, and communication.", - "You maintain context across conversations.", - ], - color: "#6366f1", - icon: "★", - }, - stanley: { - id: "stanley", - displayName: "Stanley", - description: "Investment platform inspired by Druckenmiller", - domain: "finance", - defaultCapabilities: [ - "data_analysis", - "performance_metrics", - "pattern_recognition", - "bottleneck_detection", - ], - systemPromptAdditions: [ - "You are Stanley, an investment analysis assistant.", - "You help with market analysis, portfolio management, and trading decisions.", - "You think in terms of risk/reward and macro trends.", - ], - color: "#22c55e", - icon: "♦", - }, - johny: { - id: "johny", - displayName: "Johny", - description: "Learning system inspired by von Neumann", - domain: "learning", - defaultCapabilities: [ - "knowledge_synthesis", - "pattern_recognition", - "technical_writing", - "problem_solving", - ], - systemPromptAdditions: [ - "You are Johny, a learning and study assistant.", - "You help with understanding complex topics, spaced repetition, and knowledge retention.", - "You think systematically and build knowledge graphs.", - ], - color: "#f59e0b", - icon: "◎", - }, - }; - - return configs[id]; +export function getPersonaConfig(id: PersonaId): OrchestrationPersona { + return ORCHESTRATION_PERSONAS[id]; } /** diff --git a/src/personas/types.ts b/src/personas/types.ts index 177c3b5d1e8..24eb1c20324 100644 --- a/src/personas/types.ts +++ b/src/personas/types.ts @@ -18,8 +18,11 @@ import { z } from "zod"; export const PersonaId = z.enum(["zee", "stanley", "johny"]); export type PersonaId = z.infer; -/** Persona configuration */ -export interface PersonaConfig { +/** + * Orchestration persona info for the Personas layer + * (distinct from agent/persona.ts:PersonaConfig which handles file loading) + */ +export interface OrchestrationPersona { /** Persona identifier */ id: PersonaId; /** Display name */ @@ -38,8 +41,8 @@ export interface PersonaConfig { icon: string; } -/** Built-in persona configurations */ -export const PERSONAS_CONFIGS: Record = { +/** Built-in persona configurations for orchestration */ +export const ORCHESTRATION_PERSONAS: Record = { zee: { id: "zee", displayName: "Zee",