Initial commit
This commit is contained in:
Vendored
+39
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* 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;
|
||||
processAction(action: ActionResponse): ActionResult;
|
||||
saveGame(filename: string): Promise<void>;
|
||||
loadGame(filename: string): Promise<void>;
|
||||
getAvailableActions(): string[];
|
||||
getVisibleObjects(): string[];
|
||||
getVisibleCharacters(): string[];
|
||||
getCurrentRoomDescription(): string;
|
||||
start(): Promise<string>;
|
||||
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;
|
||||
}
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Interfaces for the game engine
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=engine.js.map
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../src/interfaces/engine.ts"],"names":[],"mappings":";AAAA;;GAEG"}
|
||||
Vendored
+46
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* Interfaces for LLM integration
|
||||
*/
|
||||
export interface LlmConfig {
|
||||
apiKey: string;
|
||||
model: string;
|
||||
temperature?: number;
|
||||
maxTokens?: number;
|
||||
topP?: number;
|
||||
frequencyPenalty?: number;
|
||||
presencePenalty?: number;
|
||||
}
|
||||
export interface ActionRequest {
|
||||
playerInput: string;
|
||||
currentRoom: string;
|
||||
visibleObjects: string[];
|
||||
visibleCharacters: string[];
|
||||
possibleActions: string[];
|
||||
inventory: string[];
|
||||
gameContext: string;
|
||||
}
|
||||
export interface ActionResponse {
|
||||
action: string;
|
||||
object?: string;
|
||||
target?: string;
|
||||
parameters?: Record<string, string>;
|
||||
confidence: number;
|
||||
}
|
||||
export interface NarrativeRequest {
|
||||
action: string;
|
||||
result: string;
|
||||
roomDescription: string;
|
||||
visibleObjects: string[];
|
||||
visibleCharacters: string[];
|
||||
previousContext?: string;
|
||||
tone?: string;
|
||||
}
|
||||
export interface NarrativeResponse {
|
||||
text: string;
|
||||
suggestions?: string[];
|
||||
}
|
||||
export interface LlmProvider {
|
||||
initialize(config: LlmConfig): Promise<void>;
|
||||
translateAction(request: ActionRequest): Promise<ActionResponse>;
|
||||
generateNarrative(request: NarrativeRequest): Promise<NarrativeResponse>;
|
||||
}
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Interfaces for LLM integration
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=llm.js.map
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"llm.js","sourceRoot":"","sources":["../../src/interfaces/llm.ts"],"names":[],"mappings":";AAAA;;GAEG"}
|
||||
Vendored
+61
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* Core interfaces for the interactive fiction world model
|
||||
*/
|
||||
export interface Room {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
exits: Exit[];
|
||||
objects: string[];
|
||||
characters: string[];
|
||||
}
|
||||
export interface Exit {
|
||||
direction: string;
|
||||
targetRoomId: string;
|
||||
description?: string;
|
||||
isLocked?: boolean;
|
||||
keyId?: string;
|
||||
}
|
||||
export interface GameObject {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
traits: string[];
|
||||
states: Record<string, boolean>;
|
||||
containedObjects?: string[];
|
||||
allowedActions: string[];
|
||||
}
|
||||
export interface Character {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
dialogue: Record<string, string>;
|
||||
inventory: string[];
|
||||
defaultResponse: string;
|
||||
mood?: string;
|
||||
}
|
||||
export interface Action {
|
||||
name: string;
|
||||
patterns: string[];
|
||||
requiresObject?: boolean;
|
||||
requiresTarget?: boolean;
|
||||
handler: string;
|
||||
}
|
||||
export interface GameState {
|
||||
currentRoomId: string;
|
||||
inventory: string[];
|
||||
visitedRooms: string[];
|
||||
flags: Record<string, boolean>;
|
||||
counters: Record<string, number>;
|
||||
}
|
||||
export interface WorldModel {
|
||||
title: string;
|
||||
author: string;
|
||||
version: string;
|
||||
introduction: string;
|
||||
rooms: Record<string, Room>;
|
||||
objects: Record<string, GameObject>;
|
||||
characters: Record<string, Character>;
|
||||
actions: Record<string, Action>;
|
||||
initialState: GameState;
|
||||
}
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Core interfaces for the interactive fiction world model
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=world-model.js.map
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"world-model.js","sourceRoot":"","sources":["../../src/interfaces/world-model.ts"],"names":[],"mappings":";AAAA;;GAEG"}
|
||||
Reference in New Issue
Block a user