fix(launcher): report game exits separately

Keep successful process creation separate from exit status. Report the exit code and game log directory when the process exits abnormally.

Verified by type checking and launcher build. The guarded game exit remains part of acceptance.
This commit is contained in:
N0VAN0M4LY committed 2026-11-30 15:23:15 +08:00
1 parent b3a30c0fd9
commit 84158f719d
9 files changed
+55 -26

No files matched your search

+10 -1
View File
@@ -1,10 +1,18 @@
import { z } from 'zod';
import { APP_ERROR_CODES } from '../errors.ts';
const GameExitSchema = z.object({
code: z.number().int().nullable(),
signal: z.string().nullable(),
logFolder: z.string(),
});
export type GameExit = z.output<typeof GameExitSchema>;
export const LaunchStateSchema = z.object({
phase: z.enum([
'ready', 'checking', 'building', 'starting-server', 'starting-game', 'running',
'server-running', 'stopping', 'port-busy', 'version-changed', 'server-exited', 'failed',
'server-running', 'game-exited', 'stopping', 'port-busy', 'version-changed', 'server-exited', 'failed',
]),
copyId: z.uuid().optional(),
port: z.number().int().min(1).max(65535).optional(),
@@ -12,6 +20,7 @@ export const LaunchStateSchema = z.object({
filesTotal: z.number().int().nonnegative().optional(),
file: z.string().optional(),
actualVersion: z.string().nullable().optional(),
gameExit: GameExitSchema.optional(),
error: z.enum(APP_ERROR_CODES).optional(),
});