UNPKG

ai-planning-val

Version:

Javascript/typescript wrapper for VAL (AI Planning plan validation and evaluation tools from KCL Planning department and the planning community around the ICAPS conference).

83 lines (82 loc) 3.58 kB
import { DomainInfo, ParsingProblem, ParsingProblemSeverity, PddlPosition, PddlRange, PlanInfo, ProblemInfo } from 'pddl-workspace'; import { URI } from 'vscode-uri'; /** * Plan validating using the VAL validator executable. */ export declare class PlanValidator { private readonly outputCallback; constructor(outputCallback: (outputText: string) => void); validate(domain: DomainInfo, problem: ProblemInfo, plan: PlanInfo, options: { validatePath: string; epsilon?: number; cwd: string; }): Promise<PlanValidationOutcome>; private runProcess; private analyzeOutput; } export declare class PlanValidationOutcome { planInfo: PlanInfo; private diagnostics; private error?; constructor(planInfo: PlanInfo, diagnostics: ParsingProblem[], error?: string | undefined); getPlanProblems(): ParsingProblem[]; getError(): string | undefined; static goalNotAttained(planInfo: PlanInfo): PlanValidationOutcome; /** * Creates validation outcomes for invalid plan i.e. plans that do not parse or do not correspond to the domain/problem file. */ static invalidPlanDescription(planInfo: PlanInfo): PlanValidationOutcome; /** * Creates validation outcomes for valid plan, which does not reach the goal. */ static valid(planInfo: PlanInfo): PlanValidationOutcome; /** * Creates validation outcomes for valid plan, which does not reach the goal. */ static validWithDiagnostics(planInfo: PlanInfo, diagnostics: ParsingProblem[]): PlanValidationOutcome; static failed(planInfo: PlanInfo, error: Error): PlanValidationOutcome; static createDiagnostics(planInfo: PlanInfo, timeStamp: number, repairHints: string[], options?: PlanValidationOutcomeOptions): ParsingProblem[]; static createDiagnostic(planInfo: PlanInfo, range: PddlRange, message: string, options?: PlanValidationOutcomeOptions): ParsingProblem; static failedAtTime(planInfo: PlanInfo, timeStamp: number, repairHints: string[], options?: PlanValidationOutcomeOptions): PlanValidationOutcome; static otherError(planInfo: PlanInfo, error: string): PlanValidationOutcome; static unknown(planInfo: PlanInfo): PlanValidationOutcome; } export interface PlanValidationOutcomeOptions { severity?: ParsingProblemSeverity; showMoreInfoHint?: boolean; } export declare class PlanProblem extends ParsingProblem { relatedInformation: DiagnosticRelatedInformation[]; constructor(range: PddlRange, problem: string, severity: ParsingProblemSeverity); } /** * Represents a related message and source code location for a diagnostic. This should be * used to point to code locations that cause or related to a diagnostics, e.g. when duplicating * a symbol in a scope. */ export declare class DiagnosticRelatedInformation { readonly location: PddlLocation; readonly message: string; /** * Creates a new related diagnostic information object. * * @param location The location. * @param message The message. */ constructor(location: PddlLocation, message: string); } /** * Represents a location inside a resource, such as a line * inside a text file. */ export declare class PddlLocation { readonly uri: URI; readonly rangeOrPosition: PddlRange | PddlPosition; /** * Creates a new location object. * * @param uri The resource identifier. * @param rangeOrPosition The range or position. Positions will be converted to an empty range. */ constructor(uri: URI, rangeOrPosition: PddlRange | PddlPosition); }