askeroo
Version:
A modern CLI prompt library with flow control, history navigation, and conditional prompts
48 lines • 1.48 kB
TypeScript
/**
* RuntimeContext - Manages global runtime instance and lifecycle
*
* Provides centralized state management for the current runtime instance,
* with proper lifecycle management and error handling.
*/
export interface RuntimeAPI {
executeFlow: Function;
ask: Function;
BACK: any;
rescanStaticGroupFields: Function;
executeGroupBody: Function;
handleCtrlC: Function;
registerCancelCallback: Function;
[key: string]: any;
}
declare class RuntimeContextManager {
private currentRuntime;
/**
* Set the current runtime instance
*/
setCurrentRuntime(runtime: RuntimeAPI): void;
/**
* Get the current runtime instance
* Throws error if no runtime is available
*/
getCurrentRuntime(): RuntimeAPI;
/**
* Check if a runtime is currently set
*/
hasRuntime(): boolean;
/**
* Clear the current runtime instance
*/
clearRuntime(): void;
/**
* Get runtime for plugin access with type checking
*/
getPluginRuntime(pluginType: string): RuntimeAPI;
}
export declare const runtimeContext: RuntimeContextManager;
export declare function setCurrentRuntime(runtime: RuntimeAPI): void;
export declare function getCurrentRuntime(): RuntimeAPI;
export declare function hasRuntime(): boolean;
export declare function clearRuntime(): void;
export declare function getPluginRuntime(pluginType: string): RuntimeAPI;
export {};
//# sourceMappingURL=runtime-context.d.ts.map