xonecas.io
5875
Os

ollama-space-molt-player / commit bd3e4d4

refactor: remove register and login action validation

xonecas2026-02-01 bd3e4d42828d444ebd22f7c8d3d03108f8979a72 parent 6894807

3 files changed

src/actions.ts+0−36
@@ -1,8 +1,6 @@
11 import type { SpaceMoltClient } from "../client/src/client";
2-import type { EmpireID } from "../client/src/types";
32 import { ACTION_DEFINITIONS, MAX_MISSION_LENGTH } from "./constants";
43 import type { ActionDecision } from "./types";
5-import { isValidEmpire } from "./utils";
64
75 export { MAX_MISSION_LENGTH, PERSONALITY_ARCHETYPES } from "./constants";
86 export type { ActionDecision, PersonalityType } from "./types";
@@ -109,31 +107,6 @@ export function validateAction(decision: unknown): {
109107 }
110108 }
111109
112- if (action === "register") {
113- const username = String(args.username ?? "").trim();
114- const empire = String(args.empire ?? "").trim();
115- if (!username) {
116- return { ok: false, error: "register.username is required" };
117- }
118- if (!empire) {
119- return { ok: false, error: "register.empire is required" };
120- }
121- if (!isValidEmpire(empire)) {
122- return { ok: false, error: "register.empire is invalid" };
123- }
124- }
125-
126- if (action === "login") {
127- const username = String(args.username ?? "").trim();
128- const token = String(args.token ?? "").trim();
129- if (!username) {
130- return { ok: false, error: "login.username is required" };
131- }
132- if (!token) {
133- return { ok: false, error: "login.token is required" };
134- }
135- }
136-
137110 if (action === "forum") {
138111 if (args.page !== undefined) {
139112 const page = Number(args.page);
@@ -234,15 +207,6 @@ export function dispatchAction(
234207 const args = decision.args ?? {};
235208
236209 switch (decision.action) {
237- case "register":
238- client.register(String(args.username), String(args.empire) as EmpireID);
239- return `register ${String(args.username)}`;
240- case "login":
241- client.login(String(args.username), String(args.token));
242- return `login ${String(args.username)}`;
243- case "logout":
244- client.logout();
245- return "logout";
246210 case "travel":
247211 client.travel(String(args.target_poi));
248212 return `travel ${String(args.target_poi)}`;
src/constants.ts+0−3
@@ -121,9 +121,6 @@ export const PERSONALITY_ARCHETYPES: Record<
121121 };
122122
123123 export const ACTION_DEFINITIONS: Record<string, string[]> = {
124- register: ["username", "empire"],
125- login: ["username", "token"],
126- logout: [],
127124 travel: ["target_poi"],
128125 jump: ["target_system"],
129126 dock: [],
src/prompt.ts+1−9
@@ -148,12 +148,6 @@ export function isStranded(
148148 }
149149
150150 const HELP_TEXT = `Available actions:
151-
152-Connection Commands:
153- register <username> <empire> - Create new account (empires: solarian, voidborn, crimson, nebula, outerrim)
154- login <username> <token> - Login to existing account
155- logout - Logout
156-
157151 Navigation:
158152 travel <poi_id> - Travel to a POI within current system
159153 jump <system_id> - Jump to connected system
@@ -303,7 +297,7 @@ ${lastActionText}
303297 ${forumContextBlock}
304298
305299 ACTION SCHEMA (JSON ONLY):
306- {"mission":"...","action":"register|login|logout|travel|jump|dock|undock|mine|attack|scan|buy|sell|refuel|repair|craft|chat|say|faction|msg|create_faction|set_status|set_colors|set_anonymous|status|system|poi|base|skills|recipes|version|nearby|cargo|forum|forum_thread|forum_post|forum_reply|forum_upvote|help|wait","args":{...}}
300+ {"mission":"...","action":"travel|jump|dock|undock|mine|attack|scan|buy|sell|refuel|repair|craft|chat|say|faction|msg|create_faction|set_status|set_colors|set_anonymous|status|system|poi|base|skills|recipes|version|nearby|cargo|forum|forum_thread|forum_post|forum_reply|forum_upvote|help|wait","args":{...}}
307301
308302 REQUIRED ARGS:
309303 - travel: {"target_poi":"..."}
@@ -326,8 +320,6 @@ REQUIRED ARGS:
326320 - forum_post: {"category":"...","title":"...","content":"..."}
327321 - forum_reply: {"thread_id":"...","content":"..."}
328322 - forum_upvote: {"thread_id":"..."} or {"reply_id":"..."}
329-- register: {"username":"...","empire":"solarian|voidborn|crimson|nebula|outerrim"}
330-- login: {"username":"...","token":"..."}
331323
332324 FORMAT RULES:
333325 - Use only the listed actions.