feat: Integrate Kokoro TTS with WebGPU and fallback

This commit is contained in:
2025-04-01 10:34:24 +00:00
parent 113e3b995d
commit 1882acac8c
111 changed files with 9143 additions and 4447 deletions
+55 -55
View File
@@ -1,56 +1,56 @@
/**
* Interfaces for the game engine
*/
import { WorldModel, GameState } from './world-model';
import { ActionResponse, NarrativeResponse } from './llm';
export interface ActionResult {
success: boolean;
message: string;
stateChanged: boolean;
newState?: GameState;
}
export interface GameEngine {
loadWorld(worldModelPath: string): Promise<void>;
getCurrentState(): GameState;
getWorldModel(): WorldModel;
// Action processing
processAction(action: ActionResponse): ActionResult;
// State management
saveGame(filename: string): Promise<void>;
loadGame(filename: string): Promise<void>;
// Helper methods for world interaction
getAvailableActions(): string[];
getVisibleObjects(): string[];
getVisibleCharacters(): string[];
getCurrentRoomDescription(): string;
// Game flow
start(): Promise<string>; // Returns introduction text
end(): void;
}
export interface GameSession {
engine: GameEngine;
history: {
playerInput: string;
actionResponse: ActionResponse;
actionResult: ActionResult;
narrativeResponse: NarrativeResponse;
}[];
startTime: Date;
lastInteractionTime: Date;
}
export interface ActionHandler {
execute(
gameState: GameState,
worldModel: WorldModel,
action: ActionResponse
): ActionResult;
/**
* Interfaces for the game engine
*/
import { WorldModel, GameState } from './world-model';
import { ActionResponse, NarrativeResponse } from './llm';
export interface ActionResult {
success: boolean;
message: string;
stateChanged: boolean;
newState?: GameState;
}
export interface GameEngine {
loadWorld(worldModelPath: string): Promise<void>;
getCurrentState(): GameState;
getWorldModel(): WorldModel;
// Action processing
processAction(action: ActionResponse): ActionResult;
// State management
saveGame(filename: string): Promise<void>;
loadGame(filename: string): Promise<void>;
// Helper methods for world interaction
getAvailableActions(): string[];
getVisibleObjects(): string[];
getVisibleCharacters(): string[];
getCurrentRoomDescription(): string;
// Game flow
start(): Promise<string>; // Returns introduction text
end(): void;
}
export interface GameSession {
engine: GameEngine;
history: {
playerInput: string;
actionResponse: ActionResponse;
actionResult: ActionResult;
narrativeResponse: NarrativeResponse;
}[];
startTime: Date;
lastInteractionTime: Date;
}
export interface ActionHandler {
execute(
gameState: GameState,
worldModel: WorldModel,
action: ActionResponse
): ActionResult;
}