xonecas.io
5875
Os

ollama-space-molt-player / commit 97fc975

feat: enhance swarm mode with character customization and configuration options

xonecas2026-02-01 97fc975e41d233bd023b7e121e43bb9866cea7c4 parent bf6b624

9 files changed

src/config.ts+26−2
@@ -1,8 +1,13 @@
11 import { parseArgs } from "node:util";
22
33 import type { EmpireID } from "../client/src/types";
4-import type { AlignmentType, PersonalityType } from "./types";
5-import { isValidAlignment, isValidEmpire, isValidPersonality } from "./utils";
4+import type { AlignmentType, PersonalityType, SpeechStyleType } from "./types";
5+import {
6+ isValidAlignment,
7+ isValidEmpire,
8+ isValidPersonality,
9+ isValidSpeechStyle,
10+} from "./utils";
611
712 const { values } = parseArgs({
813 args: process.argv.slice(2),
@@ -13,6 +18,7 @@ const { values } = parseArgs({
1318 empire: { type: "string", short: "e" },
1419 alignment: { type: "string", short: "a" },
1520 personality: { type: "string", short: "p" },
21+ "speech-style": { type: "string", short: "s" },
1622 },
1723 strict: false,
1824 });
@@ -98,12 +104,29 @@ function parsePersonality(raw: unknown): PersonalityType | null {
98104 return value;
99105 }
100106
107+function parseSpeechStyle(raw: unknown): SpeechStyleType | null {
108+ if (raw === undefined) return null;
109+ if (typeof raw !== "string" || raw.trim() === "") {
110+ console.error("Error: --speech-style requires a value");
111+ process.exit(1);
112+ }
113+ const value = raw.trim().toLowerCase();
114+ if (!isValidSpeechStyle(value)) {
115+ console.error(
116+ "Error: --speech-style must be one of: mythic, punny, gritty, scholarly",
117+ );
118+ process.exit(1);
119+ }
120+ return value;
121+}
122+
101123 const instanceName = getInstanceName();
102124 const nonInteractive = values["non-interactive"] === true;
103125 const maxTicks = parseMaxTicks(values["max-ticks"]);
104126 const empire = parseEmpire(values.empire);
105127 const alignment = parseAlignment(values.alignment);
106128 const personality = parsePersonality(values.personality);
129+const speechStyle = parseSpeechStyle(values["speech-style"]);
107130
108131 export const config = {
109132 instanceName,
@@ -112,6 +135,7 @@ export const config = {
112135 empire,
113136 alignment,
114137 personality,
138+ speechStyle,
115139 ollamaUrl: process.env.OLLAMA_URL ?? "http://localhost:11434",
116140 ollamaModel: process.env.OLLAMA_MODEL ?? "qwen3:8b",
117141 ollamaTemperature: (() => {
src/constants.ts+48−0
@@ -2,6 +2,7 @@ import type {
22 AlignmentType,
33 PersonalityArchetype,
44 PersonalityType,
5+ SpeechStyleType,
56 } from "./types";
67
78 export const MAX_GOAL_LENGTH = 120;
@@ -36,6 +37,53 @@ export const ALIGNMENT_DESCRIPTIONS: Record<AlignmentType, AlignmentInfo> = {
3637 },
3738 };
3839
40+export interface SpeechStyleInfo {
41+ name: string;
42+ description: string;
43+ namingGuidance: string;
44+ chatGuidance: string;
45+}
46+
47+export const SPEECH_STYLE_DESCRIPTIONS: Record<
48+ SpeechStyleType,
49+ SpeechStyleInfo
50+> = {
51+ mythic: {
52+ name: "Mythic",
53+ description:
54+ "Epic and ceremonial, steeped in the lore of The Crustacean Cosmos.",
55+ namingGuidance:
56+ "Favor grand, tide-and-empire names with a legendary flavor.",
57+ chatGuidance:
58+ "Speak in oaths, omens, and formal declarations; avoid casual slang.",
59+ },
60+ punny: {
61+ name: "Punny",
62+ description:
63+ "Playful and clever, always hunting for crustacean and space wordplay.",
64+ namingGuidance: "Use shell, tide, claw, or nebula puns with a witty twist.",
65+ chatGuidance:
66+ "Keep messages light with quips and jokes; stay brief and relevant.",
67+ },
68+ gritty: {
69+ name: "Gritty",
70+ description: "Hard-edged and practical, like a veteran of the frontier.",
71+ namingGuidance:
72+ "Choose short, rugged callsigns with industrial or military grit.",
73+ chatGuidance:
74+ "Be terse and direct, focused on tactical or practical details.",
75+ },
76+ scholarly: {
77+ name: "Scholarly",
78+ description:
79+ "Analytical and learned, with a researcher tone for cosmic discovery.",
80+ namingGuidance:
81+ "Use catalog-style or Latin-ish names tied to astronomy or marine life.",
82+ chatGuidance:
83+ "Use precise language and observations; cite data when useful.",
84+ },
85+};
86+
3987 export const PERSONALITY_ARCHETYPES: Record<
4088 PersonalityType,
4189 PersonalityArchetype
src/index.ts+10−1
@@ -37,6 +37,7 @@ import type {
3737 Credentials,
3838 PersonalityType,
3939 RegistrationOverrides,
40+ SpeechStyleType,
4041 } from "./types";
4142 import { detectRepetition, isNearbyTarget, sleep } from "./utils";
4243
@@ -66,6 +67,7 @@ const registrationOverrides: RegistrationOverrides = {
6667 empire: config.empire ?? undefined,
6768 alignment: config.alignment ?? undefined,
6869 personality: config.personality ?? undefined,
70+ speech_style: config.speechStyle ?? undefined,
6971 };
7072 let actionLoopRunning = false;
7173 const REPETITION_THRESHOLD = 3;
@@ -91,8 +93,9 @@ async function saveCredentials(
9193 token: string,
9294 personality: PersonalityType,
9395 alignment: AlignmentType,
96+ speechStyle: SpeechStyleType,
9497 ): Promise<void> {
95- memory.saveCredentials(username, token, personality, alignment);
98+ memory.saveCredentials(username, token, personality, alignment, speechStyle);
9699 }
97100
98101 function updateOutput(): void {
@@ -230,6 +233,7 @@ async function startActionLoop(): Promise<void> {
230233 empire: client.state.player?.empire,
231234 alignment: gameState.credentials?.alignment,
232235 personality: gameState.credentials?.personality,
236+ speechStyle: gameState.credentials?.speech_style,
233237 repetitionWarning,
234238 });
235239
@@ -407,6 +411,7 @@ client.on<LoggedInPayload>("logged_in", async (data) => {
407411 token,
408412 gameState.pendingRegistration.personality,
409413 gameState.pendingRegistration.alignment,
414+ gameState.pendingRegistration.speech_style,
410415 );
411416
412417 gameState.credentials = {
@@ -414,6 +419,7 @@ client.on<LoggedInPayload>("logged_in", async (data) => {
414419 token: token,
415420 personality: gameState.pendingRegistration.personality,
416421 alignment: gameState.pendingRegistration.alignment,
422+ speech_style: gameState.pendingRegistration.speech_style,
417423 };
418424
419425 output.log(
@@ -488,11 +494,14 @@ client.on<ErrorPayload>("error", (data) => {
488494 const fallbackAlignment = registrationOverrides.alignment ?? "neutral";
489495 const fallbackPersonality =
490496 registrationOverrides.personality ?? "pragmatist";
497+ const fallbackSpeechStyle =
498+ registrationOverrides.speech_style ?? "mythic";
491499 gameState.pendingRegistration = {
492500 username: fallback,
493501 empire: fallbackEmpire,
494502 alignment: fallbackAlignment,
495503 personality: fallbackPersonality,
504+ speech_style: fallbackSpeechStyle,
496505 };
497506 client.register(fallback, fallbackEmpire);
498507 }
src/memory.ts+21−6
@@ -1,5 +1,10 @@
11 import { Database } from "bun:sqlite";
2-import type { AlignmentType, Credentials, PersonalityType } from "./types";
2+import type {
3+ AlignmentType,
4+ Credentials,
5+ PersonalityType,
6+ SpeechStyleType,
7+} from "./types";
38
49 export interface Snapshot {
510 tick: number;
@@ -90,29 +95,36 @@ export class MemoryStore {
9095 username TEXT NOT NULL,
9196 token TEXT NOT NULL,
9297 personality TEXT NOT NULL,
93- alignment TEXT NOT NULL DEFAULT 'neutral'
98+ alignment TEXT NOT NULL DEFAULT 'neutral',
99+ speech_style TEXT NOT NULL DEFAULT 'mythic'
94100 );
95101 `);
96102 this.migrate();
97103 }
98104
99105 private migrate(): void {
100- // Add alignment column if it doesn't exist (for existing DBs)
106+ // Add alignment + speech_style columns if they don't exist (for existing DBs)
101107 const columns = this.db.query("PRAGMA table_info(credentials)").all() as {
102108 name: string;
103109 }[];
104110 const hasAlignment = columns.some((col) => col.name === "alignment");
111+ const hasSpeechStyle = columns.some((col) => col.name === "speech_style");
105112 if (!hasAlignment) {
106113 this.db.exec(
107114 "ALTER TABLE credentials ADD COLUMN alignment TEXT NOT NULL DEFAULT 'neutral'",
108115 );
109116 }
117+ if (!hasSpeechStyle) {
118+ this.db.exec(
119+ "ALTER TABLE credentials ADD COLUMN speech_style TEXT NOT NULL DEFAULT 'mythic'",
120+ );
121+ }
110122 }
111123
112124 getCredentials(): Credentials | null {
113125 const row = this.db
114126 .query(
115- "SELECT username, token, personality, alignment FROM credentials ORDER BY id DESC LIMIT 1",
127+ "SELECT username, token, personality, alignment, speech_style FROM credentials ORDER BY id DESC LIMIT 1",
116128 )
117129 .get() as
118130 | {
@@ -120,6 +132,7 @@ export class MemoryStore {
120132 token?: string;
121133 personality?: string;
122134 alignment?: string;
135+ speech_style?: string;
123136 }
124137 | undefined;
125138 if (!row || !row.username || !row.token || !row.personality) return null;
@@ -128,6 +141,7 @@ export class MemoryStore {
128141 token: row.token,
129142 personality: row.personality as PersonalityType,
130143 alignment: (row.alignment as AlignmentType) ?? "neutral",
144+ speech_style: (row.speech_style as SpeechStyleType) ?? "mythic",
131145 };
132146 }
133147
@@ -136,12 +150,13 @@ export class MemoryStore {
136150 token: string,
137151 personality: PersonalityType,
138152 alignment: AlignmentType,
153+ speechStyle: SpeechStyleType,
139154 ): void {
140155 this.db
141156 .query(
142- "INSERT INTO credentials (ts, username, token, personality, alignment) VALUES (?, ?, ?, ?, ?)",
157+ "INSERT INTO credentials (ts, username, token, personality, alignment, speech_style) VALUES (?, ?, ?, ?, ?, ?)",
143158 )
144- .run(nowIso(), username, token, personality, alignment);
159+ .run(nowIso(), username, token, personality, alignment, speechStyle);
145160 }
146161
147162 appendAction(
src/prompt.ts+30−4
@@ -4,9 +4,10 @@ import {
44 ALIGNMENT_DESCRIPTIONS,
55 MAX_GOAL_LENGTH,
66 PERSONALITY_ARCHETYPES,
7+ SPEECH_STYLE_DESCRIPTIONS,
78 } from "./constants";
89 import type { HistoryEntry } from "./memory";
9-import type { AlignmentType, PersonalityType } from "./types";
10+import type { AlignmentType, PersonalityType, SpeechStyleType } from "./types";
1011
1112 export interface PromptContext {
1213 state: ClientState;
@@ -16,6 +17,7 @@ export interface PromptContext {
1617 empire?: EmpireID;
1718 alignment?: AlignmentType;
1819 personality?: PersonalityType;
20+ speechStyle?: SpeechStyleType;
1921 repetitionWarning?: {
2022 action: string;
2123 count: number;
@@ -102,6 +104,13 @@ function getAlignmentGuidance(alignment: AlignmentType): string {
102104 }
103105 }
104106
107+function getSpeechStyleGuidance(style: SpeechStyleType): string {
108+ const info = SPEECH_STYLE_DESCRIPTIONS[style];
109+ return `${info.description}
110+- Naming: ${info.namingGuidance}
111+- Chat voice: ${info.chatGuidance}`;
112+}
113+
105114 function getEmpireDescription(empire: EmpireID): string {
106115 switch (empire) {
107116 case "solarian":
@@ -179,6 +188,8 @@ export function buildActionPrompt(context: PromptContext): string {
179188 const alignmentInfo = ALIGNMENT_DESCRIPTIONS[alignment];
180189 const personality = context.personality ?? "pragmatist";
181190 const personalityInfo = PERSONALITY_ARCHETYPES[personality];
191+ const speechStyle = context.speechStyle ?? "mythic";
192+ const speechStyleInfo = SPEECH_STYLE_DESCRIPTIONS[speechStyle];
182193 const warningBlock = context.repetitionWarning
183194 ? `
184195 REPETITION DETECTED: You performed "${context.repetitionWarning.action}" ${context.repetitionWarning.count} times in a row without progress.
@@ -213,6 +224,9 @@ YOUR PERSONALITY: ${personalityInfo.name}
213224 ${personalityInfo.description}
214225
215226 ${getPersonalityGuidance(personality)}
227+
228+YOUR SPEECH STYLE: ${speechStyleInfo.name}
229+${getSpeechStyleGuidance(speechStyle)}
216230 ${warningBlock}
217231 CURRENT STATE:
218232 ${stateText}
@@ -348,9 +362,18 @@ export function buildRegistrationPrompt(
348362 .join("\n");
349363 const personalityKeys = shuffledPersonalities.map(([key]) => key).join("|");
350364
351- return `You are creating a SpaceMolt account. Choose a username, empire, alignment, and personality.
365+ const shuffledSpeechStyles = shuffleArray(
366+ Object.entries(SPEECH_STYLE_DESCRIPTIONS),
367+ );
368+ const speechStyleDescriptions = shuffledSpeechStyles
369+ .map(([key, info]) => ` ${info.name} (${key}): ${info.description}`)
370+ .join("\n");
371+ const speechStyleKeys = shuffledSpeechStyles.map(([key]) => key).join("|");
372+
373+ return `You are creating a SpaceMolt account. Choose a username, empire, alignment, personality, and speech style.
352374 The username MUST be unique and original. Do not reuse any prior suggestions.
353375 To maximize uniqueness, include a distinctive suffix (digits or a short tag).
376+Let the speech style guide the username flavor and chat voice (not your goals).
354377
355378 EMPIRES:
356379 ${empireDescriptions}
@@ -361,7 +384,10 @@ ${alignmentDescriptions}
361384 PERSONALITY ARCHETYPES:
362385 ${personalityDescriptions}
363386
364-Choose an empire, alignment, and personality combination.
387+SPEECH STYLES:
388+${speechStyleDescriptions}
389+
390+Choose an empire, alignment, personality, and speech style combination.
365391 Briefly explain why you chose your personality (1 sentence).
366392
367393 Respond ONLY with JSON. No extra text.
@@ -369,7 +395,7 @@ ${helpBlock}
369395 ${failedBlock}
370396
371397 JSON SCHEMA:
372-{"username":"...","empire":"${empireKeys}","alignment":"${alignmentKeys}","personality":"${personalityKeys}","personality_reason":"..."}
398+{"username":"...","empire":"${empireKeys}","alignment":"${alignmentKeys}","personality":"${personalityKeys}","speech_style":"${speechStyleKeys}","personality_reason":"..."}
373399 `;
374400 }
375401
src/registration.ts+24−5
@@ -1,6 +1,10 @@
11 import type { SpaceMoltClient } from "../client/src/client";
22 import type { EmpireID } from "../client/src/types";
3-import { ALIGNMENT_DESCRIPTIONS, PERSONALITY_ARCHETYPES } from "./constants";
3+import {
4+ ALIGNMENT_DESCRIPTIONS,
5+ PERSONALITY_ARCHETYPES,
6+ SPEECH_STYLE_DESCRIPTIONS,
7+} from "./constants";
48 import type { OllamaAgent } from "./ollama";
59 import type { OutputInterface } from "./output-interface";
610 import { buildRegistrationPrompt } from "./prompt";
@@ -9,8 +13,14 @@ import type {
913 AlignmentType,
1014 RegistrationChoice,
1115 RegistrationOverrides,
16+ SpeechStyleType,
1217 } from "./types";
13-import { isValidAlignment, isValidEmpire, isValidPersonality } from "./utils";
18+import {
19+ isValidAlignment,
20+ isValidEmpire,
21+ isValidPersonality,
22+ isValidSpeechStyle,
23+} from "./utils";
1424
1525 export async function runRegistrationFlow(
1626 output: OutputInterface,
@@ -45,18 +55,23 @@ export async function runRegistrationFlow(
4555 const personality = String(
4656 result.json.personality ?? "",
4757 ).trim() as typeof result.json.personality;
58+ const speechStyle = String(
59+ result.json.speech_style ?? "",
60+ ).trim() as SpeechStyleType;
4861 const personalityReason = result.json.personality_reason
4962 ? String(result.json.personality_reason).trim()
5063 : undefined;
5164 const resolvedEmpire = overrides.empire ?? empire;
5265 const resolvedAlignment = overrides.alignment ?? alignment;
5366 const resolvedPersonality = overrides.personality ?? personality;
67+ const resolvedSpeechStyle = overrides.speech_style ?? speechStyle;
5468
5569 if (
5670 !username ||
5771 !isValidEmpire(resolvedEmpire) ||
5872 !isValidAlignment(resolvedAlignment) ||
59- !isValidPersonality(resolvedPersonality)
73+ !isValidPersonality(resolvedPersonality) ||
74+ !isValidSpeechStyle(resolvedSpeechStyle)
6075 ) {
6176 throw new Error("Invalid registration response");
6277 }
@@ -66,11 +81,13 @@ export async function runRegistrationFlow(
6681 empire: resolvedEmpire,
6782 alignment: resolvedAlignment,
6883 personality: resolvedPersonality,
84+ speech_style: resolvedSpeechStyle,
6985 personality_reason: personalityReason,
7086 };
7187
7288 const alignmentInfo = ALIGNMENT_DESCRIPTIONS[resolvedAlignment];
7389 const personalityInfo = PERSONALITY_ARCHETYPES[resolvedPersonality];
90+ const speechStyleInfo = SPEECH_STYLE_DESCRIPTIONS[resolvedSpeechStyle];
7491 output.log(
7592 formatSystemMessage(
7693 `Registering new account: ${username} (${resolvedEmpire})`,
@@ -78,7 +95,7 @@ export async function runRegistrationFlow(
7895 );
7996 output.log(
8097 formatSystemMessage(
81- `Chosen alignment: ${alignmentInfo.name}, personality: ${personalityInfo.name}${personalityReason ? ` - ${personalityReason}` : ""}`,
98+ `Chosen alignment: ${alignmentInfo.name}, personality: ${personalityInfo.name}, speech style: ${speechStyleInfo.name}${personalityReason ? ` - ${personalityReason}` : ""}`,
8299 ),
83100 );
84101 client.register(username, resolvedEmpire);
@@ -96,15 +113,17 @@ export async function runRegistrationFlow(
96113 const fallbackEmpire = overrides.empire ?? "solarian";
97114 const fallbackAlignment = overrides.alignment ?? "neutral";
98115 const fallbackPersonality = overrides.personality ?? "pragmatist";
116+ const fallbackSpeechStyle = overrides.speech_style ?? "mythic";
99117 const fallbackChoice: RegistrationChoice = {
100118 username: fallback,
101119 empire: fallbackEmpire,
102120 alignment: fallbackAlignment,
103121 personality: fallbackPersonality,
122+ speech_style: fallbackSpeechStyle,
104123 };
105124 output.log(
106125 formatSystemMessage(
107- `Falling back to account: ${fallback} (${fallbackEmpire}, ${fallbackAlignment}, ${fallbackPersonality})`,
126+ `Falling back to account: ${fallback} (${fallbackEmpire}, ${fallbackAlignment}, ${fallbackPersonality}, ${fallbackSpeechStyle})`,
108127 ),
109128 );
110129 client.register(fallback, fallbackEmpire);
src/swarm.ts+30−1
@@ -3,7 +3,12 @@ import { spawn } from "node:child_process";
33 import { appendFileSync, existsSync } from "node:fs";
44 import { parseArgs } from "node:util";
55
6-import { isValidAlignment, isValidEmpire, isValidPersonality } from "./utils";
6+import {
7+ isValidAlignment,
8+ isValidEmpire,
9+ isValidPersonality,
10+ isValidSpeechStyle,
11+} from "./utils";
712
813 const DEFAULT_COUNT = 5;
914 const DEFAULT_PREFIX = "swarm";
@@ -22,6 +27,7 @@ const { values } = parseArgs({
2227 empire: { type: "string" },
2328 alignment: { type: "string" },
2429 personality: { type: "string" },
30+ "speech-style": { type: "string", short: "s" },
2531 },
2632 strict: false,
2733 });
@@ -33,6 +39,7 @@ type SwarmConfig = {
3339 empire: string | null;
3440 alignment: string | null;
3541 personality: string | null;
42+ speechStyle: string | null;
3643 };
3744
3845 function logSwarm(message: string): void {
@@ -139,6 +146,22 @@ function parsePersonality(raw: unknown): string | null {
139146 return value;
140147 }
141148
149+function parseSpeechStyle(raw: unknown): string | null {
150+ if (raw === undefined) return null;
151+ if (typeof raw !== "string" || raw.trim() === "") {
152+ console.error("Error: --speech-style requires a value");
153+ process.exit(1);
154+ }
155+ const value = raw.trim().toLowerCase();
156+ if (!isValidSpeechStyle(value)) {
157+ console.error(
158+ "Error: --speech-style must be one of: mythic, punny, gritty, scholarly",
159+ );
160+ process.exit(1);
161+ }
162+ return value;
163+}
164+
142165 const swarmConfig: SwarmConfig = {
143166 count: parseCount(values.count),
144167 prefix: parsePrefix(values.prefix),
@@ -146,6 +169,7 @@ const swarmConfig: SwarmConfig = {
146169 empire: parseEmpire(values.empire),
147170 alignment: parseAlignment(values.alignment),
148171 personality: parsePersonality(values.personality),
172+ speechStyle: parseSpeechStyle(values["speech-style"]),
149173 };
150174
151175 const children = new Map<string, ReturnType<typeof spawn>>();
@@ -190,6 +214,9 @@ function buildArgs(instanceName: string): string[] {
190214 if (swarmConfig.personality) {
191215 args.push("--personality", swarmConfig.personality);
192216 }
217+ if (swarmConfig.speechStyle) {
218+ args.push("--speech-style", swarmConfig.speechStyle);
219+ }
193220 return args;
194221 }
195222
@@ -317,6 +344,8 @@ function startSwarm(): void {
317344 logSwarm(`override alignment=${swarmConfig.alignment}`);
318345 if (swarmConfig.personality)
319346 logSwarm(`override personality=${swarmConfig.personality}`);
347+ if (swarmConfig.speechStyle)
348+ logSwarm(`override speech-style=${swarmConfig.speechStyle}`);
320349
321350 swarmMembers = buildSwarmMembers();
322351 for (const name of swarmMembers) {
src/types.ts+5−0
@@ -9,6 +9,8 @@ export type PersonalityType =
99
1010 export type AlignmentType = "lawful" | "good" | "neutral" | "chaotic" | "evil";
1111
12+export type SpeechStyleType = "mythic" | "punny" | "gritty" | "scholarly";
13+
1214 export interface ActionDecision {
1315 action: string;
1416 args?: Record<string, unknown>;
@@ -20,6 +22,7 @@ export interface Credentials {
2022 token: string;
2123 personality: PersonalityType;
2224 alignment: AlignmentType;
25+ speech_style: SpeechStyleType;
2326 }
2427
2528 export interface RegistrationChoice {
@@ -27,6 +30,7 @@ export interface RegistrationChoice {
2730 empire: EmpireID;
2831 personality: PersonalityType;
2932 alignment: AlignmentType;
33+ speech_style: SpeechStyleType;
3034 personality_reason?: string;
3135 token?: string;
3236 }
@@ -35,6 +39,7 @@ export interface RegistrationOverrides {
3539 empire?: EmpireID;
3640 alignment?: AlignmentType;
3741 personality?: PersonalityType;
42+ speech_style?: SpeechStyleType;
3843 }
3944
4045 export interface PersonalityArchetype {
src/utils.ts+7−1
@@ -1,6 +1,6 @@
11 import type { EmpireID } from "../client/src/types";
22 import type { StoredAction } from "./memory";
3-import type { AlignmentType, PersonalityType } from "./types";
3+import type { AlignmentType, PersonalityType, SpeechStyleType } from "./types";
44
55 export function sleep(ms: number): Promise<void> {
66 return new Promise((resolve) => setTimeout(resolve, ms));
@@ -30,6 +30,12 @@ export function isValidPersonality(
3030 ].includes(personality);
3131 }
3232
33+export function isValidSpeechStyle(
34+ speechStyle: string,
35+): speechStyle is SpeechStyleType {
36+ return ["mythic", "punny", "gritty", "scholarly"].includes(speechStyle);
37+}
38+
3339 export function isNearbyTarget(
3440 nearby: { player_id?: string; username?: string }[] | undefined,
3541 targetId: unknown,