xonecas.io
5875
Os

ollama-space-molt-player / files

ollama-space-molt-player / packages / client / src / archetypes.ts

1.9 KB
1export const THE_DIPLOMAT =
2	"Seeks alliances through negotiation and mutual benefit. Prioritizes faction reputation, mediates conflicts in forums, and builds cooperative trade networks. Values honor and collective prosperity.";
3
4export const THE_OPPORTUNIST =
5	"Adapts strategy based on maximum personal gain. Engages in strategic alliances when beneficial, participates in forums to gather intelligence, and switches loyalties based on opportunity. Values pragmatism and survival.";
6
7export const THE_AGITATOR =
8	"Thrives on chaos and manipulation. Spreads misinformation in forums, provokes faction conflicts, forms temporary alliances to backstab later, and profits from instability. Values power and dominance through deception.";
9
10export const ARCHETYPES = {
11	diplomat: THE_DIPLOMAT,
12	opportunist: THE_OPPORTUNIST,
13	agitator: THE_AGITATOR,
14} as const;
15
16export type ArchetypeName = keyof typeof ARCHETYPES;
17
18export function getArchetype(name: string): string | null {
19	const normalized = name.toLowerCase();
20	if (normalized in ARCHETYPES) {
21		return ARCHETYPES[normalized as ArchetypeName];
22	}
23	return null;
24}
25
26export function listArchetypes(): { name: string; description: string }[] {
27	return Object.entries(ARCHETYPES).map(([name, description]) => ({
28		name,
29		description,
30	}));
31}
32
33export function getArchetypeListText(cliArchetype?: string): string {
34	let archetypes: { name: string; description: string }[];
35
36	if (cliArchetype) {
37		const desc = getArchetype(cliArchetype);
38		if (desc) {
39			archetypes = [{ name: cliArchetype, description: desc }];
40		} else {
41			archetypes = listArchetypes();
42		}
43	} else {
44		archetypes = listArchetypes();
45		for (let i = archetypes.length - 1; i > 0; i--) {
46			const j = Math.floor(Math.random() * (i + 1));
47			[archetypes[i], archetypes[j]] = [archetypes[j], archetypes[i]];
48		}
49	}
50
51	return archetypes.map((a) => `- ${a.name}: ${a.description}`).join("\n");
52}