@@ -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);