goap-oriented
Version:
A TypeScript implementation of Goal-Oriented Action Planning
40 lines (39 loc) • 1.34 kB
TypeScript
import { WorldState, Action, Goal } from './types';
/**
* Agent class that manages planning and execution of actions to achieve goals
* using GOAP (Goal-Oriented Action Planning).
*/
export declare class Agent {
private worldState;
private planner;
private currentPlan;
/**
* Creates a new Agent instance.
* @param initialState - The initial world state for the agent
*/
constructor(initialState: WorldState);
/**
* Adds an action to the agent's available actions.
* @param action - The action to add to the planner
*/
addAction(action: Action): void;
/**
* Attempts to execute a plan to achieve the specified goal.
* @param goal - The goal state to achieve
* @returns Promise that resolves to true if plan execution was successful, false otherwise
*/
executePlan(goal: Goal): Promise<boolean>;
/**
* Updates the world state based on an action's effects.
* @param state - The current world state
* @param action - The action whose effects should be applied
* @returns Updated world state after applying the action's effects
* @private
*/
private updateWorldState;
/**
* Returns a copy of the current world state.
* @returns Copy of the current world state
*/
getCurrentState(): WorldState;
}