@informalsystems/quint
Version:
Core tool for the Quint specification language
62 lines (61 loc) • 2.22 kB
TypeScript
/**
* Interface to Apalache
*
* This functionality is enabled by managing and interacting with the Apalache
* server.
*
* @author Shon Feder, Informal Systems, 2024
* @author Igor Konnov, konnov.phd, 2024
*
* @module
*/
import { Either } from '@sweet-monads/either';
import { ErrorMessage } from './ErrorMessage';
import { ItfTrace } from './itf';
/**
* A server endpoint for establishing a connection with the Apalache server.
*/
export interface ServerEndpoint {
hostname: string;
port: number;
}
/**
* Parse an endpoint URL in the format hostname:port
* @param input the string to parse
* @returns either `left(error)`, or `right(ServerEndpoint)`
*/
export declare function parseServerEndpoint(input: string): Either<string, ServerEndpoint>;
export declare function createConfig(loadedConfig: any, parsedSpec: string, args: any, inv?: string[], init?: string, next?: string): ApalacheConfig;
/**
* Convert an endpoint to a GRPC connection string.
* @param endpoint an endpoint
* @returns the connection string expected by the Apalache server API
*/
export declare function serverEndpointToConnectionString(endpoint: ServerEndpoint): string;
export declare const DEFAULT_APALACHE_VERSION_TAG = "0.51.1";
type ApalacheError = {
explanation: string;
errors: ErrorMessage[];
traces?: ItfTrace[];
};
export type ApalacheResult<T> = Either<ApalacheError, T>;
export type ApalacheConfig = any;
type Apalache = {
check: (c: ApalacheConfig) => Promise<ApalacheResult<void>>;
tla: (c: ApalacheConfig) => Promise<ApalacheResult<string>>;
};
/**
* Connect to an already running Apalache server, or – if unsuccessful – fetch
* Apalache, spawn it, and connect to it.
*
* If an Apalache server is spawned, the child process exits when the parent process (i.e., this process) terminates.
*
* @param serverEndpoint
* a server endpoint
*
* @returns A promise resolving to:
* - a `right<Apalache>` equal to the path the Apalache dist was unpacked to,
* - a `left<ApalacheError>` indicating an error.
*/
export declare function connect(serverEndpoint: ServerEndpoint, apalacheVersion: string, verbosityLevel: number): Promise<ApalacheResult<Apalache>>;
export {};