mirror of
https://github.com/anomalyco/opencode.git
synced 2026-07-24 04:01:10 -04:00
refactor(personas): improve type safety for persona configs
- 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 <noreply@anthropic.com>
This commit is contained in:
+4
-64
@@ -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<PersonaId, PersonaConfig> = {
|
||||
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];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,8 +18,11 @@ import { z } from "zod";
|
||||
export const PersonaId = z.enum(["zee", "stanley", "johny"]);
|
||||
export type PersonaId = z.infer<typeof PersonaId>;
|
||||
|
||||
/** 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<PersonaId, PersonaConfig> = {
|
||||
/** Built-in persona configurations for orchestration */
|
||||
export const ORCHESTRATION_PERSONAS: Record<PersonaId, OrchestrationPersona> = {
|
||||
zee: {
|
||||
id: "zee",
|
||||
displayName: "Zee",
|
||||
|
||||
Reference in New Issue
Block a user