mahler
Version:
A automated task composer and HTN based planner for building autonomous system agents
50 lines (49 loc) • 1.24 kB
TypeScript
import type { Value } from '../dag';
import { Node } from '../dag';
type Branch = DAG;
type Fork = Branch[];
type DAG = Array<string | Fork>;
export interface Label extends Value {
readonly id: string;
}
interface PlanBuilder {
/**
* Adds an action to the plan
*/
action(description: string): PlanBuilder;
/**
* Adds a list of actions to the plan
*/
actions(...descriptions: [string, ...string[]]): PlanBuilder;
/**
* Fork the plan adding branches
*/
fork(...branches: [Branch, ...Branch[]]): PlanBuilder;
/**
* Returns the root node for the plan
*/
root(): Node | null;
/**
* Return the string representation
*/
end(): string;
}
/**
* Start building a plan
*/
export declare function plan(): PlanBuilder;
/**
* Utility method to create a branch from an array
* of values
*
* Each value may be a string or the result of `fork()`
*/
export declare function branch(...values: Branch): Branch;
/**
* Create a new fork from a list of branches
*
* Branches are returned by the `branch` method
*/
export declare function fork(...branches: Branch[]): Fork;
export declare function sequence(...actions: [string, ...string[]]): string;
export {};