@qodalis/cli 2.0.0-beta.1 → 2.0.0-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/public-api.d.ts CHANGED
@@ -1,8 +1,10 @@
1
1
  import * as _qodalis_cli_core from '@qodalis/cli-core';
2
- import { ICliCommandProcessor, ICliCommandParameterDescriptor, ICliCommandProcessorRegistry, ICliCommandChildProcessor, CliProcessorMetadata, CliStateConfiguration, ICliExecutionContext, CliProcessCommand, ICliCommandAuthor, CliThemeInfo, ICliExecutionProcess, ICliUserSession, ICliSpinner, ICliPercentageProgressBar, ICliTextAnimator, ICliTerminalWriter, ICliCommandExecutorService, ICliClipboard, ICliStateStore, CliOptions, ICliLogger, ICliServiceProvider, ICliTranslationService, ICliInputReader, ICliBackgroundServiceRegistry, ICliManagedInterval, ICliManagedTimer, ICliKeyValueStore, CliSelectOption, CliMultiSelectOption, ICliCompletionProvider, ICliGlobalParameterHandler, CliProvider, CliForegroundColor, CliBackgroundColor, CliLogLevel, CliPercentageProgressBarUpdateValueOptions, CliTextAnimatorOptions, ICliModule, CliModuleRegistry, Package, ICliPingServerService, ICliProcessRegistry, ICliProcessEntry, ICliDragDropService, CliState, CliEngineSnapshot, CliServerConfig, CliServerCommandDescriptor, CliServerCapabilities, CliServerResponse, CliIcon } from '@qodalis/cli-core';
2
+ import { ICliCommandProcessor, ICliCommandParameterDescriptor, ICliCommandProcessorRegistry, ICliCommandChildProcessor, CliProcessorMetadata, CliStateConfiguration, ICliExecutionContext, CliProcessCommand, ICliCommandAuthor, CliThemeInfo, ICliExecutionProcess, ICliUserSession, ICliSpinner, ICliPercentageProgressBar, ICliTextAnimator, ICliTerminalWriter, ICliCommandExecutorService, ICliClipboard, ICliStateStore, CliOptions, ICliLogger, ICliServiceProvider, ICliTranslationService, ICliInputReader, ICliBackgroundServiceRegistry, ICliManagedInterval, ICliManagedTimer, ICliKeyValueStore, ICliCompletionProvider, ICliFilePickerProvider, CliFullScreenOptions, ICliProcessRegistry, ICliBackgroundService, ICliServiceContext, ICliBackgroundServiceInfo, ICliServiceLogEntry, CliServiceEventHandler, ICliGlobalParameterHandler, CliForegroundColor, CliBackgroundColor, CliProvider, CliTableOptions, CliLogLevel, CliPercentageProgressBarUpdateValueOptions, CliTextAnimatorOptions, ICliModule, CliModuleRegistry, Package, ICliPingServerService, CliLineOptions, CliSelectOption, CliSelectOptions, CliMultiSelectOption, CliMultiSelectOptions, CliNumberOptions, CliDateOptions, CliFilePickerOptions, CliFileResult, ICliProcessRegisterOptions, ICliProcessEntry, ICliDragDropService, CliState, CliEngineSnapshot, CliServerConfig, CliServerCommandDescriptor, CliServerCapabilities, CliServerResponse, CliServerOutput, CliIcon } from '@qodalis/cli-core';
3
3
  export { ICliUserSessionService_TOKEN, ICliUsersStoreService_TOKEN } from '@qodalis/cli-core';
4
4
  import { ITheme, Terminal, ITerminalAddon, ITerminalOptions, ITerminalInitOnlyOptions } from '@xterm/xterm';
5
5
  import { Subject, Observable, Subscription } from 'rxjs';
6
+ import { FitAddon } from '@xterm/addon-fit';
7
+ import { SerializeAddon } from '@xterm/addon-serialize';
6
8
 
7
9
  type ParsedArg = {
8
10
  name: string;
@@ -140,7 +142,7 @@ declare const CliBackgroundServiceRegistry_TOKEN = "cli-background-service-regis
140
142
  */
141
143
  declare const CliPackageManagerService_TOKEN = "cli-package-manager-service";
142
144
 
143
- declare const LIBRARY_VERSION = "2.0.0-beta.1";
145
+ declare const LIBRARY_VERSION = "2.0.0-beta.11";
144
146
  declare const API_VERSION = 2;
145
147
 
146
148
  declare class CliAliasCommandProcessor implements ICliCommandProcessor {
@@ -158,18 +160,6 @@ declare class CliAliasCommandProcessor implements ICliCommandProcessor {
158
160
  initialize(context: ICliExecutionContext): Promise<void>;
159
161
  }
160
162
 
161
- declare class CliBase64CommandProcessor implements ICliCommandProcessor {
162
- command: string;
163
- aliases: string[];
164
- description: string;
165
- author: _qodalis_cli_core.ICliCommandAuthor;
166
- processors?: ICliCommandProcessor[];
167
- metadata?: CliProcessorMetadata;
168
- constructor();
169
- processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
170
- writeDescription(context: ICliExecutionContext): void;
171
- }
172
-
173
163
  declare class CliCalCommandProcessor implements ICliCommandProcessor {
174
164
  command: string;
175
165
  aliases: string[];
@@ -268,28 +258,6 @@ declare class CliEvalCommandProcessor implements ICliCommandProcessor {
268
258
  writeDescription(context: ICliExecutionContext): void;
269
259
  }
270
260
 
271
- declare class CliHashCommandProcessor implements ICliCommandProcessor {
272
- command: string;
273
- description: string;
274
- author: _qodalis_cli_core.ICliCommandAuthor;
275
- processors?: ICliCommandProcessor[];
276
- metadata?: CliProcessorMetadata;
277
- constructor();
278
- processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
279
- writeDescription(context: ICliExecutionContext): void;
280
- }
281
-
282
- declare class CliHexCommandProcessor implements ICliCommandProcessor {
283
- command: string;
284
- description: string;
285
- author: _qodalis_cli_core.ICliCommandAuthor;
286
- processors?: ICliCommandProcessor[];
287
- metadata?: CliProcessorMetadata;
288
- constructor();
289
- processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
290
- writeDescription(context: ICliExecutionContext): void;
291
- }
292
-
293
261
  declare class CliJsonCommandProcessor implements ICliCommandProcessor {
294
262
  command: string;
295
263
  description: string;
@@ -301,18 +269,6 @@ declare class CliJsonCommandProcessor implements ICliCommandProcessor {
301
269
  writeDescription(context: ICliExecutionContext): void;
302
270
  }
303
271
 
304
- declare class CliJwtCommandProcessor implements ICliCommandProcessor {
305
- command: string;
306
- description: string;
307
- author: _qodalis_cli_core.ICliCommandAuthor;
308
- processors?: ICliCommandProcessor[];
309
- metadata?: CliProcessorMetadata;
310
- constructor();
311
- processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
312
- writeDescription(context: ICliExecutionContext): void;
313
- private base64UrlDecode;
314
- }
315
-
316
272
  declare class CliLoremCommandProcessor implements ICliCommandProcessor {
317
273
  command: string;
318
274
  aliases: string[];
@@ -452,23 +408,11 @@ declare class CliUptimeCommandProcessor implements ICliCommandProcessor {
452
408
  description: string;
453
409
  author: _qodalis_cli_core.ICliCommandAuthor;
454
410
  metadata?: CliProcessorMetadata;
455
- private sessionStartTimes;
456
411
  initialize(context: ICliExecutionContext): Promise<void>;
457
412
  processCommand(_: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
458
413
  writeDescription(context: ICliExecutionContext): void;
459
414
  }
460
415
 
461
- declare class CliUrlCommandProcessor implements ICliCommandProcessor {
462
- command: string;
463
- description: string;
464
- author: _qodalis_cli_core.ICliCommandAuthor;
465
- processors?: ICliCommandProcessor[];
466
- metadata?: CliProcessorMetadata;
467
- constructor();
468
- processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
469
- writeDescription(context: ICliExecutionContext): void;
470
- }
471
-
472
416
  declare class CliYesCommandProcessor implements ICliCommandProcessor {
473
417
  command: string;
474
418
  description: string;
@@ -657,6 +601,7 @@ declare class CliNanoCommandProcessor implements ICliCommandProcessor {
657
601
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
658
602
  onData(data: string, context: ICliExecutionContext): Promise<void>;
659
603
  writeDescription(context: ICliExecutionContext): void;
604
+ private setupHighlighting;
660
605
  private render;
661
606
  private renderPrompt;
662
607
  private showStatus;
@@ -706,6 +651,43 @@ declare class CliKillCommandProcessor implements ICliCommandProcessor {
706
651
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
707
652
  }
708
653
 
654
+ declare class CliHtopCommandProcessor implements ICliCommandProcessor {
655
+ command: string;
656
+ description: string;
657
+ author: _qodalis_cli_core.ICliCommandAuthor;
658
+ metadata?: CliProcessorMetadata;
659
+ private context;
660
+ private registry;
661
+ private refreshTimer;
662
+ private rows;
663
+ private selectedIndex;
664
+ private scrollOffset;
665
+ private termCols;
666
+ private termRows;
667
+ private showingLogs;
668
+ private errorMessage;
669
+ private errorTimeout;
670
+ processCommand(_command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
671
+ onData(data: string, context: ICliExecutionContext): Promise<void>;
672
+ onResize(cols: number, rows: number, _context: ICliExecutionContext): void;
673
+ onDispose(_context: ICliExecutionContext): void;
674
+ writeDescription(context: ICliExecutionContext): void;
675
+ private refreshData;
676
+ private actionKill;
677
+ private actionStart;
678
+ private actionStop;
679
+ private actionRestart;
680
+ private actionLogs;
681
+ private moveSelection;
682
+ private get visibleRows();
683
+ private clampScroll;
684
+ private render;
685
+ private buildFooter;
686
+ private renderLogsOverlay;
687
+ private showError;
688
+ private exit;
689
+ }
690
+
709
691
  declare const systemProcessors: ICliCommandProcessor[];
710
692
 
711
693
  declare class CliThemeCommandProcessor implements ICliCommandProcessor {
@@ -733,37 +715,37 @@ type ThemeState = {
733
715
  customOptions?: ITheme;
734
716
  };
735
717
  declare const themes: {
736
- [x: string]: ITheme;
737
- default: ITheme;
738
- classic: ITheme;
739
- dracula: ITheme;
740
- monokai: ITheme;
741
- solarizedDark: ITheme;
742
- solarizedLight: ITheme;
743
- gruvboxDark: ITheme;
744
- gruvboxLight: ITheme;
745
- nord: ITheme;
746
- oneDark: ITheme;
747
- material: ITheme;
748
- highContrastLight: ITheme;
749
- tokyoNight: ITheme;
750
- catppuccinMocha: ITheme;
751
- catppuccinFrappe: ITheme;
752
- rosePine: ITheme;
753
- kanagawa: ITheme;
754
- everforestDark: ITheme;
755
- ayuDark: ITheme;
756
- catppuccinLatte: ITheme;
757
- rosePineDawn: ITheme;
758
- everforestLight: ITheme;
759
- githubLight: ITheme;
760
- cyberpunk: ITheme;
761
- retroGreen: ITheme;
762
- retroAmber: ITheme;
763
- matrix: ITheme;
764
- synthwave: ITheme;
765
- highContrastDark: ITheme;
766
- yellow: ITheme;
718
+ [key: string]: ITheme;
719
+ default: _qodalis_cli_core.CliTheme;
720
+ classic: _qodalis_cli_core.CliTheme;
721
+ dracula: _qodalis_cli_core.CliTheme;
722
+ monokai: _qodalis_cli_core.CliTheme;
723
+ solarizedDark: _qodalis_cli_core.CliTheme;
724
+ solarizedLight: _qodalis_cli_core.CliTheme;
725
+ gruvboxDark: _qodalis_cli_core.CliTheme;
726
+ gruvboxLight: _qodalis_cli_core.CliTheme;
727
+ nord: _qodalis_cli_core.CliTheme;
728
+ oneDark: _qodalis_cli_core.CliTheme;
729
+ material: _qodalis_cli_core.CliTheme;
730
+ highContrastLight: _qodalis_cli_core.CliTheme;
731
+ tokyoNight: _qodalis_cli_core.CliTheme;
732
+ catppuccinMocha: _qodalis_cli_core.CliTheme;
733
+ catppuccinFrappe: _qodalis_cli_core.CliTheme;
734
+ rosePine: _qodalis_cli_core.CliTheme;
735
+ kanagawa: _qodalis_cli_core.CliTheme;
736
+ everforestDark: _qodalis_cli_core.CliTheme;
737
+ ayuDark: _qodalis_cli_core.CliTheme;
738
+ catppuccinLatte: _qodalis_cli_core.CliTheme;
739
+ rosePineDawn: _qodalis_cli_core.CliTheme;
740
+ everforestLight: _qodalis_cli_core.CliTheme;
741
+ githubLight: _qodalis_cli_core.CliTheme;
742
+ cyberpunk: _qodalis_cli_core.CliTheme;
743
+ retroGreen: _qodalis_cli_core.CliTheme;
744
+ retroAmber: _qodalis_cli_core.CliTheme;
745
+ matrix: _qodalis_cli_core.CliTheme;
746
+ synthwave: _qodalis_cli_core.CliTheme;
747
+ highContrastDark: _qodalis_cli_core.CliTheme;
748
+ yellow: _qodalis_cli_core.CliTheme;
767
749
  };
768
750
  declare const themeInfos: Record<string, CliThemeInfo>;
769
751
 
@@ -884,7 +866,7 @@ declare class CliFontSizeCommandProcessor implements ICliCommandProcessor {
884
866
  private setFontSize;
885
867
  }
886
868
 
887
- declare const miscProcessors: (CliAliasCommandProcessor | CliBase64CommandProcessor | CliCalCommandProcessor | CliClearCommandProcessor | CliClipboardCommandProcessor | CliColorCommandProcessor | CliConvertCommandProcessor | CliEchoCommandProcessor | CliEvalCommandProcessor | CliHashCommandProcessor | CliHexCommandProcessor | CliJsonCommandProcessor | CliJwtCommandProcessor | CliLoremCommandProcessor | CliOpenCommandProcessor | CliRandomCommandProcessor | CliScreenCommandProcessor | CliSeqCommandProcessor | CliSleepCommandProcessor | CliTimeCommandProcessor | CliTimestampCommandProcessor | CliUnAliasCommandProcessor | CliUnameCommandProcessor | CliUptimeCommandProcessor | CliUrlCommandProcessor | CliYesCommandProcessor)[];
869
+ declare const miscProcessors: (CliAliasCommandProcessor | CliCalCommandProcessor | CliClearCommandProcessor | CliClipboardCommandProcessor | CliColorCommandProcessor | CliConvertCommandProcessor | CliEchoCommandProcessor | CliEvalCommandProcessor | CliJsonCommandProcessor | CliLoremCommandProcessor | CliOpenCommandProcessor | CliRandomCommandProcessor | CliScreenCommandProcessor | CliSeqCommandProcessor | CliSleepCommandProcessor | CliTimeCommandProcessor | CliTimestampCommandProcessor | CliUnAliasCommandProcessor | CliUnameCommandProcessor | CliUptimeCommandProcessor | CliYesCommandProcessor)[];
888
870
  declare const builtinProcessors: ICliCommandProcessor[];
889
871
 
890
872
  declare class CliExecutionProcess implements ICliExecutionProcess {
@@ -1004,53 +986,11 @@ declare class CliStateStoreManager implements ICliStateStoreManager {
1004
986
  name: string;
1005
987
  state: Record<string, any>;
1006
988
  }[];
1007
- }
1008
-
1009
- type ActiveInputRequestType = 'line' | 'password' | 'confirm' | 'select' | 'select-inline' | 'multi-select' | 'number';
1010
- interface ActiveInputRequest {
1011
- type: ActiveInputRequestType;
1012
- promptText: string;
1013
- resolve: (value: any) => void;
1014
- buffer: string;
1015
- cursorPosition: number;
1016
- defaultValue?: boolean;
1017
- options?: CliSelectOption[];
1018
- selectedIndex?: number;
1019
- onChange?: (value: string) => void;
1020
- checkedIndices?: Set<number>;
1021
- numberOptions?: {
1022
- min?: number;
1023
- max?: number;
1024
- default?: number;
1025
- };
1026
- scrollOffset?: number;
1027
- maxVisible?: number;
1028
- displayLines?: number;
1029
- }
1030
- interface CliInputReaderHost {
1031
- readonly activeInputRequest: ActiveInputRequest | null;
1032
- setActiveInputRequest(request: ActiveInputRequest | null): void;
1033
- writeToTerminal(text: string): void;
1034
- getTerminalRows?(): number;
1035
- }
1036
- declare class CliInputReader implements ICliInputReader {
1037
- private readonly host;
1038
- constructor(host: CliInputReaderHost);
1039
- readLine(prompt: string): Promise<string | null>;
1040
- readPassword(prompt: string): Promise<string | null>;
1041
- readConfirm(prompt: string, defaultValue?: boolean): Promise<boolean | null>;
1042
- readSelect(prompt: string, options: CliSelectOption[], onChange?: (value: string) => void): Promise<string | null>;
1043
- readSelectInline(prompt: string, options: CliSelectOption[], onChange?: (value: string) => void): Promise<string | null>;
1044
- readMultiSelect(prompt: string, options: CliMultiSelectOption[]): Promise<string[] | null>;
1045
- readNumber(prompt: string, options?: {
1046
- min?: number;
1047
- max?: number;
1048
- default?: number;
1049
- }): Promise<number | null>;
1050
- renderSelectOptions(options: CliSelectOption[], selectedIndex: number, scrollOffset?: number, maxVisible?: number): number;
1051
- renderInlineSelectOptions(options: CliSelectOption[], selectedIndex: number): string;
1052
- renderMultiSelectOptions(options: CliSelectOption[], selectedIndex: number, checkedIndices: Set<number>, scrollOffset?: number, maxVisible?: number): number;
1053
- private createInputRequest;
989
+ /**
990
+ * Dispose all stores (completes their BehaviorSubjects).
991
+ * Called during engine teardown.
992
+ */
993
+ dispose(): void;
1054
994
  }
1055
995
 
1056
996
  /**
@@ -1099,7 +1039,7 @@ declare class CliCompletionEngine {
1099
1039
  /**
1100
1040
  * Reusable text buffer with cursor management.
1101
1041
  * Eliminates duplicated line-editing logic across CommandLineMode,
1102
- * ReaderMode, and any future input mode.
1042
+ * LineInputMode, and any future input mode.
1103
1043
  */
1104
1044
  declare class CliLineBuffer {
1105
1045
  private _text;
@@ -1143,6 +1083,28 @@ interface IInputMode {
1143
1083
  * Called when this mode is no longer the active input mode.
1144
1084
  */
1145
1085
  deactivate?(): void;
1086
+ /** Called when the terminal is resized while this mode is active. */
1087
+ onResize?(cols: number, rows: number): void;
1088
+ }
1089
+ /**
1090
+ * Host interface for input modes. Provides access to terminal I/O,
1091
+ * dimensions, and mode stack management.
1092
+ */
1093
+ interface InputModeHost {
1094
+ /** Write raw text/ANSI to the terminal */
1095
+ writeToTerminal(text: string): void;
1096
+ /** Get terminal row count for scroll window sizing */
1097
+ getTerminalRows(): number;
1098
+ /** Get terminal column count for overflow calculations */
1099
+ getTerminalCols(): number;
1100
+ /** Push a mode onto the input mode stack */
1101
+ pushMode(mode: IInputMode): void;
1102
+ /** Pop the current mode from the input mode stack */
1103
+ popMode(): void;
1104
+ /** The xterm.js Terminal instance (for direct write when needed) */
1105
+ readonly terminal: Terminal;
1106
+ /** File picker provider for the current environment */
1107
+ readonly filePickerProvider: ICliFilePickerProvider;
1146
1108
  }
1147
1109
 
1148
1110
  interface PromptOptions {
@@ -1202,16 +1164,6 @@ interface CommandLineModeHost {
1202
1164
  }): void;
1203
1165
  }
1204
1166
 
1205
- /**
1206
- * Host interface for ReaderMode — provides access to the active input request.
1207
- */
1208
- interface ReaderModeHost {
1209
- readonly terminal: Terminal;
1210
- getActiveInputRequest(): ActiveInputRequest | null;
1211
- setActiveInputRequest(request: ActiveInputRequest | null): void;
1212
- popMode(): void;
1213
- }
1214
-
1215
1167
  interface CliExecutionContextDeps {
1216
1168
  services: ICliServiceProvider;
1217
1169
  logger: ICliLogger;
@@ -1219,7 +1171,7 @@ interface CliExecutionContextDeps {
1219
1171
  stateStoreManager: CliStateStoreManager;
1220
1172
  translator: ICliTranslationService;
1221
1173
  }
1222
- declare class CliExecutionContext implements ICliExecutionContext, CliInputReaderHost, CommandLineModeHost, ReaderModeHost {
1174
+ declare class CliExecutionContext implements ICliExecutionContext, InputModeHost, CommandLineModeHost {
1223
1175
  terminal: Terminal;
1224
1176
  executor: ICliCommandExecutorService;
1225
1177
  userSession?: ICliUserSession;
@@ -1244,20 +1196,16 @@ declare class CliExecutionContext implements ICliExecutionContext, CliInputReade
1244
1196
  readonly lineBuffer: CliLineBuffer;
1245
1197
  readonly lineRenderer: CliTerminalLineRenderer;
1246
1198
  readonly commandHistory: CliCommandHistory;
1247
- private _activeInputRequest;
1199
+ readonly filePickerProvider: ICliFilePickerProvider;
1248
1200
  private readonly modeStack;
1249
- private readonly managedTimers;
1250
- private resizeDisposable;
1201
+ private readonly stateStoreManager;
1202
+ private readonly timerManager;
1203
+ private readonly fullScreenManager;
1204
+ private windowKeydownListener?;
1251
1205
  constructor(deps: CliExecutionContextDeps, terminal: Terminal, executor: ICliCommandExecutorService, cliOptions?: CliOptions);
1252
- get activeInputRequest(): ActiveInputRequest | null;
1253
- /**
1254
- * Sets the active input request. When a non-null request is provided,
1255
- * pushes ReaderMode onto the mode stack. ReaderMode pops itself on
1256
- * completion, so passing null here does NOT pop the mode.
1257
- */
1258
- setActiveInputRequest(request: ActiveInputRequest | null): void;
1259
1206
  writeToTerminal(text: string): void;
1260
1207
  getTerminalRows(): number;
1208
+ getTerminalCols(): number;
1261
1209
  get currentLine(): string;
1262
1210
  get cursorPosition(): number;
1263
1211
  set cursorPosition(value: number);
@@ -1285,7 +1233,7 @@ declare class CliExecutionContext implements ICliExecutionContext, CliInputReade
1285
1233
  */
1286
1234
  handleTerminalResize(): void;
1287
1235
  isRawModeActive(): boolean;
1288
- enterFullScreenMode(processor: ICliCommandProcessor): void;
1236
+ enterFullScreenMode(processor: ICliCommandProcessor, options?: CliFullScreenOptions): void;
1289
1237
  exitFullScreenMode(): void;
1290
1238
  createInterval(callback: () => void, ms: number): ICliManagedInterval;
1291
1239
  createTimeout(callback: () => void, ms: number): ICliManagedTimer;
@@ -1296,8 +1244,6 @@ declare class CliExecutionContext implements ICliExecutionContext, CliInputReade
1296
1244
  getPromptLength(): number;
1297
1245
  setPromptLength(value: number): void;
1298
1246
  getExecutionContext(): ICliExecutionContext;
1299
- getActiveInputRequest(): ActiveInputRequest | null;
1300
- private clearAllManagedTimers;
1301
1247
  /**
1302
1248
  * Dispose all resources. Called by CliEngine.destroy() when the
1303
1249
  * CLI component is being torn down.
@@ -1308,6 +1254,94 @@ declare class CliExecutionContext implements ICliExecutionContext, CliInputReade
1308
1254
  popMode(): void;
1309
1255
  }
1310
1256
 
1257
+ /**
1258
+ * Per-session registry that manages background service lifecycle.
1259
+ */
1260
+ declare class CliBackgroundServiceRegistry implements ICliBackgroundServiceRegistry {
1261
+ private readonly state;
1262
+ private readonly services;
1263
+ private readonly writer?;
1264
+ private readonly entries;
1265
+ private readonly handlers;
1266
+ private isFullScreen;
1267
+ private notificationQueue;
1268
+ private processRegistry?;
1269
+ constructor(state: ICliStateStore, services: ICliServiceProvider, writer?: ICliTerminalWriter | undefined);
1270
+ /** Attach the process registry so background services get PIDs */
1271
+ setProcessRegistry(registry: ICliProcessRegistry): void;
1272
+ register(service: ICliBackgroundService): void;
1273
+ start(name: string): Promise<void>;
1274
+ stop(name: string): Promise<void>;
1275
+ restart(name: string): Promise<void>;
1276
+ startJob(name: string, task: (context: ICliServiceContext) => Promise<void>, _options?: {
1277
+ workerCompatible?: boolean;
1278
+ }): Promise<void>;
1279
+ getStatus(name: string): ICliBackgroundServiceInfo | undefined;
1280
+ list(): ICliBackgroundServiceInfo[];
1281
+ getLogs(name: string, limit?: number): ICliServiceLogEntry[];
1282
+ on(handler: CliServiceEventHandler, filter?: {
1283
+ source?: string;
1284
+ type?: string;
1285
+ }): () => void;
1286
+ destroyAll(): Promise<void>;
1287
+ /** Called by the execution context when entering/exiting full-screen mode */
1288
+ setFullScreen(isFullScreen: boolean): void;
1289
+ private getEntry;
1290
+ private toInfo;
1291
+ private updateStatus;
1292
+ private handleStartError;
1293
+ private dispatchEvent;
1294
+ private emitLifecycleEvent;
1295
+ private notify;
1296
+ private flushNotificationQueue;
1297
+ private writeNotification;
1298
+ private completeInProcessRegistry;
1299
+ private failInProcessRegistry;
1300
+ }
1301
+
1302
+ /**
1303
+ * Manages full-screen terminal mode (alternate screen buffer).
1304
+ * Used by interactive commands like nano, htop, etc.
1305
+ */
1306
+ declare class CliFullScreenManager {
1307
+ private readonly terminal;
1308
+ private readonly backgroundServices;
1309
+ private resizeDisposable;
1310
+ constructor(terminal: Terminal, backgroundServices: CliBackgroundServiceRegistry);
1311
+ /**
1312
+ * Enter full-screen mode using the alternate screen buffer.
1313
+ */
1314
+ enter(processor: ICliCommandProcessor, setContextProcessor: (p: ICliCommandProcessor | undefined, silent?: boolean, fullScreen?: boolean) => void, context: ICliExecutionContext, options?: CliFullScreenOptions): void;
1315
+ /**
1316
+ * Exit full-screen mode and return to the main buffer.
1317
+ */
1318
+ exit(contextProcessor: ICliCommandProcessor | undefined, setContextProcessor: (p: ICliCommandProcessor | undefined) => void, clearTimers: () => void, showPrompt: () => void, context: ICliExecutionContext): void;
1319
+ /**
1320
+ * Dispose resize subscription.
1321
+ */
1322
+ dispose(): void;
1323
+ }
1324
+
1325
+ /**
1326
+ * Manages timers and intervals with automatic cleanup.
1327
+ * All managed timers are cleared when the execution context is disposed.
1328
+ */
1329
+ declare class CliTimerManager {
1330
+ private readonly managedTimers;
1331
+ /**
1332
+ * Create a managed interval that will be automatically cleared on dispose.
1333
+ */
1334
+ createInterval(callback: () => void, ms: number): ICliManagedInterval;
1335
+ /**
1336
+ * Create a managed timeout that will be automatically cleared on dispose.
1337
+ */
1338
+ createTimeout(callback: () => void, ms: number): ICliManagedTimer;
1339
+ /**
1340
+ * Clear all managed timers and intervals.
1341
+ */
1342
+ clearAll(): void;
1343
+ }
1344
+
1311
1345
  /**
1312
1346
  * Extended execution context interface used internally by the command executor.
1313
1347
  * The concrete implementation (e.g. CliExecutionContext in angular-cli) provides these.
@@ -1320,29 +1354,14 @@ declare class CliCommandExecutor implements ICliCommandExecutorService {
1320
1354
  protected readonly registry: ICliCommandProcessorRegistry;
1321
1355
  private commandParser;
1322
1356
  private globalParameters;
1323
- private lastCapturingWriter?;
1324
1357
  constructor(registry: ICliCommandProcessorRegistry);
1325
1358
  registerGlobalParameter(handler: ICliGlobalParameterHandler): void;
1326
1359
  getGlobalParameters(): ICliCommandParameterDescriptor[];
1327
1360
  executeCommand(command: string, context: ICliExecutionContext): Promise<void>;
1328
- private appendOutputToFile;
1329
- private writeOutputToFile;
1330
1361
  private executeSingleCommand;
1331
- private writeStderrToFile;
1332
- private appendStderrToFile;
1362
+ private completeProcess;
1363
+ private failProcess;
1333
1364
  showHelp(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
1334
- /**
1335
- * Attempt to execute a file path as a script.
1336
- * Returns true if the file was found and executed, false otherwise.
1337
- * Requires the @qodalis/cli-files plugin for filesystem access.
1338
- */
1339
- private tryExecuteScript;
1340
- private substituteVars;
1341
- /**
1342
- * Expand $VAR and ${VAR} references using the global environment store.
1343
- * Variables inside single-quoted strings are NOT expanded (like bash).
1344
- */
1345
- private expandEnvironmentVars;
1346
1365
  /**
1347
1366
  * Validates the command arguments before execution.
1348
1367
  * @param context The current CLI execution context.
@@ -1376,6 +1395,123 @@ declare const helpGlobalParameter: ICliGlobalParameterHandler;
1376
1395
  */
1377
1396
  declare const contextGlobalParameter: ICliGlobalParameterHandler;
1378
1397
 
1398
+ /**
1399
+ * A terminal writer wrapper that captures "stdout-equivalent" output
1400
+ * (`write`, `writeln`, `writeJson`, `writeObjectsAsTable`, `writeTable`)
1401
+ * while passing everything through to the underlying writer unchanged.
1402
+ *
1403
+ * Diagnostic methods (`writeError`, `writeWarning`, `writeInfo`, `writeSuccess`)
1404
+ * are NOT captured — they are the equivalent of stderr.
1405
+ *
1406
+ * After a command finishes, the executor can retrieve the captured data to use
1407
+ * as implicit pipeline output when the command did not call `process.output()`.
1408
+ */
1409
+ declare class CapturingTerminalWriter implements ICliTerminalWriter {
1410
+ private readonly inner;
1411
+ /** Raw text lines captured from write/writeln calls. */
1412
+ private _lines;
1413
+ /** Structured data captured from writeJson calls. */
1414
+ private _jsonValues;
1415
+ /** Structured data captured from writeObjectsAsTable calls. */
1416
+ private _tableObjects;
1417
+ /** Raw text lines captured from writeError/writeWarning calls. */
1418
+ private _stderrLines;
1419
+ constructor(inner: ICliTerminalWriter);
1420
+ write(text: string): void;
1421
+ writeln(text?: string): void;
1422
+ writeJson(json: any): void;
1423
+ writeObjectsAsTable(objects: any[]): void;
1424
+ writeTable(headers: string[], rows: string[][]): void;
1425
+ writeSuccess(message: string): void;
1426
+ writeInfo(message: string): void;
1427
+ writeWarning(message: string): void;
1428
+ writeError(message: string): void;
1429
+ wrapInColor(text: string, color: CliForegroundColor): string;
1430
+ wrapInBackgroundColor(text: string, color: CliBackgroundColor): string;
1431
+ writeToFile(fileName: string, content: string): void;
1432
+ writeDivider(options?: {
1433
+ color?: CliForegroundColor;
1434
+ length?: number;
1435
+ char?: string;
1436
+ }): void;
1437
+ writeList(items: string[], options?: {
1438
+ ordered?: boolean;
1439
+ prefix?: string;
1440
+ color?: CliForegroundColor;
1441
+ }): void;
1442
+ writeKeyValue(entries: Record<string, string> | [string, string][], options?: {
1443
+ separator?: string;
1444
+ keyColor?: CliForegroundColor;
1445
+ }): void;
1446
+ writeColumns(items: string[], options?: {
1447
+ columns?: number;
1448
+ padding?: number;
1449
+ }): void;
1450
+ writeLink(text: string, url: string): void;
1451
+ writeBox(content: string | string[], options?: {
1452
+ title?: string;
1453
+ borderColor?: CliForegroundColor;
1454
+ padding?: number;
1455
+ }): void;
1456
+ writeIndented(text: string, level?: number): void;
1457
+ /**
1458
+ * Returns true if any stdout-equivalent output was captured.
1459
+ */
1460
+ hasOutput(): boolean;
1461
+ /**
1462
+ * Returns the captured data in the most useful form:
1463
+ *
1464
+ * 1. If structured JSON was written (via `writeJson`), return the last
1465
+ * JSON value (preserving its original type — object, array, etc.).
1466
+ * 2. If objects were written as a table, return the last array of objects.
1467
+ * 3. Otherwise return the captured text lines joined with newlines,
1468
+ * with ANSI codes stripped and whitespace trimmed.
1469
+ * 4. Returns `undefined` if nothing was captured.
1470
+ */
1471
+ getCapturedData(): any | undefined;
1472
+ /**
1473
+ * Returns true if any stderr-equivalent output was captured.
1474
+ */
1475
+ hasStderr(): boolean;
1476
+ /**
1477
+ * Returns captured stderr text joined with newlines, or undefined if empty.
1478
+ */
1479
+ getCapturedStderr(): string | undefined;
1480
+ }
1481
+
1482
+ /**
1483
+ * Write stdout data to a file (overwrite mode).
1484
+ */
1485
+ declare function writeOutputToFile(filePath: string, context: ICliExecutionContext): Promise<void>;
1486
+ /**
1487
+ * Append stdout data to a file.
1488
+ */
1489
+ declare function appendOutputToFile(filePath: string, context: ICliExecutionContext): Promise<void>;
1490
+ /**
1491
+ * Write stderr data to a file (overwrite mode).
1492
+ */
1493
+ declare function writeStderrToFile(filePath: string, context: ICliExecutionContext, capturingWriter?: CapturingTerminalWriter): Promise<void>;
1494
+ /**
1495
+ * Append stderr data to a file.
1496
+ */
1497
+ declare function appendStderrToFile(filePath: string, context: ICliExecutionContext, capturingWriter?: CapturingTerminalWriter): Promise<void>;
1498
+
1499
+ /**
1500
+ * Attempt to execute a file path as a script.
1501
+ * Returns true if the file was found and executed, false otherwise.
1502
+ * Requires the @qodalis/cli-files plugin for filesystem access.
1503
+ */
1504
+ declare function tryExecuteScript(filePath: string, context: ICliExecutionHost, executeCommand: (command: string, context: ICliExecutionContext) => Promise<void>): Promise<boolean>;
1505
+ /**
1506
+ * Substitute script-local variables ($VAR / ${VAR}) in a string.
1507
+ */
1508
+ declare function substituteVars(input: string, variables: Record<string, string>): string;
1509
+ /**
1510
+ * Expand $VAR and ${VAR} references using the global environment store.
1511
+ * Variables inside single-quoted strings are NOT expanded (like bash).
1512
+ */
1513
+ declare function expandEnvironmentVars(command: string, context: ICliExecutionContext): string;
1514
+
1379
1515
  /**
1380
1516
  * A simple Map-based service container implementing ICliServiceProvider.
1381
1517
  *
@@ -1465,7 +1601,14 @@ declare class CliTerminalWriter implements ICliTerminalWriter {
1465
1601
  columns?: number;
1466
1602
  padding?: number;
1467
1603
  }): void;
1468
- writeTable(headers: string[], rows: string[][]): void;
1604
+ writeLink(text: string, url: string): void;
1605
+ writeBox(content: string | string[], options?: {
1606
+ title?: string;
1607
+ borderColor?: CliForegroundColor;
1608
+ padding?: number;
1609
+ }): void;
1610
+ writeIndented(text: string, level?: number): void;
1611
+ writeTable(headers: string[], rows: string[][], options?: CliTableOptions): void;
1469
1612
  }
1470
1613
 
1471
1614
  declare class CliClipboard implements ICliClipboard {
@@ -1528,11 +1671,6 @@ declare class CliTerminalProgressBar implements ICliPercentageProgressBar {
1528
1671
  complete(): void;
1529
1672
  setText(text: string): void;
1530
1673
  private updateProgressBar;
1531
- /**
1532
- * Returns an ANSI 256-color escape for a position in the progress bar.
1533
- * Gradient: red (0%) -> yellow (50%) -> green (100%).
1534
- */
1535
- private progressGradientColor;
1536
1674
  private clearCurrentLine;
1537
1675
  private calcLineCount;
1538
1676
  }
@@ -1571,6 +1709,7 @@ declare class CliBoot {
1571
1709
  private initializing;
1572
1710
  private readonly moduleRegistry;
1573
1711
  private readonly bootedModules;
1712
+ private readonly initializedProcessors;
1574
1713
  constructor(registry: ICliCommandProcessorRegistry, services: ICliServiceProvider);
1575
1714
  /**
1576
1715
  * Get the module registry for external access.
@@ -1641,6 +1780,13 @@ declare class ScriptLoaderService {
1641
1780
  content?: string;
1642
1781
  error?: any;
1643
1782
  }>;
1783
+ /**
1784
+ * Inject an inline script into the page.
1785
+ *
1786
+ * **Security:** This runs `code` in the host page context with full
1787
+ * DOM access. Only call with trusted content (e.g. verified UMD bundles
1788
+ * loaded via the package manager). Never pass user-supplied strings.
1789
+ */
1644
1790
  injectBodyScript(code: string): void;
1645
1791
  /**
1646
1792
  * Returns CDN URLs for a given npm package path.
@@ -1671,14 +1817,18 @@ declare class CliPackageManagerService {
1671
1817
  private readonly storageKey;
1672
1818
  QODALIS_COMMAND_PREFIX: string;
1673
1819
  private store;
1820
+ /** In-memory cache; `null` means "not yet loaded from storage". */
1821
+ private cache;
1822
+ /** Whether the one-time localStorage migration has been checked. */
1823
+ private migrationDone;
1674
1824
  constructor();
1675
1825
  /**
1676
1826
  * Set the key-value store instance for persistence.
1677
1827
  */
1678
1828
  setStore(store: ICliKeyValueStore): void;
1679
1829
  /**
1680
- * Retrieves the list of packages
1681
- * @returns {Package[]} Array of packages
1830
+ * Retrieves the list of packages.
1831
+ * Uses an in-memory cache after the first load.
1682
1832
  */
1683
1833
  getPackages(): Promise<Package[]>;
1684
1834
  /**
@@ -1709,80 +1859,21 @@ declare class CliDefaultPingServerService implements ICliPingServerService {
1709
1859
  }
1710
1860
 
1711
1861
  /**
1712
- * A terminal writer wrapper that captures "stdout-equivalent" output
1713
- * (`write`, `writeln`, `writeJson`, `writeObjectsAsTable`, `writeTable`)
1714
- * while passing everything through to the underlying writer unchanged.
1715
- *
1716
- * Diagnostic methods (`writeError`, `writeWarning`, `writeInfo`, `writeSuccess`)
1717
- * are NOT captured — they are the equivalent of stderr.
1718
- *
1719
- * After a command finishes, the executor can retrieve the captured data to use
1720
- * as implicit pipeline output when the command did not call `process.output()`.
1862
+ * Factory-based input reader. Creates the appropriate input mode
1863
+ * and pushes it onto the mode stack for each request.
1721
1864
  */
1722
- declare class CapturingTerminalWriter implements ICliTerminalWriter {
1723
- private readonly inner;
1724
- /** Raw text lines captured from write/writeln calls. */
1725
- private _lines;
1726
- /** Structured data captured from writeJson calls. */
1727
- private _jsonValues;
1728
- /** Structured data captured from writeObjectsAsTable calls. */
1729
- private _tableObjects;
1730
- /** Raw text lines captured from writeError/writeWarning calls. */
1731
- private _stderrLines;
1732
- constructor(inner: ICliTerminalWriter);
1733
- write(text: string): void;
1734
- writeln(text?: string): void;
1735
- writeJson(json: any): void;
1736
- writeObjectsAsTable(objects: any[]): void;
1737
- writeTable(headers: string[], rows: string[][]): void;
1738
- writeSuccess(message: string): void;
1739
- writeInfo(message: string): void;
1740
- writeWarning(message: string): void;
1741
- writeError(message: string): void;
1742
- wrapInColor(text: string, color: CliForegroundColor): string;
1743
- wrapInBackgroundColor(text: string, color: CliBackgroundColor): string;
1744
- writeToFile(fileName: string, content: string): void;
1745
- writeDivider(options?: {
1746
- color?: CliForegroundColor;
1747
- length?: number;
1748
- char?: string;
1749
- }): void;
1750
- writeList(items: string[], options?: {
1751
- ordered?: boolean;
1752
- prefix?: string;
1753
- color?: CliForegroundColor;
1754
- }): void;
1755
- writeKeyValue(entries: Record<string, string> | [string, string][], options?: {
1756
- separator?: string;
1757
- keyColor?: CliForegroundColor;
1758
- }): void;
1759
- writeColumns(items: string[], options?: {
1760
- columns?: number;
1761
- padding?: number;
1762
- }): void;
1763
- /**
1764
- * Returns true if any stdout-equivalent output was captured.
1765
- */
1766
- hasOutput(): boolean;
1767
- /**
1768
- * Returns the captured data in the most useful form:
1769
- *
1770
- * 1. If structured JSON was written (via `writeJson`), return the last
1771
- * JSON value (preserving its original type — object, array, etc.).
1772
- * 2. If objects were written as a table, return the last array of objects.
1773
- * 3. Otherwise return the captured text lines joined with newlines,
1774
- * with ANSI codes stripped and whitespace trimmed.
1775
- * 4. Returns `undefined` if nothing was captured.
1776
- */
1777
- getCapturedData(): any | undefined;
1778
- /**
1779
- * Returns true if any stderr-equivalent output was captured.
1780
- */
1781
- hasStderr(): boolean;
1782
- /**
1783
- * Returns captured stderr text joined with newlines, or undefined if empty.
1784
- */
1785
- getCapturedStderr(): string | undefined;
1865
+ declare class CliInputReader implements ICliInputReader {
1866
+ private readonly host;
1867
+ constructor(host: InputModeHost);
1868
+ readLine(prompt: string, options?: CliLineOptions): Promise<string | null>;
1869
+ readPassword(prompt: string): Promise<string | null>;
1870
+ readConfirm(prompt: string, defaultValue?: boolean): Promise<boolean | null>;
1871
+ readSelect(prompt: string, options: CliSelectOption[], selectOptions?: CliSelectOptions): Promise<string | null>;
1872
+ readSelectInline(prompt: string, options: CliSelectOption[], selectOptions?: CliSelectOptions): Promise<string | null>;
1873
+ readMultiSelect(prompt: string, options: CliMultiSelectOption[], selectOptions?: CliMultiSelectOptions): Promise<string[] | null>;
1874
+ readNumber(prompt: string, options?: CliNumberOptions): Promise<number | null>;
1875
+ readDate(prompt: string, options?: CliDateOptions): Promise<string | null>;
1876
+ readFile(prompt: string, options?: CliFilePickerOptions): Promise<CliFileResult[] | null>;
1786
1877
  }
1787
1878
 
1788
1879
  declare const CliProcessRegistry_TOKEN = "cli-process-registry";
@@ -1792,7 +1883,7 @@ declare class CliProcessRegistry implements ICliProcessRegistry {
1792
1883
  private _currentPid;
1793
1884
  private maxHistory;
1794
1885
  get currentPid(): number | undefined;
1795
- register(command: string): {
1886
+ register(command: string, options?: ICliProcessRegisterOptions): {
1796
1887
  pid: number;
1797
1888
  abortController: AbortController;
1798
1889
  };
@@ -1914,6 +2005,11 @@ declare class CliStateStore implements ICliStateStore {
1914
2005
  reset(): void;
1915
2006
  persist(): Promise<void>;
1916
2007
  initialize(): Promise<void>;
2008
+ /**
2009
+ * Complete the BehaviorSubject so all subscribers are notified
2010
+ * and no further emissions occur. Called during engine teardown.
2011
+ */
2012
+ dispose(): void;
1917
2013
  }
1918
2014
 
1919
2015
  interface CliEngineOptions extends CliOptions {
@@ -2002,8 +2098,6 @@ declare class CliEngine {
2002
2098
  * source, the restored content may reflow differently.
2003
2099
  */
2004
2100
  private restoreSnapshot;
2005
- private getTerminalOptions;
2006
- private initializeTerminal;
2007
2101
  private handleResize;
2008
2102
  /**
2009
2103
  * Call fitAddon.fit() only when the container has non-zero dimensions.
@@ -2017,51 +2111,132 @@ declare class CliEngine {
2017
2111
  * so intermediate resize events cannot leave stale artefacts.
2018
2112
  */
2019
2113
  private deferResizeFix;
2020
- /**
2021
- * Wait until the container element has non-zero dimensions.
2022
- * xterm.js requires the host element to be laid out before open() is called.
2023
- */
2024
- private waitForLayout;
2025
2114
  }
2026
2115
 
2116
+ interface TerminalSetupResult {
2117
+ terminal: Terminal;
2118
+ fitAddon: FitAddon;
2119
+ serializeAddon: SerializeAddon;
2120
+ dragDropService: CliDragDropService;
2121
+ wheelListener: (e: WheelEvent) => void;
2122
+ }
2123
+ /**
2124
+ * Merge user-supplied terminal options with sensible defaults.
2125
+ */
2126
+ declare function getTerminalOptions(userOptions?: Partial<ITerminalOptions & ITerminalInitOnlyOptions>): ITerminalOptions & ITerminalInitOnlyOptions;
2127
+ /**
2128
+ * Create and configure an xterm.js Terminal with all required addons,
2129
+ * open it into the given container, and return the instances.
2130
+ */
2131
+ declare function initializeTerminal(container: HTMLElement, opts: ITerminalOptions & ITerminalInitOnlyOptions): TerminalSetupResult;
2132
+ /**
2133
+ * Wait until the container element has non-zero dimensions.
2134
+ * xterm.js requires the host element to be laid out before open() is called.
2135
+ * Rejects after {@link LAYOUT_TIMEOUT_MS} if the container stays hidden.
2136
+ */
2137
+ declare function waitForLayout(container: HTMLElement): Promise<void>;
2138
+
2139
+ /**
2140
+ * Default implementation of the translation service.
2141
+ *
2142
+ * Maintains a map of locale -> flat key-value translations.
2143
+ * The 'en' locale is always implicitly available via defaultValue fallbacks.
2144
+ * Supports simple {param} interpolation.
2145
+ */
2146
+ declare class CliTranslationService implements ICliTranslationService {
2147
+ private locale;
2148
+ private readonly translations;
2149
+ t(key: string, defaultValue: string, params?: Record<string, string | number>): string;
2150
+ getLocale(): string;
2151
+ setLocale(locale: string): void;
2152
+ addTranslations(locale: string, translations: Record<string, string>): void;
2153
+ getAvailableLocales(): string[];
2154
+ }
2155
+
2156
+ interface InitializeServicesOptions {
2157
+ registry: CliCommandProcessorRegistry;
2158
+ pendingServices: CliProvider[];
2159
+ dragDropService?: CliDragDropService;
2160
+ }
2161
+ interface InitializeServicesResult {
2162
+ services: CliServiceContainer;
2163
+ logger: CliLogger;
2164
+ commandHistory: CliCommandHistory;
2165
+ stateStoreManager: CliStateStoreManager;
2166
+ processRegistry: CliProcessRegistry;
2167
+ translator: CliTranslationService;
2168
+ }
2169
+ /**
2170
+ * Build and populate the service container with all core services.
2171
+ * Takes the registry, pending (user-registered) services, and the drag-drop
2172
+ * service instance, and returns all initialized services ready for wiring
2173
+ * into the execution context.
2174
+ */
2175
+ declare function initializeServices(options: InitializeServicesOptions): Promise<InitializeServicesResult>;
2176
+
2027
2177
  declare class CliServerConnection {
2028
2178
  private readonly _config;
2029
2179
  private readonly _backgroundServices?;
2180
+ private readonly _logger?;
2030
2181
  private _connected;
2031
2182
  private _commands;
2032
2183
  private _capabilities;
2033
2184
  private _eventSocket;
2185
+ private _apiVersion;
2186
+ private _basePath;
2187
+ private _wsReconnectAttempts;
2188
+ private _wsReconnectTimer;
2189
+ private static readonly WS_MAX_RECONNECT_ATTEMPTS;
2190
+ private static readonly WS_MAX_RECONNECT_DELAY_MS;
2191
+ private _healthCheckTimer;
2192
+ private _healthCheckAttempts;
2193
+ private static readonly HEALTH_CHECK_INTERVAL_MS;
2194
+ private static readonly HEALTH_CHECK_MAX_ATTEMPTS;
2034
2195
  onDisconnect?: () => void;
2035
- constructor(_config: CliServerConfig, _backgroundServices?: ICliBackgroundServiceRegistry | undefined);
2196
+ onReconnected?: () => void;
2197
+ constructor(_config: CliServerConfig, _backgroundServices?: ICliBackgroundServiceRegistry | undefined, _logger?: ICliLogger | undefined);
2036
2198
  get config(): CliServerConfig;
2037
2199
  get connected(): boolean;
2038
2200
  get commands(): CliServerCommandDescriptor[];
2039
2201
  get capabilities(): CliServerCapabilities | null;
2202
+ get apiVersion(): number;
2040
2203
  connect(): Promise<void>;
2041
2204
  disconnect(): void;
2205
+ startHealthCheck(): void;
2206
+ private scheduleNextHealthCheck;
2207
+ stopHealthCheck(): void;
2042
2208
  fetchCommands(): Promise<CliServerCommandDescriptor[]>;
2043
2209
  fetchCapabilities(): Promise<CliServerCapabilities | null>;
2044
2210
  execute(command: CliProcessCommand): Promise<CliServerResponse>;
2211
+ executeStream(command: CliProcessCommand, onOutput: (output: CliServerOutput) => void): Promise<{
2212
+ exitCode: number;
2213
+ }>;
2045
2214
  ping(): Promise<boolean>;
2046
2215
  private connectEventSocket;
2047
2216
  private connectEventSocketDirect;
2048
2217
  private handleServerDisconnect;
2049
2218
  private closeEventSocket;
2050
2219
  private closeEventSocketDirect;
2220
+ private scheduleWsReconnect;
2221
+ private httpFetchWithRetry;
2051
2222
  private httpFetch;
2052
2223
  private normalizeUrl;
2053
2224
  private toWebSocketUrl;
2054
2225
  }
2055
2226
 
2056
2227
  /**
2057
- * Execute a command on a specific server connection and render the response.
2058
- * Shared by both single-proxy and multi-proxy processors.
2228
+ * Render a single CliServerOutput to the terminal.
2059
2229
  */
2060
- declare function executeOnServer(connection: CliServerConnection, serverName: string, descriptor: CliServerCommandDescriptor, command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
2230
+ declare function renderSingleOutput(output: CliServerOutput, context: ICliExecutionContext): void;
2061
2231
  /**
2062
2232
  * Render a CliServerResponse to the terminal.
2063
2233
  */
2064
2234
  declare function renderServerResponse(response: CliServerResponse, context: ICliExecutionContext): void;
2235
+ /**
2236
+ * Execute a command on a specific server connection and render the response.
2237
+ * Shared by both single-proxy and multi-proxy processors.
2238
+ */
2239
+ declare function executeOnServer(connection: CliServerConnection, serverName: string, descriptor: CliServerCommandDescriptor, command: CliProcessCommand, context: ICliExecutionContext, commandPath?: string[]): Promise<void>;
2065
2240
  declare class CliServerProxyProcessor implements ICliCommandProcessor {
2066
2241
  private readonly connection;
2067
2242
  private readonly descriptor;
@@ -2073,7 +2248,9 @@ declare class CliServerProxyProcessor implements ICliCommandProcessor {
2073
2248
  metadata?: CliProcessorMetadata;
2074
2249
  parameters?: ICliCommandParameterDescriptor[];
2075
2250
  processors?: ICliCommandProcessor[];
2076
- constructor(connection: CliServerConnection, descriptor: CliServerCommandDescriptor, serverName: string);
2251
+ /** Full command path from root to this processor (e.g. ["aws", "lambda", "list"]) */
2252
+ private readonly commandPath;
2253
+ constructor(connection: CliServerConnection, descriptor: CliServerCommandDescriptor, serverName: string, isNested?: boolean, parentPath?: string[]);
2077
2254
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
2078
2255
  }
2079
2256
 
@@ -2099,7 +2276,9 @@ declare class CliServerMultiProxyProcessor implements ICliCommandProcessor {
2099
2276
  metadata?: CliProcessorMetadata;
2100
2277
  parameters?: ICliCommandParameterDescriptor[];
2101
2278
  processors?: ICliCommandProcessor[];
2102
- constructor(entries: MultiProxyEntry[], provider: DefaultServerProvider);
2279
+ /** Full command path from root to this processor */
2280
+ private readonly commandPath;
2281
+ constructor(entries: MultiProxyEntry[], provider: DefaultServerProvider, parentPath?: string[]);
2103
2282
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
2104
2283
  }
2105
2284
 
@@ -2108,6 +2287,7 @@ declare class CliServerManager implements DefaultServerProvider {
2108
2287
  private readonly registry;
2109
2288
  readonly connections: Map<string, CliServerConnection>;
2110
2289
  private _logger?;
2290
+ private _cliLogger?;
2111
2291
  private _defaultServer;
2112
2292
  private _backgroundServices?;
2113
2293
  constructor(registry: ICliCommandProcessorRegistry);
@@ -2116,7 +2296,7 @@ declare class CliServerManager implements DefaultServerProvider {
2116
2296
  connectAll(servers: CliServerConfig[], logger?: {
2117
2297
  warn(msg: string): void;
2118
2298
  info(msg: string): void;
2119
- }, backgroundServices?: ICliBackgroundServiceRegistry): Promise<void>;
2299
+ }, backgroundServices?: ICliBackgroundServiceRegistry, cliLogger?: ICliLogger): Promise<void>;
2120
2300
  reconnect(name: string): Promise<{
2121
2301
  success: boolean;
2122
2302
  commandCount: number;
@@ -2152,6 +2332,7 @@ declare class CliSshCommandProcessor implements ICliCommandProcessor {
2152
2332
  parameters?: ICliCommandParameterDescriptor[];
2153
2333
  private socket;
2154
2334
  private context;
2335
+ private resolved;
2155
2336
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
2156
2337
  onData(data: string, context: ICliExecutionContext): Promise<void>;
2157
2338
  onResize(cols: number, rows: number, _context: ICliExecutionContext): void;
@@ -2262,6 +2443,10 @@ interface ICliWasmAccelerator {
2262
2443
  prefixMatch(candidates: string[], prefix: string): string[];
2263
2444
  /** Longest common prefix of the given strings. */
2264
2445
  commonPrefix(strings: string[]): string;
2446
+ /** Register a named rule set for syntax highlighting tokenization. */
2447
+ registerRuleSet(ruleSetId: string, rules: string): void;
2448
+ /** Tokenize a line using a previously registered rule set. Returns newline-separated "start,end,tokenType" entries. */
2449
+ tokenizeLine(line: string, ruleSetId: string): string;
2265
2450
  }
2266
2451
 
2267
2452
  /**
@@ -2275,6 +2460,9 @@ declare class JsFallbackAccelerator implements ICliWasmAccelerator {
2275
2460
  text: string;
2276
2461
  };
2277
2462
  prefixMatch(candidates: string[], prefix: string): string[];
2463
+ private ruleSets;
2464
+ registerRuleSet(ruleSetId: string, rules: string): void;
2465
+ tokenizeLine(line: string, ruleSetId: string): string;
2278
2466
  commonPrefix(strings: string[]): string;
2279
2467
  }
2280
2468
 
@@ -2299,4 +2487,4 @@ declare function getAccelerator(): ICliWasmAccelerator;
2299
2487
  */
2300
2488
  declare function isWasmAccelerated(): boolean;
2301
2489
 
2302
- export { API_VERSION, type ActiveInputRequest, type ActiveInputRequestType, CLi_Name_Art, CapturingTerminalWriter, type CdnSourceName, CliAliasCommandProcessor, CliArgsParser, CliBackgroundServiceRegistry_TOKEN, CliBase64CommandProcessor, CliBoot, CliCalCommandProcessor, CliCaptureCommandProcessor, CliClearCommandProcessor, CliClipboard, CliClipboardCommandProcessor, CliColorCommandProcessor, CliCommandExecutionContext, CliCommandExecutor, CliCommandHistory, CliCommandHistory_TOKEN, CliCommandProcessorRegistry, CliConfigureCommandProcessor, CliConvertCommandProcessor, CliDebugCommandProcessor, CliDefaultPingServerService, CliDiffCommandProcessor, CliDragDropService, CliEchoCommandProcessor, CliEngine, type CliEngineOptions, CliEnvCommandProcessor, CliEnvironment, CliEvalCommandProcessor, CliExecutionContext, type CliExecutionContextDeps, CliExecutionProcess, CliExportCommandProcessor, CliFeedbackCommandProcessor, CliFontSizeCommandProcessor, CliHashCommandProcessor, CliHelpCommandProcessor, CliHexCommandProcessor, CliHistoryCommandProcessor, CliHotKeysCommandProcessor, CliInputReader, type CliInputReaderHost, CliJsonCommandProcessor, CliJwtCommandProcessor, CliKeyValueStore, CliKillCommandProcessor, CliLogger, CliLoremCommandProcessor, CliModuleRegistry_TOKEN, CliNanoCommandProcessor, CliOpenCommandProcessor, CliPackageManagerService, CliPackageManagerService_TOKEN, CliPackagesCommandProcessor, CliPingCommandProcessor, CliProcessRegistry, CliProcessRegistry_TOKEN, CliProcessorsRegistry_TOKEN, CliPsCommandProcessor, CliRandomCommandProcessor, CliScreenCommandProcessor, CliSeqCommandProcessor, CliServerCommandProcessor, CliServerConnection, CliServerManager, CliServerManager_TOKEN, CliServerMultiProxyProcessor, CliServerProxyProcessor, CliServiceContainer, CliServicesCommandProcessor, CliSleepCommandProcessor, CliSnippetCommandProcessor, CliSshCommandProcessor, CliStateStore, CliStateStoreManager, CliStateStoreManager_TOKEN, CliTerminalProgressBar, CliTerminalSpinner, CliTerminalTextAnimator, CliTerminalWriter, CliTestHarness, type CliTestResult, CliThemeCommandProcessor, CliTimeCommandProcessor, CliTimestampCommandProcessor, CliUnAliasCommandProcessor, CliUnameCommandProcessor, CliUnsetCommandProcessor, CliUptimeCommandProcessor, CliUrlCommandProcessor, CliVersionCommandProcessor, type CliWelcomeMessageConfig, CliYesCommandProcessor, CommandParser, type CommandParserOutput, type CommandPart, type ConfigureState, type DefaultServerProvider, type DiffLine, type DiffType, type ICliEnvironment, ICliEnvironment_TOKEN, type ICliExecutionHost, ICliPingServerService_TOKEN, type ICliStateStoreManager, type ICliWasmAccelerator, JsFallbackAccelerator, LIBRARY_VERSION, type MultiProxyEntry, OverlayAddon, type ParsedArg, type ParsedToken, ProcessExitedError, ScriptLoaderService, type ThemeState, builtinProcessors, computeDiff, contextGlobalParameter, createServerModule, executeOnServer, formatDiff, getAccelerator, getCliNameArt, getGreetingBasedOnTime, groupBy, helpGlobalParameter, hotkeysInfo, initWasmAccelerator, isWasmAccelerated, miscProcessors, openLink, reconcileArgs, renderServerResponse, systemProcessors, themeInfos, themes, versionGlobalParameter, welcomeModule };
2490
+ export { API_VERSION, CLi_Name_Art, CapturingTerminalWriter, type CdnSourceName, CliAliasCommandProcessor, CliArgsParser, CliBackgroundServiceRegistry_TOKEN, CliBoot, CliCalCommandProcessor, CliCaptureCommandProcessor, CliClearCommandProcessor, CliClipboard, CliClipboardCommandProcessor, CliColorCommandProcessor, CliCommandExecutionContext, CliCommandExecutor, CliCommandHistory, CliCommandHistory_TOKEN, CliCommandProcessorRegistry, CliConfigureCommandProcessor, CliConvertCommandProcessor, CliDebugCommandProcessor, CliDefaultPingServerService, CliDiffCommandProcessor, CliDragDropService, CliEchoCommandProcessor, CliEngine, type CliEngineOptions, CliEnvCommandProcessor, CliEnvironment, CliEvalCommandProcessor, CliExecutionContext, type CliExecutionContextDeps, CliExecutionProcess, CliExportCommandProcessor, CliFeedbackCommandProcessor, CliFontSizeCommandProcessor, CliFullScreenManager, CliHelpCommandProcessor, CliHistoryCommandProcessor, CliHotKeysCommandProcessor, CliHtopCommandProcessor, CliInputReader, CliJsonCommandProcessor, CliKeyValueStore, CliKillCommandProcessor, CliLogger, CliLoremCommandProcessor, CliModuleRegistry_TOKEN, CliNanoCommandProcessor, CliOpenCommandProcessor, CliPackageManagerService, CliPackageManagerService_TOKEN, CliPackagesCommandProcessor, CliPingCommandProcessor, CliProcessRegistry, CliProcessRegistry_TOKEN, CliProcessorsRegistry_TOKEN, CliPsCommandProcessor, CliRandomCommandProcessor, CliScreenCommandProcessor, CliSeqCommandProcessor, CliServerCommandProcessor, CliServerConnection, CliServerManager, CliServerManager_TOKEN, CliServerMultiProxyProcessor, CliServerProxyProcessor, CliServiceContainer, CliServicesCommandProcessor, CliSleepCommandProcessor, CliSnippetCommandProcessor, CliSshCommandProcessor, CliStateStore, CliStateStoreManager, CliStateStoreManager_TOKEN, CliTerminalProgressBar, CliTerminalSpinner, CliTerminalTextAnimator, CliTerminalWriter, CliTestHarness, type CliTestResult, CliThemeCommandProcessor, CliTimeCommandProcessor, CliTimerManager, CliTimestampCommandProcessor, CliUnAliasCommandProcessor, CliUnameCommandProcessor, CliUnsetCommandProcessor, CliUptimeCommandProcessor, CliVersionCommandProcessor, type CliWelcomeMessageConfig, CliYesCommandProcessor, CommandParser, type CommandParserOutput, type CommandPart, type ConfigureState, type DefaultServerProvider, type DiffLine, type DiffType, type ICliEnvironment, ICliEnvironment_TOKEN, type ICliExecutionHost, ICliPingServerService_TOKEN, type ICliStateStoreManager, type ICliWasmAccelerator, type InitializeServicesOptions, type InitializeServicesResult, JsFallbackAccelerator, LIBRARY_VERSION, type MultiProxyEntry, OverlayAddon, type ParsedArg, type ParsedToken, ProcessExitedError, ScriptLoaderService, type TerminalSetupResult, type ThemeState, appendOutputToFile, appendStderrToFile, builtinProcessors, computeDiff, contextGlobalParameter, createServerModule, executeOnServer, expandEnvironmentVars, formatDiff, getAccelerator, getCliNameArt, getGreetingBasedOnTime, getTerminalOptions, groupBy, helpGlobalParameter, hotkeysInfo, initWasmAccelerator, initializeServices, initializeTerminal, isWasmAccelerated, miscProcessors, openLink, reconcileArgs, renderServerResponse, renderSingleOutput, substituteVars, systemProcessors, themeInfos, themes, tryExecuteScript, versionGlobalParameter, waitForLayout, welcomeModule, writeOutputToFile, writeStderrToFile };