Checkpoint Eibenreith ink architecture

This commit is contained in:
2026-05-24 09:09:41 +02:00
parent beac5a2be3
commit d42540f29d
35 changed files with 12015 additions and 54 deletions
+1 -1
View File
@@ -78,7 +78,7 @@ export class InkEngine {
private story: Story | null = null;
private nextTurnId = 1;
private storyJson: any = null;
private readonly choicePreviewTagKeys = new Set(['action', 'key', 'letter', 'optional', 'gated', 'sort']);
private readonly choicePreviewTagKeys = new Set(['action', 'key', 'letter', 'optional', 'gated', 'sort', 'auto']);
constructor(private readonly storyPath: string) {}
+3 -2
View File
@@ -210,12 +210,13 @@ io.on('connection', (socket) => {
}
const command = String(data?.command || '').trim();
const requestId = Number(data?.requestId || 0);
// During typography and animation work, mirror the command back through
// the real socket path so the UI pipeline can be tested end to end.
socket.emit('narrativeResponse', createTextTurn(socket.id, command, {
socket.emit('narrativeResponse', withClientRequestId(createTextTurn(socket.id, command, {
currentRoomId: gameRunner.getGameState().currentRoomId
}, gameRunner.getSuggestions()));
}, gameRunner.getSuggestions()), Number.isInteger(requestId) && requestId > 0 ? requestId : undefined));
} catch (error) {
console.error('Error processing command:', error);
+6 -2
View File
@@ -272,7 +272,7 @@ io.on('connection', (socket) => {
socket.on(
'playerCommand',
async (data: { command?: string }) => {
async (data: { command?: string; requestId?: number }) => {
const engine = sessions.get(socket.id);
if (!engine?.isRunning()) {
socket.emit('error', {
@@ -282,6 +282,7 @@ io.on('connection', (socket) => {
}
const input = String(data?.command ?? '').trim();
const requestId = Number(data?.requestId || 0);
if (!input) return;
debugLog(`playerCommand from ${socket.id}: ${input}`);
@@ -292,7 +293,10 @@ io.on('connection', (socket) => {
paragraphs: turn.paragraphs.length,
statusLine: turn.gameState?.statusLine,
});
socket.emit('narrativeResponse', toClientTurn(turn));
socket.emit(
'narrativeResponse',
withClientRequestId(toClientTurn(turn), Number.isInteger(requestId) && requestId > 0 ? requestId : undefined),
);
} catch (error) {
console.error('[zcode] playerCommand error:', error);
socket.emit('error', {