UNPKG

@wandelbots/nova-js

Version:

Official JS client for the Wandelbots API

53 lines 1.77 kB
import { AutoReconnectingWebsocket } from "../AutoReconnectingWebsocket"; import type { MotionStreamConnection } from "./MotionStreamConnection"; import type { NovaClient } from "./NovaClient"; export type ProgramRunnerLogEntry = { timestamp: number; message: string; level?: "warn" | "error"; }; export declare enum ProgramState { NotStarted = "not started", Running = "running", Stopped = "stopped", Failed = "failed", Completed = "completed" } export type CurrentProgram = { id?: string; wandelscript?: string; state?: ProgramState; }; type ProgramStateMessage = { type: string; runner: { id: string; state: ProgramState; start_time?: number | null; execution_time?: number | null; }; }; /** * Interface for running Wandelscript programs on the Nova instance and * tracking their progress and output */ export declare class ProgramStateConnection { readonly nova: NovaClient; currentProgram: CurrentProgram; logs: ProgramRunnerLogEntry[]; executionState: "idle" | "starting" | "executing" | "stopping"; currentlyExecutingProgramRunnerId: string | null; programStateSocket: AutoReconnectingWebsocket; constructor(nova: NovaClient); /** Handle a program state update from the backend */ handleProgramStateMessage(msg: ProgramStateMessage): Promise<void>; /** Call when a program is no longer executing */ gotoIdleState(): void; executeProgram(wandelscript: string, initial_state?: Object, activeRobot?: MotionStreamConnection): Promise<void>; stopProgram(): Promise<void>; reset(): void; log(message: string): void; logError(message: string): void; } export {}; //# sourceMappingURL=ProgramStateConnection.d.ts.map