@qodalis/cli 2.0.0-beta.8 → 2.0.0-rc.1

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.mts CHANGED
@@ -1,8 +1,10 @@
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, ICliCompletionProvider, ICliFilePickerProvider, ICliGlobalParameterHandler, CliProvider, CliForegroundColor, CliBackgroundColor, CliLogLevel, CliPercentageProgressBarUpdateValueOptions, CliTextAnimatorOptions, ICliModule, CliModuleRegistry, Package, ICliPingServerService, CliLineOptions, CliSelectOption, CliSelectOptions, CliMultiSelectOption, CliMultiSelectOptions, CliDateOptions, CliFilePickerOptions, CliFileResult, ICliProcessRegistry, ICliProcessRegisterOptions, ICliProcessEntry, ICliDragDropService, CliState, CliEngineSnapshot, CliServerConfig, CliServerCommandDescriptor, CliServerCapabilities, CliServerResponse, CliIcon } from '@qodalis/cli-core';
1
+ import { ICliCommandProcessor, ICliCommandParameterDescriptor as ICliCommandParameterDescriptor$1, ICliCommandProcessorRegistry, ICliCommandChildProcessor, CliProcessorMetadata, CliStateConfiguration, ICliExecutionContext, CliProcessCommand, ICliCommandAuthor, CliThemeInfo, ICliExecutionProcess, ICliUserSession, ICliSpinner, ICliPercentageProgressBar, ICliTextAnimator, ICliTerminalWriter, ICliCommandExecutorService, ICliClipboard, ICliStateStore, CliOptions, ICliLogger, ICliServiceProvider, ICliTranslationService, ICliInputReader, ICliBackgroundServiceRegistry, ICliHttpClient, ICliNotifier, ICliManagedInterval, ICliManagedTimer, ICliEventBus, ICliKeyValueStore, CliStateStoreOptions, ICliCompletionProvider, ICliFilePickerProvider, CliFullScreenOptions, ICliProcessRegistry, ICliBackgroundService, ICliServiceContext, ICliBackgroundServiceInfo, ICliServiceLogEntry, CliServiceEventHandler, ICliGlobalParameterHandler, CliForegroundColor, CliBackgroundColor, CliToken, CliProvider, CliTableOptions, CliLogLevel, CliPercentageProgressBarUpdateValueOptions, CliTextAnimatorOptions, ICliModule, CliModuleRegistry, Package, ICliPingServerService, CliLineOptions, CliSelectOption, CliSelectOptions, CliMultiSelectOption, CliMultiSelectOptions, CliNumberOptions, CliDateOptions, CliFilePickerOptions, CliFileResult, ICliProcessRegisterOptions, ICliProcessEntry, ICliDragDropService, CliHttpRequestOptions, CliNotification, ICliPermissionRegistry, CliPermissionDefinition, CliState, CliEngineSnapshot, CliEvent, CliEventType, CliEventMap, CliEmitOptions, CustomEventType, CliEventHandler, CliServerConfig, ICliServerAuthService, CliServerCommandDescriptor, CliServerCapabilities, CliServerResponse, CliServerOutput, CliPanelPosition, CliPanelConfig, CliPanelHideAlignment, ICliPanelRef, CliPanelState } from '@qodalis/cli-core';
3
2
  export { ICliUserSessionService_TOKEN, ICliUsersStoreService_TOKEN } from '@qodalis/cli-core';
4
3
  import { ITheme, Terminal, ITerminalAddon, ITerminalOptions, ITerminalInitOnlyOptions } from '@xterm/xterm';
4
+ import * as rxjs from 'rxjs';
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;
@@ -13,6 +15,8 @@ type ParsedToken = {
13
15
  name: string;
14
16
  value: string | number | boolean;
15
17
  hasEquals: boolean;
18
+ /** Written with one dash (`-rf`), so it may be several short flags */
19
+ short?: boolean;
16
20
  } | {
17
21
  kind: 'word';
18
22
  value: string;
@@ -70,7 +74,7 @@ declare class CliArgsParser {
70
74
  * @param descriptors - Parameter descriptors from the matched processor.
71
75
  * @returns Reconciled args array and remaining command parts.
72
76
  */
73
- declare function reconcileArgs(tokens: ParsedToken[], descriptors: ICliCommandParameterDescriptor[] | undefined): {
77
+ declare function reconcileArgs(tokens: ParsedToken[], descriptors: ICliCommandParameterDescriptor$1[] | undefined): {
74
78
  args: ParsedArg[];
75
79
  commandParts: string[];
76
80
  };
@@ -88,6 +92,11 @@ declare class ProcessExitedError extends Error {
88
92
 
89
93
  declare class CliCommandProcessorRegistry implements ICliCommandProcessorRegistry {
90
94
  readonly processors: ICliCommandProcessor[];
95
+ /**
96
+ * Sub-commands each extension (`extendsProcessor`) merged into an
97
+ * existing command, removed again when the extension is unregistered.
98
+ */
99
+ private readonly mergedByExtension;
91
100
  constructor(initialProcessors?: ICliCommandProcessor[]);
92
101
  registerProcessor(processor: ICliCommandProcessor): void;
93
102
  unregisterProcessor(processor: ICliCommandProcessor): void;
@@ -108,51 +117,72 @@ declare class CliCommandProcessorRegistry implements ICliCommandProcessorRegistr
108
117
  * Framework-agnostic token for the CLI command processor registry.
109
118
  * Used as a key in the service provider to retrieve the registry.
110
119
  */
111
- declare const CliProcessorsRegistry_TOKEN = "cli-processors-registry";
120
+ declare const CliProcessorsRegistry_TOKEN: any;
112
121
  /**
113
122
  * Framework-agnostic token for the CLI state store manager.
114
123
  * Used as a key in the service provider to retrieve the state store manager.
115
124
  */
116
- declare const CliStateStoreManager_TOKEN = "cli-state-store-manager";
125
+ declare const CliStateStoreManager_TOKEN: any;
117
126
  /**
118
127
  * Framework-agnostic token for the CLI command history service.
119
128
  * Used as a key in the service provider to retrieve the command history.
120
129
  */
121
- declare const CliCommandHistory_TOKEN = "cli-command-history";
130
+ declare const CliCommandHistory_TOKEN: any;
122
131
  /**
123
132
  * Framework-agnostic token for the CLI ping server service.
124
133
  * Used as a key in the service provider to retrieve the ping server service.
125
134
  */
126
- declare const ICliPingServerService_TOKEN = "cli-ping-server-service";
135
+ declare const ICliPingServerService_TOKEN: any;
127
136
  /**
128
137
  * Framework-agnostic token for the CLI module registry.
129
138
  * Used as a key in the service provider to retrieve the module registry.
130
139
  */
131
- declare const CliModuleRegistry_TOKEN = "cli-module-registry";
140
+ declare const CliModuleRegistry_TOKEN: any;
141
+ /**
142
+ * The live boot report (`CliBootLog`) while the CLI starts. Processors and
143
+ * modules can add steps and lines from `initialize`/`onInit`; it ignores
144
+ * entries once boot has finished.
145
+ */
146
+ declare const CliBootLog_TOKEN: any;
132
147
  /**
133
148
  * Framework-agnostic token for the CLI background service registry.
134
149
  * Used as a key in the service provider to retrieve the background service registry.
135
150
  */
136
- declare const CliBackgroundServiceRegistry_TOKEN = "cli-background-service-registry";
151
+ declare const CliBackgroundServiceRegistry_TOKEN: any;
137
152
  /**
138
153
  * Framework-agnostic token for the CLI package manager service.
139
154
  * Used as a key in the service provider to retrieve the package manager.
140
155
  */
141
- declare const CliPackageManagerService_TOKEN = "cli-package-manager-service";
156
+ declare const CliPackageManagerService_TOKEN: any;
157
+ /**
158
+ * Framework-agnostic token for the CLI key-value store.
159
+ * Used as a key in the service provider to retrieve the persistent storage.
160
+ */
161
+ declare const CliKeyValueStore_TOKEN: any;
162
+ /**
163
+ * Framework-agnostic token for the syntax highlighter registry.
164
+ * Used as a key in the service provider to retrieve the syntax highlighter registry.
165
+ */
166
+ declare const SyntaxHighlighterRegistry_TOKEN: any;
142
167
 
143
- declare const LIBRARY_VERSION = "2.0.0-beta.8";
168
+ declare const LIBRARY_VERSION = "2.0.0-rc.1";
144
169
  declare const API_VERSION = 2;
145
170
 
146
171
  declare class CliAliasCommandProcessor implements ICliCommandProcessor {
147
172
  command: string;
148
- author: _qodalis_cli_core.ICliCommandAuthor;
173
+ author: any;
149
174
  description: string;
150
- processors?: ICliCommandProcessor[] | undefined;
175
+ acceptsRawInput: boolean;
151
176
  metadata?: CliProcessorMetadata | undefined;
152
177
  stateConfiguration?: CliStateConfiguration | undefined;
178
+ /** Shared aliases (used when no auth module is loaded) */
153
179
  userAliases: Record<string, string>;
180
+ private aliasState;
181
+ /** Aliases visible to the current principal */
182
+ aliasesFor(context: Pick<ICliExecutionContext, 'services'>): Record<string, string>;
154
183
  private stateSubscription?;
155
- constructor();
184
+ /** `alias ls`: list the aliases visible to the current principal */
185
+ private listAliases;
156
186
  writeDescription(context: ICliExecutionContext): void;
157
187
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
158
188
  initialize(context: ICliExecutionContext): Promise<void>;
@@ -162,7 +192,7 @@ declare class CliCalCommandProcessor implements ICliCommandProcessor {
162
192
  command: string;
163
193
  aliases: string[];
164
194
  description: string;
165
- author: _qodalis_cli_core.ICliCommandAuthor;
195
+ author: any;
166
196
  metadata?: CliProcessorMetadata;
167
197
  parameters: {
168
198
  name: string;
@@ -179,7 +209,7 @@ declare class CliClearCommandProcessor implements ICliCommandProcessor {
179
209
  command: string;
180
210
  aliases: string[];
181
211
  description?: string | undefined;
182
- author: _qodalis_cli_core.ICliCommandAuthor;
212
+ author: any;
183
213
  metadata?: CliProcessorMetadata | undefined;
184
214
  processCommand(_: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
185
215
  writeDescription(context: ICliExecutionContext): void;
@@ -189,7 +219,7 @@ declare class CliClipboardCommandProcessor implements ICliCommandProcessor {
189
219
  command: string;
190
220
  aliases: string[];
191
221
  description: string;
192
- author: _qodalis_cli_core.ICliCommandAuthor;
222
+ author: any;
193
223
  processors?: ICliCommandProcessor[];
194
224
  metadata?: CliProcessorMetadata;
195
225
  constructor();
@@ -201,7 +231,7 @@ declare class CliColorCommandProcessor implements ICliCommandProcessor {
201
231
  command: string;
202
232
  aliases: string[];
203
233
  description: string;
204
- author: _qodalis_cli_core.ICliCommandAuthor;
234
+ author: any;
205
235
  acceptsRawInput: boolean;
206
236
  valueRequired: boolean;
207
237
  metadata?: CliProcessorMetadata;
@@ -219,7 +249,7 @@ declare class CliConvertCommandProcessor implements ICliCommandProcessor {
219
249
  command: string;
220
250
  aliases: string[];
221
251
  description: string;
222
- author: _qodalis_cli_core.ICliCommandAuthor;
252
+ author: any;
223
253
  acceptsRawInput: boolean;
224
254
  valueRequired: boolean;
225
255
  metadata?: CliProcessorMetadata;
@@ -235,11 +265,9 @@ declare class CliEchoCommandProcessor implements ICliCommandProcessor {
235
265
  aliases: string[];
236
266
  description: string;
237
267
  acceptsRawInput: boolean;
238
- author: _qodalis_cli_core.ICliCommandAuthor;
268
+ author: any;
239
269
  metadata?: CliProcessorMetadata | undefined;
240
270
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
241
- /** Remove surrounding quotes from the text. */
242
- private stripQuotes;
243
271
  /** Interpret common escape sequences like a POSIX echo -e. */
244
272
  private interpretEscapes;
245
273
  writeDescription(context: ICliExecutionContext): void;
@@ -249,7 +277,7 @@ declare class CliEvalCommandProcessor implements ICliCommandProcessor {
249
277
  command: string;
250
278
  aliases: string[];
251
279
  description: string;
252
- author: _qodalis_cli_core.ICliCommandAuthor;
280
+ author: any;
253
281
  acceptsRawInput: boolean;
254
282
  metadata?: CliProcessorMetadata | undefined;
255
283
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
@@ -259,7 +287,7 @@ declare class CliEvalCommandProcessor implements ICliCommandProcessor {
259
287
  declare class CliJsonCommandProcessor implements ICliCommandProcessor {
260
288
  command: string;
261
289
  description: string;
262
- author: _qodalis_cli_core.ICliCommandAuthor;
290
+ author: any;
263
291
  processors?: ICliCommandProcessor[];
264
292
  metadata?: CliProcessorMetadata;
265
293
  constructor();
@@ -271,7 +299,7 @@ declare class CliLoremCommandProcessor implements ICliCommandProcessor {
271
299
  command: string;
272
300
  aliases: string[];
273
301
  description: string;
274
- author: _qodalis_cli_core.ICliCommandAuthor;
302
+ author: any;
275
303
  processors?: ICliCommandProcessor[];
276
304
  metadata?: CliProcessorMetadata;
277
305
  constructor();
@@ -283,7 +311,7 @@ declare class CliLoremCommandProcessor implements ICliCommandProcessor {
283
311
  declare class CliOpenCommandProcessor implements ICliCommandProcessor {
284
312
  command: string;
285
313
  description: string;
286
- author: _qodalis_cli_core.ICliCommandAuthor;
314
+ author: any;
287
315
  acceptsRawInput: boolean;
288
316
  valueRequired: boolean;
289
317
  metadata?: CliProcessorMetadata;
@@ -295,7 +323,7 @@ declare class CliRandomCommandProcessor implements ICliCommandProcessor {
295
323
  command: string;
296
324
  aliases: string[];
297
325
  description: string;
298
- author: _qodalis_cli_core.ICliCommandAuthor;
326
+ author: any;
299
327
  processors?: ICliCommandProcessor[];
300
328
  metadata?: CliProcessorMetadata;
301
329
  constructor();
@@ -307,7 +335,7 @@ declare class CliScreenCommandProcessor implements ICliCommandProcessor {
307
335
  command: string;
308
336
  aliases: string[];
309
337
  description: string;
310
- author: _qodalis_cli_core.ICliCommandAuthor;
338
+ author: any;
311
339
  metadata?: CliProcessorMetadata;
312
340
  processCommand(_: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
313
341
  writeDescription(context: ICliExecutionContext): void;
@@ -317,7 +345,7 @@ declare class CliSeqCommandProcessor implements ICliCommandProcessor {
317
345
  command: string;
318
346
  aliases: string[];
319
347
  description: string;
320
- author: _qodalis_cli_core.ICliCommandAuthor;
348
+ author: any;
321
349
  acceptsRawInput: boolean;
322
350
  valueRequired: boolean;
323
351
  metadata?: CliProcessorMetadata;
@@ -342,7 +370,7 @@ declare class CliSleepCommandProcessor implements ICliCommandProcessor {
342
370
  command: string;
343
371
  aliases: string[];
344
372
  description?: string | undefined;
345
- author: _qodalis_cli_core.ICliCommandAuthor;
373
+ author: any;
346
374
  metadata?: CliProcessorMetadata | undefined;
347
375
  valueRequired?: boolean | undefined;
348
376
  constructor();
@@ -354,7 +382,7 @@ declare class CliTimeCommandProcessor implements ICliCommandProcessor {
354
382
  command: string;
355
383
  aliases: string[];
356
384
  description: string;
357
- author: _qodalis_cli_core.ICliCommandAuthor;
385
+ author: any;
358
386
  version: string;
359
387
  processors?: ICliCommandProcessor[] | undefined;
360
388
  metadata?: CliProcessorMetadata | undefined;
@@ -367,7 +395,7 @@ declare class CliTimestampCommandProcessor implements ICliCommandProcessor {
367
395
  command: string;
368
396
  aliases: string[];
369
397
  description: string;
370
- author: _qodalis_cli_core.ICliCommandAuthor;
398
+ author: any;
371
399
  processors?: ICliCommandProcessor[];
372
400
  metadata?: CliProcessorMetadata;
373
401
  constructor();
@@ -377,7 +405,7 @@ declare class CliTimestampCommandProcessor implements ICliCommandProcessor {
377
405
 
378
406
  declare class CliUnAliasCommandProcessor implements ICliCommandProcessor {
379
407
  command: string;
380
- author: _qodalis_cli_core.ICliCommandAuthor;
408
+ author: any;
381
409
  description: string;
382
410
  valueRequired?: boolean | undefined;
383
411
  stateConfiguration?: CliStateConfiguration | undefined;
@@ -390,7 +418,7 @@ declare class CliUnameCommandProcessor implements ICliCommandProcessor {
390
418
  command: string;
391
419
  aliases: string[];
392
420
  description?: string | undefined;
393
- author: _qodalis_cli_core.ICliCommandAuthor;
421
+ author: any;
394
422
  metadata?: CliProcessorMetadata | undefined;
395
423
  writeDescription(context: ICliExecutionContext): void;
396
424
  processCommand(_: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
@@ -404,7 +432,7 @@ declare class CliUnameCommandProcessor implements ICliCommandProcessor {
404
432
  declare class CliUptimeCommandProcessor implements ICliCommandProcessor {
405
433
  command: string;
406
434
  description: string;
407
- author: _qodalis_cli_core.ICliCommandAuthor;
435
+ author: any;
408
436
  metadata?: CliProcessorMetadata;
409
437
  initialize(context: ICliExecutionContext): Promise<void>;
410
438
  processCommand(_: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
@@ -414,7 +442,7 @@ declare class CliUptimeCommandProcessor implements ICliCommandProcessor {
414
442
  declare class CliYesCommandProcessor implements ICliCommandProcessor {
415
443
  command: string;
416
444
  description: string;
417
- author: _qodalis_cli_core.ICliCommandAuthor;
445
+ author: any;
418
446
  acceptsRawInput: boolean;
419
447
  metadata?: CliProcessorMetadata;
420
448
  parameters: {
@@ -428,14 +456,49 @@ declare class CliYesCommandProcessor implements ICliCommandProcessor {
428
456
  writeDescription(context: ICliExecutionContext): void;
429
457
  }
430
458
 
459
+ /**
460
+ * `test EXPR` / `[ EXPR ]`: evaluate a condition; exit status 0 when true,
461
+ * 1 when false and 2 on an error. Used by `if`, `while` and `&&`/`||`.
462
+ */
463
+ declare class CliTestCommandProcessor implements ICliCommandProcessor {
464
+ command: string;
465
+ aliases: string[];
466
+ description: string;
467
+ author: any;
468
+ acceptsRawInput: boolean;
469
+ metadata?: CliProcessorMetadata;
470
+ processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
471
+ writeDescription(context: ICliExecutionContext): void;
472
+ }
473
+ /** `true`: do nothing, successfully (also `:`). */
474
+ declare class CliTrueCommandProcessor implements ICliCommandProcessor {
475
+ command: string;
476
+ aliases: string[];
477
+ description: string;
478
+ author: any;
479
+ acceptsRawInput: boolean;
480
+ metadata?: CliProcessorMetadata;
481
+ processCommand(): Promise<void>;
482
+ }
483
+ /** `false`: do nothing, unsuccessfully (exit status 1). */
484
+ declare class CliFalseCommandProcessor implements ICliCommandProcessor {
485
+ command: string;
486
+ description: string;
487
+ author: any;
488
+ acceptsRawInput: boolean;
489
+ metadata?: CliProcessorMetadata;
490
+ processCommand(_command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
491
+ }
492
+
431
493
  declare class CliCaptureCommandProcessor implements ICliCommandProcessor {
432
494
  command: string;
433
495
  description: string;
434
496
  aliases: string[];
435
497
  author: ICliCommandAuthor;
436
498
  metadata: CliProcessorMetadata;
437
- parameters: ICliCommandParameterDescriptor[];
499
+ parameters: ICliCommandParameterDescriptor$1[];
438
500
  processCommand(cmd: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
501
+ writeDescription(context: ICliExecutionContext): void;
439
502
  private sanitizeCssColor;
440
503
  private toHtml;
441
504
  private escapeHtml;
@@ -450,6 +513,7 @@ declare class CliSnippetCommandProcessor implements ICliCommandProcessor {
450
513
  metadata: CliProcessorMetadata;
451
514
  stateConfiguration: CliStateConfiguration;
452
515
  processors: ICliCommandChildProcessor[];
516
+ writeDescription(context: ICliExecutionContext): void;
453
517
  processCommand(_: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
454
518
  }
455
519
 
@@ -458,8 +522,9 @@ declare class CliDiffCommandProcessor implements ICliCommandProcessor {
458
522
  description: string;
459
523
  author: ICliCommandAuthor;
460
524
  metadata: CliProcessorMetadata;
461
- parameters: ICliCommandParameterDescriptor[];
525
+ parameters: ICliCommandParameterDescriptor$1[];
462
526
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
527
+ writeDescription(context: ICliExecutionContext): void;
463
528
  }
464
529
 
465
530
  type DiffType = 'same' | 'add' | 'remove';
@@ -481,11 +546,17 @@ declare class CliHelpCommandProcessor implements ICliCommandProcessor {
481
546
  aliases: string[];
482
547
  description: string;
483
548
  acceptsRawInput?: boolean | undefined;
484
- author: _qodalis_cli_core.ICliCommandAuthor;
549
+ author: any;
485
550
  metadata?: CliProcessorMetadata | undefined;
486
551
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
487
552
  writeDescription(context: ICliExecutionContext): void;
488
553
  private translateDescription;
554
+ /**
555
+ * Canonical path of the command being described (`server.status` for
556
+ * `help srv ping`), so a sub-command's translation keys include its
557
+ * parents: `cli.server.status.description`.
558
+ */
559
+ private commandPath;
489
560
  private writeProcessorDescription;
490
561
  private formatModuleName;
491
562
  private writeParameter;
@@ -531,44 +602,45 @@ declare class CliHotKeysCommandProcessor implements ICliCommandProcessor {
531
602
  aliases: string[];
532
603
  description: string;
533
604
  processors?: ICliCommandProcessor[] | undefined;
534
- author: _qodalis_cli_core.ICliCommandAuthor;
605
+ author: any;
535
606
  metadata?: CliProcessorMetadata | undefined;
536
607
  processCommand(_: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
537
608
  writeDescription(context: ICliExecutionContext): void;
538
609
  }
539
610
 
611
+ /** `pkg`: install, update and remove CLI plugins at runtime from npm/CDN sources. */
540
612
  declare class CliPackagesCommandProcessor implements ICliCommandProcessor {
541
613
  readonly command = "pkg";
542
614
  readonly aliases: string[];
543
615
  description: string;
544
- author: _qodalis_cli_core.ICliCommandAuthor;
545
- readonly version = "1.0.3";
546
- readonly processors?: ICliCommandProcessor[] | undefined;
616
+ author: any;
617
+ readonly version = "1.1.0";
618
+ readonly processors: ICliCommandProcessor[];
547
619
  readonly metadata?: CliProcessorMetadata | undefined;
548
620
  stateConfiguration?: CliStateConfiguration | undefined;
549
- private registeredDependencies;
550
- private scriptsLoader;
551
- private packagesManager;
552
- private registry;
553
- private createAbortSignal;
621
+ private readonly loader;
622
+ private readonly manager;
623
+ private readonly installer;
554
624
  constructor();
555
625
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
556
- writeDescription?(context: ICliExecutionContext): void;
626
+ writeDescription(context: ICliExecutionContext): void;
557
627
  initialize(context: ICliExecutionContext): Promise<void>;
558
- private removePackage;
559
- private addPackage;
560
- private doAddPackage;
561
- private updatePackage;
562
- private injectScriptWithCdnFallback;
563
- private registerPackageDependencies;
564
- private resolvePackageCdnPath;
565
- private waitForGlobal;
628
+ private lsCommand;
629
+ private browseCommand;
630
+ private addCommand;
631
+ private removeCommand;
632
+ private versionsCommand;
633
+ private checkCommand;
634
+ private updateCommand;
635
+ private sourceCommand;
636
+ /** Install as a tracked background job (visible in `services`), or inline if that fails. */
637
+ private installInBackground;
566
638
  }
567
639
 
568
640
  declare class CliDebugCommandProcessor implements ICliCommandProcessor {
569
641
  command: string;
570
642
  description: string;
571
- author: _qodalis_cli_core.ICliCommandAuthor;
643
+ author: any;
572
644
  metadata?: CliProcessorMetadata;
573
645
  processors?: ICliCommandProcessor[];
574
646
  processCommand(_: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
@@ -580,7 +652,7 @@ declare class CliNanoCommandProcessor implements ICliCommandProcessor {
580
652
  command: string;
581
653
  aliases: string[];
582
654
  description: string;
583
- author: _qodalis_cli_core.ICliCommandAuthor;
655
+ author: any;
584
656
  acceptsRawInput: boolean;
585
657
  metadata: CliProcessorMetadata;
586
658
  private buffer;
@@ -618,7 +690,7 @@ declare class CliServicesCommandProcessor implements ICliCommandProcessor {
618
690
  command: string;
619
691
  aliases: string[];
620
692
  description: string;
621
- author: _qodalis_cli_core.ICliCommandAuthor;
693
+ author: any;
622
694
  processors?: ICliCommandProcessor[];
623
695
  metadata?: CliProcessorMetadata;
624
696
  constructor();
@@ -626,33 +698,50 @@ declare class CliServicesCommandProcessor implements ICliCommandProcessor {
626
698
  writeDescription(context: ICliExecutionContext): void;
627
699
  }
628
700
 
701
+ /**
702
+ * `events`: inspect the terminal's event bus — watch events live, show the
703
+ * recent ones, or emit one (for testing plugins).
704
+ */
705
+ declare class CliEventsCommandProcessor implements ICliCommandProcessor {
706
+ command: string;
707
+ description: string;
708
+ author: any;
709
+ version: string;
710
+ metadata?: CliProcessorMetadata;
711
+ processors: ICliCommandProcessor[];
712
+ processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
713
+ writeDescription(context: ICliExecutionContext): void;
714
+ }
715
+
629
716
  declare class CliPsCommandProcessor implements ICliCommandProcessor {
630
717
  command: string;
631
718
  description: string;
632
- author: _qodalis_cli_core.ICliCommandAuthor;
719
+ author: any;
633
720
  metadata: {
634
721
  icon: string;
635
722
  sealed: boolean;
636
723
  };
637
724
  processCommand(_command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
725
+ writeDescription(context: ICliExecutionContext): void;
638
726
  }
639
727
 
640
728
  declare class CliKillCommandProcessor implements ICliCommandProcessor {
641
729
  command: string;
642
730
  description: string;
643
- author: _qodalis_cli_core.ICliCommandAuthor;
731
+ author: any;
644
732
  valueRequired: boolean;
645
733
  metadata: {
646
734
  icon: string;
647
735
  sealed: boolean;
648
736
  };
649
737
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
738
+ writeDescription(context: ICliExecutionContext): void;
650
739
  }
651
740
 
652
741
  declare class CliHtopCommandProcessor implements ICliCommandProcessor {
653
742
  command: string;
654
743
  description: string;
655
- author: _qodalis_cli_core.ICliCommandAuthor;
744
+ author: any;
656
745
  metadata?: CliProcessorMetadata;
657
746
  private context;
658
747
  private registry;
@@ -701,6 +790,8 @@ declare class CliThemeCommandProcessor implements ICliCommandProcessor {
701
790
  private defaultTheme;
702
791
  constructor();
703
792
  initialize(context: ICliExecutionContext): Promise<void>;
793
+ /** Apply the saved theme (or the default one when `reset` and none is saved). */
794
+ private applySavedTheme;
704
795
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
705
796
  private renderThemePreview;
706
797
  private applyStyles;
@@ -712,39 +803,7 @@ type ThemeState = {
712
803
  selectedTheme?: string;
713
804
  customOptions?: ITheme;
714
805
  };
715
- declare const themes: {
716
- [key: string]: ITheme;
717
- default: _qodalis_cli_core.CliTheme;
718
- classic: _qodalis_cli_core.CliTheme;
719
- dracula: _qodalis_cli_core.CliTheme;
720
- monokai: _qodalis_cli_core.CliTheme;
721
- solarizedDark: _qodalis_cli_core.CliTheme;
722
- solarizedLight: _qodalis_cli_core.CliTheme;
723
- gruvboxDark: _qodalis_cli_core.CliTheme;
724
- gruvboxLight: _qodalis_cli_core.CliTheme;
725
- nord: _qodalis_cli_core.CliTheme;
726
- oneDark: _qodalis_cli_core.CliTheme;
727
- material: _qodalis_cli_core.CliTheme;
728
- highContrastLight: _qodalis_cli_core.CliTheme;
729
- tokyoNight: _qodalis_cli_core.CliTheme;
730
- catppuccinMocha: _qodalis_cli_core.CliTheme;
731
- catppuccinFrappe: _qodalis_cli_core.CliTheme;
732
- rosePine: _qodalis_cli_core.CliTheme;
733
- kanagawa: _qodalis_cli_core.CliTheme;
734
- everforestDark: _qodalis_cli_core.CliTheme;
735
- ayuDark: _qodalis_cli_core.CliTheme;
736
- catppuccinLatte: _qodalis_cli_core.CliTheme;
737
- rosePineDawn: _qodalis_cli_core.CliTheme;
738
- everforestLight: _qodalis_cli_core.CliTheme;
739
- githubLight: _qodalis_cli_core.CliTheme;
740
- cyberpunk: _qodalis_cli_core.CliTheme;
741
- retroGreen: _qodalis_cli_core.CliTheme;
742
- retroAmber: _qodalis_cli_core.CliTheme;
743
- matrix: _qodalis_cli_core.CliTheme;
744
- synthwave: _qodalis_cli_core.CliTheme;
745
- highContrastDark: _qodalis_cli_core.CliTheme;
746
- yellow: _qodalis_cli_core.CliTheme;
747
- };
806
+ declare const themes: any;
748
807
  declare const themeInfos: Record<string, CliThemeInfo>;
749
808
 
750
809
  declare class CliConfigureCommandProcessor implements ICliCommandProcessor {
@@ -764,7 +823,16 @@ declare class CliConfigureCommandProcessor implements ICliCommandProcessor {
764
823
  private editOption;
765
824
  private setConfigValue;
766
825
  private getConfigValue;
826
+ /**
827
+ * The language choices are the locales loaded so far: a language pack
828
+ * installed after boot (`pkg add @qodalis/cli-lang-de`) adds one.
829
+ */
830
+ private refreshLanguageOptions;
767
831
  private getAllOptions;
832
+ /**
833
+ * @param onBoot at startup, terminal options still at their default are skipped so the
834
+ * host's `terminalOptions` (e.g. its own fontSize) are not overridden.
835
+ */
768
836
  private applySystemSettings;
769
837
  private buildListProcessor;
770
838
  private buildGetProcessor;
@@ -799,22 +867,39 @@ declare class CliPingCommandProcessor implements ICliCommandProcessor {
799
867
  private sleep;
800
868
  }
801
869
 
870
+ /** Permission to change shared variables, when an auth module is loaded. */
871
+ declare const CLI_ENV_GLOBAL_PERMISSION = "system:env:global";
872
+ /** Parse `A=1 B="two words" C` into assignments; bare names have no value. */
873
+ declare function parseAssignments(raw: string): {
874
+ name: string;
875
+ value?: string;
876
+ }[] | null;
802
877
  /**
803
878
  * `export` — set environment variables.
804
879
  *
805
880
  * Usage:
806
881
  * export VAR=value
807
- * export VAR="value with spaces"
882
+ * export VAR="value with spaces" OTHER=1
883
+ *
884
+ * Variables are saved for the signed-in user (`--global`: for everyone) and
885
+ * restored on the next visit. `NAME=value` alone is for this terminal only.
808
886
  */
809
887
  declare class CliExportCommandProcessor implements ICliCommandProcessor {
810
888
  command: string;
811
889
  description: string;
812
- author: _qodalis_cli_core.ICliCommandAuthor;
890
+ author: any;
813
891
  acceptsRawInput: boolean;
814
892
  metadata: {
815
893
  icon: string;
816
894
  module: string;
817
895
  };
896
+ parameters: ICliCommandParameterDescriptor[];
897
+ stateConfiguration: CliStateConfiguration;
898
+ /**
899
+ * Restore saved variables, save every later change (export, unset) and
900
+ * follow changes saved in other tabs and terminals.
901
+ */
902
+ initialize(context: ICliExecutionContext): Promise<void>;
818
903
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
819
904
  writeDescription(context: ICliExecutionContext): void;
820
905
  }
@@ -824,12 +909,13 @@ declare class CliExportCommandProcessor implements ICliCommandProcessor {
824
909
  declare class CliUnsetCommandProcessor implements ICliCommandProcessor {
825
910
  command: string;
826
911
  description: string;
827
- author: _qodalis_cli_core.ICliCommandAuthor;
912
+ author: any;
828
913
  acceptsRawInput: boolean;
829
914
  metadata: {
830
915
  icon: string;
831
916
  module: string;
832
917
  };
918
+ parameters: any[];
833
919
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
834
920
  writeDescription(context: ICliExecutionContext): void;
835
921
  }
@@ -840,7 +926,7 @@ declare class CliEnvCommandProcessor implements ICliCommandProcessor {
840
926
  command: string;
841
927
  aliases: string[];
842
928
  description: string;
843
- author: _qodalis_cli_core.ICliCommandAuthor;
929
+ author: any;
844
930
  acceptsRawInput: boolean;
845
931
  metadata: {
846
932
  icon: string;
@@ -858,13 +944,18 @@ declare class CliFontSizeCommandProcessor implements ICliCommandProcessor {
858
944
  metadata: CliProcessorMetadata;
859
945
  stateConfiguration: CliStateConfiguration;
860
946
  processors: ICliCommandProcessor[];
947
+ /** The size the host configured (or the built-in default), restored by `font-size reset`. */
948
+ private hostFontSize?;
861
949
  initialize(context: ICliExecutionContext): Promise<void>;
862
950
  processCommand(_: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
951
+ writeDescription(context: ICliExecutionContext): void;
863
952
  private getCurrent;
953
+ private getDefault;
954
+ private resetFontSize;
864
955
  private setFontSize;
865
956
  }
866
957
 
867
- declare const miscProcessors: (CliAliasCommandProcessor | CliCalCommandProcessor | CliClearCommandProcessor | CliClipboardCommandProcessor | CliColorCommandProcessor | CliConvertCommandProcessor | CliEchoCommandProcessor | CliEvalCommandProcessor | CliJsonCommandProcessor | CliLoremCommandProcessor | CliOpenCommandProcessor | CliRandomCommandProcessor | CliScreenCommandProcessor | CliSeqCommandProcessor | CliSleepCommandProcessor | CliTimeCommandProcessor | CliTimestampCommandProcessor | CliUnAliasCommandProcessor | CliUnameCommandProcessor | CliUptimeCommandProcessor | CliYesCommandProcessor)[];
958
+ declare const miscProcessors: (CliClearCommandProcessor | CliEchoCommandProcessor | CliEvalCommandProcessor | CliAliasCommandProcessor | CliUnAliasCommandProcessor | CliSleepCommandProcessor | CliUnameCommandProcessor | CliTimeCommandProcessor | CliJsonCommandProcessor | CliRandomCommandProcessor | CliUptimeCommandProcessor | CliOpenCommandProcessor | CliLoremCommandProcessor | CliTimestampCommandProcessor | CliColorCommandProcessor | CliCalCommandProcessor | CliSeqCommandProcessor | CliScreenCommandProcessor | CliClipboardCommandProcessor | CliConvertCommandProcessor | CliYesCommandProcessor | CliTestCommandProcessor | CliTrueCommandProcessor | CliFalseCommandProcessor)[];
868
959
  declare const builtinProcessors: ICliCommandProcessor[];
869
960
 
870
961
  declare class CliExecutionProcess implements ICliExecutionProcess {
@@ -908,6 +999,8 @@ declare class CliCommandExecutionContext implements ICliExecutionContext {
908
999
  translator: ICliTranslationService;
909
1000
  reader: ICliInputReader;
910
1001
  readonly backgroundServices: ICliBackgroundServiceRegistry;
1002
+ http: ICliHttpClient;
1003
+ notifier: ICliNotifier;
911
1004
  get promptLength(): number;
912
1005
  set promptLength(value: number);
913
1006
  get currentLine(): string;
@@ -926,14 +1019,35 @@ declare class CliCommandExecutionContext implements ICliExecutionContext {
926
1019
  exitFullScreenMode: () => void;
927
1020
  createInterval: (callback: () => void, ms: number) => ICliManagedInterval;
928
1021
  createTimeout: (callback: () => void, ms: number) => ICliManagedTimer;
1022
+ submitCommand: (command: string) => Promise<void>;
1023
+ events?: ICliEventBus;
1024
+ get isBooted(): boolean | undefined;
929
1025
  constructor(context: ICliExecutionContext, processor: ICliCommandProcessor);
930
1026
  }
931
1027
 
1028
+ /**
1029
+ * Command history, kept per user like a shell's `~/.bash_history`: each
1030
+ * signed-in user (by id) has their own, and the shared one is used while
1031
+ * nobody is signed in.
1032
+ */
932
1033
  declare class CliCommandHistory {
933
1034
  private readonly store;
934
- private readonly storageKey;
935
1035
  private commandHistory;
1036
+ /** Id of the user whose history is loaded; undefined: nobody signed in */
1037
+ private userId;
1038
+ private loading;
1039
+ /** Counts user switches (a load for an older one is dropped) */
1040
+ private switches;
1041
+ private _generation;
936
1042
  constructor(store: ICliKeyValueStore);
1043
+ /** Changes whenever the history is replaced: switched or loaded (positions into it are stale) */
1044
+ get generation(): number;
1045
+ private get storageKey();
1046
+ /**
1047
+ * Switch to the history of `userId` (undefined: nobody signed in).
1048
+ * Resolves once it is loaded; a no-op for the user already loaded.
1049
+ */
1050
+ useUser(userId: string | undefined): Promise<void>;
937
1051
  addCommand(command: string): Promise<void>;
938
1052
  getLastIndex(): number;
939
1053
  getHistory(): string[];
@@ -964,7 +1078,7 @@ declare class CliCommandHistory {
964
1078
 
965
1079
  interface ICliStateStoreManager {
966
1080
  getProcessorStateStore(processor: ICliCommandProcessor): ICliStateStore;
967
- getStateStore(name: string, defaultState?: Record<string, any>): ICliStateStore;
1081
+ getStateStore(name: string, defaultState?: Record<string, any>, options?: CliStateStoreOptions): ICliStateStore;
968
1082
  getStoreEntries(): {
969
1083
  name: string;
970
1084
  state: Record<string, any>;
@@ -974,9 +1088,25 @@ declare class CliStateStoreManager implements ICliStateStoreManager {
974
1088
  private readonly services;
975
1089
  private readonly registry;
976
1090
  private stores;
1091
+ private channel?;
1092
+ /** The signed-in user (for `scope: 'user'` stores). */
1093
+ private user?;
1094
+ private stopFollowingUser?;
977
1095
  constructor(services: ICliServiceProvider, registry: ICliCommandProcessorRegistry);
978
- getStateStore(name: string, defaultState?: Record<string, any>): ICliStateStore;
1096
+ /**
1097
+ * Get (or create) the store `name`. Defaults and options passed for a
1098
+ * store that already exists are added to it: a store read early (e.g.
1099
+ * by the boot report) still gets its command's initial state.
1100
+ */
1101
+ getStateStore(name: string, defaultState?: Record<string, any>, options?: CliStateStoreOptions): ICliStateStore;
979
1102
  getProcessorStateStore(processor: ICliCommandProcessor): ICliStateStore;
1103
+ /**
1104
+ * Follow the signed-in user (`session:changed` events), so `scope: 'user'`
1105
+ * stores switch to that user's state.
1106
+ */
1107
+ followUser(events: ICliEventBus): void;
1108
+ /** Switch `scope: 'user'` stores to `user`'s saved state. */
1109
+ setUser(user: string | undefined): void;
980
1110
  /**
981
1111
  * Returns all store names and their current state values.
982
1112
  */
@@ -984,6 +1114,14 @@ declare class CliStateStoreManager implements ICliStateStoreManager {
984
1114
  name: string;
985
1115
  state: Record<string, any>;
986
1116
  }[];
1117
+ /**
1118
+ * Dispose all stores (completes their BehaviorSubjects).
1119
+ * Called during engine teardown.
1120
+ */
1121
+ dispose(): void;
1122
+ /** Tell other tabs and terminals that a store was saved. */
1123
+ private publish;
1124
+ private listen;
987
1125
  }
988
1126
 
989
1127
  /**
@@ -1019,6 +1157,10 @@ declare class CliCompletionEngine {
1019
1157
  candidates?: string[];
1020
1158
  }>;
1021
1159
  private buildContext;
1160
+ /**
1161
+ * Words with their start, quote-aware: `cat "my notes.txt"` has two, and an
1162
+ * unclosed quote runs to the end (`cat "my no` is being typed).
1163
+ */
1022
1164
  private tokenize;
1023
1165
  private fetchCompletions;
1024
1166
  /**
@@ -1049,6 +1191,12 @@ declare class CliLineBuffer {
1049
1191
  moveEnd(): void;
1050
1192
  clear(): void;
1051
1193
  setText(str: string): void;
1194
+ /** Remove the text before the cursor (Ctrl+U); returns it */
1195
+ deleteToStart(): string;
1196
+ /** Remove the text from the cursor to the end (Ctrl+K); returns it */
1197
+ deleteToEnd(): string;
1198
+ /** Remove the whitespace-delimited word before the cursor (Ctrl+W); returns it */
1199
+ deleteWordBefore(): string;
1052
1200
  }
1053
1201
 
1054
1202
  /**
@@ -1103,6 +1251,11 @@ interface InputModeHost {
1103
1251
  interface PromptOptions {
1104
1252
  userName?: string;
1105
1253
  hideUserName?: boolean;
1254
+ /**
1255
+ * Shown (dimmed) instead of the user name when an auth module is loaded
1256
+ * but nobody is signed in, e.g. `anonymous:/$`. Empty/undefined: nothing.
1257
+ */
1258
+ anonymousName?: string;
1106
1259
  contextProcessor?: string;
1107
1260
  pathProvider?: () => string | null;
1108
1261
  }
@@ -1167,7 +1320,12 @@ interface CliExecutionContextDeps {
1167
1320
  declare class CliExecutionContext implements ICliExecutionContext, InputModeHost, CommandLineModeHost {
1168
1321
  terminal: Terminal;
1169
1322
  executor: ICliCommandExecutorService;
1170
- userSession?: ICliUserSession;
1323
+ private _userSession?;
1324
+ /** The signed-in user; changing it emits `session:changed`. */
1325
+ get userSession(): ICliUserSession | undefined;
1326
+ set userSession(session: ICliUserSession | undefined);
1327
+ /** The terminal's event bus. */
1328
+ readonly events?: ICliEventBus;
1171
1329
  contextProcessor?: ICliCommandProcessor;
1172
1330
  readonly writer: ICliTerminalWriter;
1173
1331
  readonly spinner: ICliSpinner;
@@ -1182,17 +1340,38 @@ declare class CliExecutionContext implements ICliExecutionContext, InputModeHost
1182
1340
  readonly services: ICliServiceProvider;
1183
1341
  readonly translator: ICliTranslationService;
1184
1342
  readonly backgroundServices: ICliBackgroundServiceRegistry;
1343
+ http: ICliHttpClient;
1344
+ readonly notifier: ICliNotifier;
1185
1345
  promptPathProvider?: () => string | null;
1186
1346
  readonly completionEngine: CliCompletionEngine;
1187
1347
  promptLength: number;
1188
1348
  readonly reader: ICliInputReader;
1349
+ /**
1350
+ * Result of the most recently executed command.
1351
+ * Updated by the command executor after each command completes.
1352
+ */
1353
+ lastCommandResult?: {
1354
+ command: string;
1355
+ success: boolean;
1356
+ };
1357
+ /**
1358
+ * Whether a command is currently being executed.
1359
+ * Set by the command executor at start/end of executeCommand().
1360
+ */
1361
+ isExecuting: boolean;
1189
1362
  readonly lineBuffer: CliLineBuffer;
1190
1363
  readonly lineRenderer: CliTerminalLineRenderer;
1191
1364
  readonly commandHistory: CliCommandHistory;
1192
1365
  readonly filePickerProvider: ICliFilePickerProvider;
1193
1366
  private readonly modeStack;
1194
- private readonly managedTimers;
1195
- private resizeDisposable;
1367
+ /** Command-line input typed while booting; `null` when not holding. */
1368
+ private heldInput;
1369
+ private releaseHeldInputAtPrompt;
1370
+ private _typedDuringBoot;
1371
+ private readonly stateStoreManager;
1372
+ private readonly timerManager;
1373
+ private readonly fullScreenManager;
1374
+ private windowKeydownListener?;
1196
1375
  constructor(deps: CliExecutionContextDeps, terminal: Terminal, executor: ICliCommandExecutorService, cliOptions?: CliOptions);
1197
1376
  writeToTerminal(text: string): void;
1198
1377
  getTerminalRows(): number;
@@ -1201,6 +1380,25 @@ declare class CliExecutionContext implements ICliExecutionContext, InputModeHost
1201
1380
  get cursorPosition(): number;
1202
1381
  set cursorPosition(value: number);
1203
1382
  initializeTerminalListeners(): void;
1383
+ private handleTerminalData;
1384
+ private _isBooted;
1385
+ /** `true` once boot has completed and the terminal is ready. */
1386
+ get isBooted(): boolean;
1387
+ /** Called by the engine when boot has completed. */
1388
+ markBooted(): void;
1389
+ /** Start keeping command-line input instead of handling it (boot). */
1390
+ holdInput(): void;
1391
+ /**
1392
+ * Stop holding input: what was typed is replayed at the next prompt, or
1393
+ * right away when `immediately` is set (e.g. no prompt will be drawn).
1394
+ */
1395
+ releaseInput(immediately?: boolean): void;
1396
+ /** Whether a prompt (readLine, readSelect, ...) or full-screen mode owns the input. */
1397
+ get isReadingInput(): boolean;
1398
+ /** Whether keys were typed while input was held (boot). */
1399
+ get typedDuringBoot(): boolean;
1400
+ private replayHeldInput;
1401
+ private initializeWindowListeners;
1204
1402
  setContextProcessor: (processor: ICliCommandProcessor | undefined, silent?: boolean, fullScreen?: boolean) => void;
1205
1403
  setCurrentLine(line: string): void;
1206
1404
  clearLine(): void;
@@ -1209,6 +1407,12 @@ declare class CliExecutionContext implements ICliExecutionContext, InputModeHost
1209
1407
  newLine?: boolean;
1210
1408
  keepCurrentLine?: boolean;
1211
1409
  }): void;
1410
+ /**
1411
+ * Submit and execute a command — shared by interactive Enter key
1412
+ * and programmatic engine.execute(). Adds to history, runs the
1413
+ * command, and shows a new prompt afterwards.
1414
+ */
1415
+ submitCommand(command: string): Promise<void>;
1212
1416
  clearCurrentLine(): void;
1213
1417
  refreshCurrentLine(previousContentLength?: number): void;
1214
1418
  /**
@@ -1224,7 +1428,7 @@ declare class CliExecutionContext implements ICliExecutionContext, InputModeHost
1224
1428
  */
1225
1429
  handleTerminalResize(): void;
1226
1430
  isRawModeActive(): boolean;
1227
- enterFullScreenMode(processor: ICliCommandProcessor): void;
1431
+ enterFullScreenMode(processor: ICliCommandProcessor, options?: CliFullScreenOptions): void;
1228
1432
  exitFullScreenMode(): void;
1229
1433
  createInterval(callback: () => void, ms: number): ICliManagedInterval;
1230
1434
  createTimeout(callback: () => void, ms: number): ICliManagedTimer;
@@ -1235,7 +1439,6 @@ declare class CliExecutionContext implements ICliExecutionContext, InputModeHost
1235
1439
  getPromptLength(): number;
1236
1440
  setPromptLength(value: number): void;
1237
1441
  getExecutionContext(): ICliExecutionContext;
1238
- private clearAllManagedTimers;
1239
1442
  /**
1240
1443
  * Dispose all resources. Called by CliEngine.destroy() when the
1241
1444
  * CLI component is being torn down.
@@ -1246,6 +1449,100 @@ declare class CliExecutionContext implements ICliExecutionContext, InputModeHost
1246
1449
  popMode(): void;
1247
1450
  }
1248
1451
 
1452
+ /**
1453
+ * Per-session registry that manages background service lifecycle.
1454
+ */
1455
+ declare class CliBackgroundServiceRegistry implements ICliBackgroundServiceRegistry {
1456
+ private readonly state;
1457
+ private readonly services;
1458
+ private readonly writer?;
1459
+ private readonly entries;
1460
+ private readonly handlers;
1461
+ private isFullScreen;
1462
+ private notificationQueue;
1463
+ private processRegistry?;
1464
+ constructor(state: ICliStateStore, services: ICliServiceProvider, writer?: ICliTerminalWriter);
1465
+ /** Attach the process registry so background services get PIDs */
1466
+ setProcessRegistry(registry: ICliProcessRegistry): void;
1467
+ register(service: ICliBackgroundService): void;
1468
+ start(name: string): Promise<void>;
1469
+ stop(name: string): Promise<void>;
1470
+ restart(name: string): Promise<void>;
1471
+ startJob(name: string, task: (context: ICliServiceContext) => Promise<void>, _options?: {
1472
+ workerCompatible?: boolean;
1473
+ }): Promise<void>;
1474
+ getStatus(name: string): ICliBackgroundServiceInfo | undefined;
1475
+ list(): ICliBackgroundServiceInfo[];
1476
+ getLogs(name: string, limit?: number): ICliServiceLogEntry[];
1477
+ on(handler: CliServiceEventHandler, filter?: {
1478
+ source?: string;
1479
+ type?: string;
1480
+ }): () => void;
1481
+ destroyAll(): Promise<void>;
1482
+ /** Called by the execution context when entering/exiting full-screen mode */
1483
+ setFullScreen(isFullScreen: boolean): void;
1484
+ private getEntry;
1485
+ private toInfo;
1486
+ private updateStatus;
1487
+ private handleStartError;
1488
+ private dispatchEvent;
1489
+ /**
1490
+ * Publish service events on the terminal's event bus: lifecycle events as
1491
+ * `service:<started|stopped|...>`, events relayed from a server's event
1492
+ * socket as `server:event`, other custom events as `service:event`.
1493
+ */
1494
+ private forwardToEventBus;
1495
+ private emitLifecycleEvent;
1496
+ private notify;
1497
+ private flushNotificationQueue;
1498
+ private writeNotification;
1499
+ private completeInProcessRegistry;
1500
+ private failInProcessRegistry;
1501
+ }
1502
+
1503
+ /**
1504
+ * Manages full-screen terminal mode (alternate screen buffer).
1505
+ * Used by interactive commands like nano, htop, etc.
1506
+ */
1507
+ declare class CliFullScreenManager {
1508
+ private readonly terminal;
1509
+ private readonly backgroundServices;
1510
+ private resizeDisposable;
1511
+ constructor(terminal: Terminal, backgroundServices: CliBackgroundServiceRegistry);
1512
+ /**
1513
+ * Enter full-screen mode using the alternate screen buffer.
1514
+ */
1515
+ enter(processor: ICliCommandProcessor, setContextProcessor: (p: ICliCommandProcessor | undefined, silent?: boolean, fullScreen?: boolean) => void, context: ICliExecutionContext, options?: CliFullScreenOptions): void;
1516
+ /**
1517
+ * Exit full-screen mode and return to the main buffer.
1518
+ */
1519
+ exit(contextProcessor: ICliCommandProcessor | undefined, setContextProcessor: (p: ICliCommandProcessor | undefined) => void, clearTimers: () => void, showPrompt: () => void, context: ICliExecutionContext): void;
1520
+ /**
1521
+ * Dispose resize subscription.
1522
+ */
1523
+ dispose(): void;
1524
+ }
1525
+
1526
+ /**
1527
+ * Manages timers and intervals with automatic cleanup.
1528
+ * All managed timers are cleared when the execution context is disposed.
1529
+ */
1530
+ declare class CliTimerManager {
1531
+ private readonly managedTimers;
1532
+ /**
1533
+ * Create a managed interval that will be automatically cleared on dispose.
1534
+ */
1535
+ createInterval(callback: () => void, ms: number): ICliManagedInterval;
1536
+ /**
1537
+ * Create a managed timeout that will be automatically cleared on dispose.
1538
+ */
1539
+ createTimeout(callback: () => void, ms: number): ICliManagedTimer;
1540
+ /**
1541
+ * Clear all managed timers and intervals.
1542
+ */
1543
+ clearAll(): void;
1544
+ }
1545
+
1249
1546
  /**
1250
1547
  * Extended execution context interface used internally by the command executor.
1251
1548
  * The concrete implementation (e.g. CliExecutionContext in angular-cli) provides these.
@@ -1253,36 +1550,37 @@ declare class CliExecutionContext implements ICliExecutionContext, InputModeHost
1253
1550
  interface ICliExecutionHost extends ICliExecutionContext {
1254
1551
  contextProcessor?: ICliCommandProcessor;
1255
1552
  abort?(): void;
1553
+ lastCommandResult?: {
1554
+ command: string;
1555
+ success: boolean;
1556
+ };
1557
+ isExecuting?: boolean;
1256
1558
  }
1257
1559
  declare class CliCommandExecutor implements ICliCommandExecutorService {
1258
1560
  protected readonly registry: ICliCommandProcessorRegistry;
1259
1561
  private commandParser;
1260
1562
  private globalParameters;
1261
- private lastCapturingWriter?;
1563
+ /** Exit status of the last command, expanded as `$?` (0 = success). */
1564
+ private lastExitCode;
1565
+ /** Command lines running per terminal (they can overlap). */
1566
+ private readonly running;
1567
+ /** Exit status of the last command line run (`$?`). */
1568
+ get exitStatus(): number;
1262
1569
  constructor(registry: ICliCommandProcessorRegistry);
1263
1570
  registerGlobalParameter(handler: ICliGlobalParameterHandler): void;
1264
- getGlobalParameters(): ICliCommandParameterDescriptor[];
1571
+ getGlobalParameters(): ICliCommandParameterDescriptor$1[];
1265
1572
  executeCommand(command: string, context: ICliExecutionContext): Promise<void>;
1266
- private appendOutputToFile;
1267
- private writeOutputToFile;
1573
+ /** Whether the command named first on the line takes literal input. */
1574
+ private isLiteralInput;
1575
+ /**
1576
+ * Run a command line and return its output as text instead of showing
1577
+ * it (`$(...)`); its errors and warnings are still shown.
1578
+ */
1579
+ capture(command: string, from: ICliExecutionContext): Promise<string>;
1268
1580
  private executeSingleCommand;
1269
1581
  private completeProcess;
1270
1582
  private failProcess;
1271
- private writeStderrToFile;
1272
- private appendStderrToFile;
1273
1583
  showHelp(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
1274
- /**
1275
- * Attempt to execute a file path as a script.
1276
- * Returns true if the file was found and executed, false otherwise.
1277
- * Requires the @qodalis/cli-files plugin for filesystem access.
1278
- */
1279
- private tryExecuteScript;
1280
- private substituteVars;
1281
- /**
1282
- * Expand $VAR and ${VAR} references using the global environment store.
1283
- * Variables inside single-quoted strings are NOT expanded (like bash).
1284
- */
1285
- private expandEnvironmentVars;
1286
1584
  /**
1287
1585
  * Validates the command arguments before execution.
1288
1586
  * @param context The current CLI execution context.
@@ -1300,6 +1598,19 @@ declare class CliCommandExecutor implements ICliCommandExecutorService {
1300
1598
  * parameter. In that case the global handler must be skipped so the
1301
1599
  * processor can handle the flag itself.
1302
1600
  */
1601
+ /**
1602
+ * Runs all registered {@link ICliCommandGuard}s that apply to this command,
1603
+ * in priority order. Returns the block message of the first guard that
1604
+ * denies the command, or `undefined` when every guard allows it.
1605
+ * A guard that throws is treated as a denial (fail closed).
1606
+ */
1607
+ private runGuards;
1608
+ /**
1609
+ * The text after the word that selected `processor`, which may be its
1610
+ * command or one of its aliases (e.g. `pkg rm guid` -> `guid`).
1611
+ */
1612
+ private extractPositionalValue;
1613
+ private guardDenial;
1303
1614
  private processorOwnsParameter;
1304
1615
  }
1305
1616
 
@@ -1317,81 +1628,55 @@ declare const helpGlobalParameter: ICliGlobalParameterHandler;
1317
1628
  declare const contextGlobalParameter: ICliGlobalParameterHandler;
1318
1629
 
1319
1630
  /**
1320
- * A simple Map-based service container implementing ICliServiceProvider.
1631
+ * A terminal writer wrapper that captures "stdout-equivalent" output
1632
+ * (`write`, `writeln`, `writeJson`, `writeObjectsAsTable`, `writeTable`)
1633
+ * while passing everything through to the underlying writer unchanged.
1321
1634
  *
1322
- * Supports three provider types:
1323
- * - `useValue` : registers a static value
1324
- * - `useFactory` : registers a factory function, invoked once on first `get`
1325
- * - `useClass` : registers a class constructor, instantiated once on first `get`
1635
+ * Diagnostic methods (`writeError`, `writeWarning`, `writeInfo`, `writeSuccess`)
1636
+ * are NOT captured — they are the equivalent of stderr.
1326
1637
  *
1327
- * When `multi: true`, multiple providers for the same token are accumulated
1328
- * and `get()` returns an array of resolved values.
1638
+ * After a command finishes, the executor can retrieve the captured data to use
1639
+ * as implicit pipeline output when the command did not call `process.output()`.
1640
+ *
1641
+ * `muted` (output going into a pipe or a file) captures stdout-equivalent
1642
+ * output without showing it; diagnostics are still shown.
1329
1643
  */
1330
- declare class CliServiceContainer implements ICliServiceProvider {
1331
- /** Stores single-value providers (resolved or pending). */
1332
- private readonly services;
1333
- /** Stores multi-provider arrays. */
1334
- private readonly multiServices;
1335
- /**
1336
- * Retrieve a service by its token.
1337
- *
1338
- * @param token The token used to register the service.
1339
- * @returns The resolved service instance (or array for multi providers).
1340
- * @throws Error if the token has not been registered.
1341
- */
1342
- get<T>(token: any): T;
1343
- /**
1344
- * Register one or more providers.
1345
- *
1346
- * @param definition A single CliProvider or an array of CliProviders.
1347
- */
1348
- set(definition: CliProvider | CliProvider[]): void;
1349
- /**
1350
- * Returns all registered service tokens (single + multi providers).
1351
- */
1352
- getRegisteredTokens(): string[];
1353
- /**
1354
- * Returns detailed info for each registered service: token name, value type, and multi flag.
1355
- */
1356
- getRegisteredServiceDetails(): {
1357
- token: string;
1358
- type: string;
1359
- multi: boolean;
1360
- }[];
1361
- /**
1362
- * Describe a resolved value for diagnostic display.
1363
- */
1364
- private describeValue;
1365
- /**
1366
- * Register a single provider.
1367
- */
1368
- private registerProvider;
1369
- /**
1370
- * Resolve a provider definition to a concrete value.
1371
- */
1372
- private resolveProvider;
1373
- }
1374
-
1375
- declare class CliTerminalWriter implements ICliTerminalWriter {
1376
- readonly terminal: Terminal;
1377
- constructor(terminal: Terminal);
1644
+ declare class CapturingTerminalWriter implements ICliTerminalWriter {
1645
+ private readonly inner;
1646
+ /** Raw text lines captured from write/writeln calls. */
1647
+ private _lines;
1648
+ /** Structured data captured from writeJson calls. */
1649
+ private _jsonValues;
1650
+ /** Structured data captured from writeObjectsAsTable calls. */
1651
+ private _tableObjects;
1652
+ /** Raw text lines captured from writeError/writeWarning calls. */
1653
+ private _stderrLines;
1654
+ /** Number of writeError calls (warnings excluded). */
1655
+ private _errorCount;
1656
+ private readonly muted;
1657
+ constructor(inner: ICliTerminalWriter, options?: {
1658
+ muted?: boolean;
1659
+ });
1660
+ /** Show stdout-equivalent output unless muted. */
1661
+ private show;
1662
+ private captureText;
1378
1663
  write(text: string): void;
1379
1664
  writeln(text?: string): void;
1665
+ writeJson(json: any): void;
1666
+ writeObjectsAsTable(objects: any[]): void;
1667
+ writeTable(headers: string[], rows: string[][]): void;
1380
1668
  writeSuccess(message: string): void;
1381
1669
  writeInfo(message: string): void;
1382
1670
  writeWarning(message: string): void;
1383
1671
  writeError(message: string): void;
1384
- private writeLog;
1672
+ wrapInColor(text: string, color: CliForegroundColor): string;
1673
+ wrapInBackgroundColor(text: string, color: CliBackgroundColor): string;
1674
+ writeToFile(fileName: string, content: string): void;
1385
1675
  writeDivider(options?: {
1386
1676
  color?: CliForegroundColor;
1387
1677
  length?: number;
1388
1678
  char?: string;
1389
1679
  }): void;
1390
- wrapInColor(text: string, color: CliForegroundColor): string;
1391
- wrapInBackgroundColor(text: string, color: CliBackgroundColor): string;
1392
- writeJson(json: any): void;
1393
- writeToFile(fileName: string, content: string): void;
1394
- writeObjectsAsTable(objects: any[]): void;
1395
1680
  writeList(items: string[], options?: {
1396
1681
  ordered?: boolean;
1397
1682
  prefix?: string;
@@ -1405,19 +1690,392 @@ declare class CliTerminalWriter implements ICliTerminalWriter {
1405
1690
  columns?: number;
1406
1691
  padding?: number;
1407
1692
  }): void;
1408
- writeTable(headers: string[], rows: string[][]): void;
1409
- }
1410
-
1411
- declare class CliClipboard implements ICliClipboard {
1412
- private readonly context;
1413
- constructor(context: ICliExecutionContext);
1414
- write(text: string): Promise<void>;
1415
- read(): Promise<string>;
1693
+ writeLink(text: string, url: string): void;
1694
+ writeBox(content: string | string[], options?: {
1695
+ title?: string;
1696
+ borderColor?: CliForegroundColor;
1697
+ padding?: number;
1698
+ }): void;
1699
+ writeIndented(text: string, level?: number): void;
1700
+ /**
1701
+ * Returns true if any stdout-equivalent output was captured.
1702
+ */
1703
+ hasOutput(): boolean;
1704
+ /**
1705
+ * Returns the captured data in the most useful form:
1706
+ *
1707
+ * 1. If structured JSON was written (via `writeJson`), return the last
1708
+ * JSON value (preserving its original type — object, array, etc.).
1709
+ * 2. If objects were written as a table, return the last array of objects.
1710
+ * 3. Otherwise return the captured text lines joined with newlines,
1711
+ * with ANSI codes stripped and whitespace trimmed.
1712
+ * 4. Returns `undefined` if nothing was captured.
1713
+ */
1714
+ getCapturedData(): any | undefined;
1715
+ /** Whether the command wrote an error message itself. */
1716
+ hasErrors(): boolean;
1717
+ /**
1718
+ * Returns true if any stderr-equivalent output was captured.
1719
+ */
1720
+ hasStderr(): boolean;
1721
+ /**
1722
+ * Returns captured stderr text joined with newlines, or undefined if empty.
1723
+ */
1724
+ getCapturedStderr(): string | undefined;
1416
1725
  }
1417
1726
 
1418
- declare class CliLogger implements ICliLogger {
1419
- private CliLogLevel;
1420
- constructor();
1727
+ /**
1728
+ * Write stdout data to a file (overwrite mode).
1729
+ */
1730
+ declare function writeOutputToFile(filePath: string, context: ICliExecutionContext): Promise<void>;
1731
+ /**
1732
+ * Append stdout data to a file.
1733
+ */
1734
+ declare function appendOutputToFile(filePath: string, context: ICliExecutionContext): Promise<void>;
1735
+ /**
1736
+ * Write stderr data to a file (overwrite mode).
1737
+ */
1738
+ declare function writeStderrToFile(filePath: string, context: ICliExecutionContext, capturingWriter?: CapturingTerminalWriter): Promise<void>;
1739
+ /**
1740
+ * Append stderr data to a file.
1741
+ */
1742
+ declare function appendStderrToFile(filePath: string, context: ICliExecutionContext, capturingWriter?: CapturingTerminalWriter): Promise<void>;
1743
+
1744
+ /**
1745
+ * Attempt to execute a file path as a script.
1746
+ * Returns true if the file was found and executed, false otherwise.
1747
+ * Requires the @qodalis/cli-files plugin for filesystem access.
1748
+ */
1749
+ declare function tryExecuteScript(filePath: string, context: ICliExecutionHost, executeCommand: (command: string, context: ICliExecutionContext) => Promise<void>): Promise<boolean>;
1750
+ /**
1751
+ * Substitute script-local variables ($VAR / ${VAR}) in a string.
1752
+ */
1753
+ declare function substituteVars(input: string, variables: Record<string, string>): string;
1754
+ /**
1755
+ * Expand `$VAR` and `${VAR}` references using the global environment store, `$?`
1756
+ * to the last exit status, and a leading `~` (alone or as `~/…`) to `$HOME`.
1757
+ * Nothing is expanded inside single-quoted strings (like bash).
1758
+ */
1759
+ declare function expandEnvironmentVars(command: string, context: ICliExecutionContext, lastExitCode?: number): string;
1760
+
1761
+ /**
1762
+ * Shell-style script runner shared by `sh <file>` / `source` (files plugin)
1763
+ * and `./script.sh` (the executor).
1764
+ *
1765
+ * Supported (a POSIX sh subset):
1766
+ * - one command per line or several separated by `;` (pipes, `&&`, `||`
1767
+ * and redirects are left to the executor)
1768
+ * - `# comments`, blank lines, `\` line continuation
1769
+ * - `set -e` (default) / `set +e`, `VAR=value` (script-scoped), `exit [n]`
1770
+ * - `if cmd; then ...; elif cmd; then ...; else ...; fi`
1771
+ * - `for NAME in words...; do ...; done` (words after `$VAR` and wildcard
1772
+ * expansion; NAME is set for this terminal)
1773
+ * - `while cmd; do ...; done`, `until cmd; do ...; done`
1774
+ * - `break [n]`, `continue [n]`, `! cmd` (negated status)
1775
+ *
1776
+ * Every simple command runs through the executor; its status is
1777
+ * `context.process.exitCode` (0 or undefined = success).
1778
+ */
1779
+ /** Service token under which the engine provides the runner (for plugins). */
1780
+ declare const ICliScriptRunner_TOKEN: any;
1781
+ interface ICliScriptRunOptions {
1782
+ /** Prefix for error messages (`sh: line 4: ...`). Default `sh`. */
1783
+ name?: string;
1784
+ /** Runs one command line. Default `context.executor.executeCommand`. */
1785
+ executeCommand?: (command: string, context: ICliExecutionContext) => Promise<void>;
1786
+ /** Loop iterations allowed before a `while`/`until` is stopped. Default 10000. */
1787
+ maxLoopIterations?: number;
1788
+ /** Stop at the first failing command (`set -e`). Default true; false for typed lines. */
1789
+ stopOnError?: boolean;
1790
+ }
1791
+ interface ICliScriptRunner {
1792
+ /** Run script `content`; resolves to its exit status. */
1793
+ run(content: string, context: ICliExecutionContext, options?: ICliScriptRunOptions): Promise<number>;
1794
+ }
1795
+ /** The runner as a service value. */
1796
+ declare const cliScriptRunner: ICliScriptRunner;
1797
+ interface CommandNode {
1798
+ type: 'command';
1799
+ text: string;
1800
+ line: number;
1801
+ negate: boolean;
1802
+ }
1803
+ interface IfNode {
1804
+ type: 'if';
1805
+ line: number;
1806
+ branches: {
1807
+ condition: ScriptNode[];
1808
+ body: ScriptNode[];
1809
+ }[];
1810
+ elseBody?: ScriptNode[];
1811
+ }
1812
+ interface ForNode {
1813
+ type: 'for';
1814
+ line: number;
1815
+ name: string;
1816
+ words: string;
1817
+ body: ScriptNode[];
1818
+ }
1819
+ interface WhileNode {
1820
+ type: 'while';
1821
+ line: number;
1822
+ until: boolean;
1823
+ condition: ScriptNode[];
1824
+ body: ScriptNode[];
1825
+ }
1826
+ type ScriptNode = CommandNode | IfNode | ForNode | WhileNode;
1827
+ /** A syntax error found while parsing. */
1828
+ declare class CliScriptSyntaxError extends Error {
1829
+ readonly line: number;
1830
+ readonly detail: string;
1831
+ constructor(line: number, detail: string);
1832
+ }
1833
+ /** Parse script content (throws {@link CliScriptSyntaxError}). */
1834
+ declare function parseScript(content: string): ScriptNode[];
1835
+ /** Split a line into words, removing quotes (empty quoted words are kept). */
1836
+ declare function splitWords(text: string): string[];
1837
+ /**
1838
+ * Run script content with shell control flow. Resolves to the exit status
1839
+ * (also set as the context's process exit code).
1840
+ */
1841
+ declare function runScript(content: string, context: ICliExecutionContext, options?: ICliScriptRunOptions): Promise<number>;
1842
+
1843
+ /** The file system calls glob expansion needs (`@qodalis/cli-files`). */
1844
+ interface GlobFileSystem {
1845
+ getCurrentDirectory(): string;
1846
+ resolvePath(path: string): string;
1847
+ listDirectory(path: string): {
1848
+ name: string;
1849
+ type: 'file' | 'directory';
1850
+ }[];
1851
+ exists(path: string): boolean;
1852
+ isDirectory(path: string): boolean;
1853
+ }
1854
+ /**
1855
+ * Expand `*`, `?` and `[...]` in unquoted arguments to the matching paths,
1856
+ * as a shell does: `rm *.txt`, `cat docs/*.md`. The command name and flags
1857
+ * are left alone, names starting with `.` match only a pattern that starts
1858
+ * with `.`, and a pattern that matches nothing is kept as typed.
1859
+ * Without the files plugin the command is returned unchanged.
1860
+ */
1861
+ declare function expandGlobs(command: string, context: ICliExecutionContext): string;
1862
+ /** Paths matching `pattern`, sorted, relative when the pattern is. */
1863
+ declare function matchGlob(fs: GlobFileSystem, pattern: string): string[];
1864
+ /**
1865
+ * Brace expansion, as a shell does before wildcards: `file.{ts,js}` is
1866
+ * `file.ts file.js`, `img{1..3}.png` is `img1.png img2.png img3.png`
1867
+ * (letters too: `{a..c}`). Only unquoted words with a `,` or `..` inside
1868
+ * balanced braces; `${VAR}` and quoted text are left alone. Works without
1869
+ * the files plugin.
1870
+ */
1871
+ declare function expandBraces(command: string): string;
1872
+
1873
+ /**
1874
+ * Replace `$(command)` and `` `command` `` with the command's output, as a
1875
+ * shell does: `echo "Today: $(date)"`. Not inside single quotes; inside
1876
+ * double quotes yes. Trailing newlines of the output are removed, and the
1877
+ * output is escaped so it is only ever text: inside double quotes `"`, `\`,
1878
+ * `$` and `` ` ``; outside quotes every shell character but spaces (which
1879
+ * still separate words), so quotes, operators, `$`, wildcards and braces in
1880
+ * the output are not interpreted.
1881
+ */
1882
+ declare function substituteCommands(command: string, run: (inner: string) => Promise<string>): Promise<string>;
1883
+
1884
+ /**
1885
+ * A simple Map-based service container implementing ICliServiceProvider.
1886
+ *
1887
+ * Supports three provider types:
1888
+ * - `useValue` : registers a static value
1889
+ * - `useFactory` : registers a factory function, invoked once on the first `get`
1890
+ * - `useClass` : registers a class constructor, instantiated once on the first `get`
1891
+ *
1892
+ * Factories and classes are created lazily, so their `deps` only have to be
1893
+ * registered by the time the service is first used. Add `transient: true` to
1894
+ * create a new instance on every `get`.
1895
+ *
1896
+ * When `multi: true`, multiple providers for the same token are accumulated
1897
+ * and `getAll()` returns all of them.
1898
+ *
1899
+ * Registering a single token again overrides it; removing that registration
1900
+ * (`remove(token, provider)`, e.g. when a module is unloaded) makes the
1901
+ * previous one active again.
1902
+ */
1903
+ declare class CliServiceContainer implements ICliServiceProvider {
1904
+ /** Single-value registrations; the last one is active. */
1905
+ private readonly services;
1906
+ /** Multi-provider registrations, in registration order. */
1907
+ private readonly multiServices;
1908
+ /** Tokens that cannot be overwritten by subsequent `set()` calls. */
1909
+ private readonly sealedTokens;
1910
+ /** Stores provider recipes for transient tokens (re-resolved on every get). */
1911
+ private readonly transientRecipes;
1912
+ private disposed;
1913
+ /** Registrations being created, to report dependency cycles. */
1914
+ private readonly resolving;
1915
+ /**
1916
+ * Retrieve a service by its token.
1917
+ * Returns `undefined` when no provider is registered for the token.
1918
+ * For multi-provider tokens, returns the last registered value (use `getAll` for the full array).
1919
+ *
1920
+ * @param token The token used to register the service.
1921
+ * @returns The resolved service instance, or `undefined` if not registered.
1922
+ */
1923
+ get<T>(token: CliToken<T>): T | undefined;
1924
+ get<T>(token: any): T | undefined;
1925
+ /**
1926
+ * Retrieve all registered services for a multi-provider token.
1927
+ * Returns an empty array when no provider is registered for the token.
1928
+ *
1929
+ * @param token The token used to register the service.
1930
+ * @returns Array of all resolved service instances.
1931
+ */
1932
+ getAll<T>(token: CliToken<T>): T[];
1933
+ getAll<T>(token: any): T[];
1934
+ /**
1935
+ * Retrieve a service by its token, throwing if not registered.
1936
+ * Use this when the service is required and its absence is a programming error.
1937
+ * For multi-provider tokens, returns the last registered value (use `getAll` for the full array).
1938
+ *
1939
+ * @param token The token used to register the service.
1940
+ * @returns The resolved service instance.
1941
+ * @throws Error if the token has not been registered.
1942
+ */
1943
+ getRequired<T>(token: CliToken<T>): T;
1944
+ getRequired<T>(token: any): T;
1945
+ /**
1946
+ * Check whether a service is registered for the given token.
1947
+ */
1948
+ has(token: any): boolean;
1949
+ /**
1950
+ * Mark a token as sealed so it cannot be overwritten by future `set()` calls.
1951
+ * Only available on the concrete container — not exposed on `ICliServiceProvider`.
1952
+ */
1953
+ seal(token: any): void;
1954
+ /**
1955
+ * Mark multiple tokens as sealed at once.
1956
+ */
1957
+ sealAll(tokens: any[]): void;
1958
+ /**
1959
+ * Check whether a token is sealed.
1960
+ */
1961
+ isSealed(token: any): boolean;
1962
+ /**
1963
+ * Register one or more providers.
1964
+ *
1965
+ * @param definition A single CliProvider or an array of CliProviders.
1966
+ */
1967
+ set(definition: CliProvider | CliProvider[]): void;
1968
+ /**
1969
+ * Remove a registration. With `provider` (the provider object passed to
1970
+ * `set`, or the registered value), only that registration is removed: for
1971
+ * a single token the previous registration becomes active again, for a
1972
+ * multi token the others remain. Without it, every registration of the
1973
+ * token is removed.
1974
+ *
1975
+ * @throws Error if the token is sealed.
1976
+ * @returns Whether something was removed.
1977
+ */
1978
+ remove(token: any, provider?: unknown): boolean;
1979
+ /**
1980
+ * Dispose the services the container created (`useFactory` / `useClass`)
1981
+ * that have a `dispose()` method. Values registered with `useValue`
1982
+ * belong to whoever registered them and are not disposed. Registrations
1983
+ * are kept, so late callbacks still find their services. Called when the
1984
+ * engine is destroyed; later calls do nothing.
1985
+ */
1986
+ dispose(): void;
1987
+ /**
1988
+ * Returns all registered service tokens (single + multi providers).
1989
+ */
1990
+ getRegisteredTokens(): string[];
1991
+ /**
1992
+ * Returns detailed info for each registered service: token name, value type, and multi flag.
1993
+ * Services not created yet are listed as `lazy(Name)` (listing does not create them).
1994
+ */
1995
+ getRegisteredServiceDetails(): {
1996
+ token: string;
1997
+ type: string;
1998
+ multi: boolean;
1999
+ }[];
2000
+ /**
2001
+ * Convert a token to a human-readable string for diagnostics/errors.
2002
+ */
2003
+ private tokenToString;
2004
+ private describeRegistration;
2005
+ /**
2006
+ * Describe a resolved value for diagnostic display.
2007
+ */
2008
+ private describeValue;
2009
+ /** Whether `registration` is the one `provider` refers to. */
2010
+ private matches;
2011
+ /**
2012
+ * Register a single provider.
2013
+ */
2014
+ private registerProvider;
2015
+ /** The value of a registration, created on first use. */
2016
+ private resolve;
2017
+ /**
2018
+ * Resolve a provider definition to a concrete value, resolving its `deps`
2019
+ * from the container.
2020
+ */
2021
+ private resolveProvider;
2022
+ }
2023
+
2024
+ declare class CliTerminalWriter implements ICliTerminalWriter {
2025
+ readonly terminal: Terminal;
2026
+ constructor(terminal: Terminal);
2027
+ write(text: string): void;
2028
+ writeln(text?: string): void;
2029
+ writeSuccess(message: string): void;
2030
+ writeInfo(message: string): void;
2031
+ writeWarning(message: string): void;
2032
+ writeError(message: string): void;
2033
+ private writeLog;
2034
+ writeDivider(options?: {
2035
+ color?: CliForegroundColor;
2036
+ length?: number;
2037
+ char?: string;
2038
+ }): void;
2039
+ wrapInColor(text: string, color: CliForegroundColor): string;
2040
+ wrapInBackgroundColor(text: string, color: CliBackgroundColor): string;
2041
+ writeJson(json: any): void;
2042
+ writeToFile(fileName: string, content: string): void;
2043
+ writeObjectsAsTable(objects: any[]): void;
2044
+ writeList(items: string[], options?: {
2045
+ ordered?: boolean;
2046
+ prefix?: string;
2047
+ color?: CliForegroundColor;
2048
+ }): void;
2049
+ writeKeyValue(entries: Record<string, string> | [string, string][], options?: {
2050
+ separator?: string;
2051
+ keyColor?: CliForegroundColor;
2052
+ }): void;
2053
+ writeColumns(items: string[], options?: {
2054
+ columns?: number;
2055
+ padding?: number;
2056
+ }): void;
2057
+ writeLink(text: string, url: string): void;
2058
+ writeBox(content: string | string[], options?: {
2059
+ title?: string;
2060
+ borderColor?: CliForegroundColor;
2061
+ padding?: number;
2062
+ }): void;
2063
+ writeIndented(text: string, level?: number): void;
2064
+ /** One block per row, header names as keys; used when a table cannot fit the terminal. */
2065
+ private writeRecords;
2066
+ writeTable(headers: string[], rows: string[][], options?: CliTableOptions): void;
2067
+ }
2068
+
2069
+ declare class CliClipboard implements ICliClipboard {
2070
+ private readonly context;
2071
+ constructor(context: ICliExecutionContext);
2072
+ write(text: string): Promise<void>;
2073
+ read(): Promise<string>;
2074
+ }
2075
+
2076
+ declare class CliLogger implements ICliLogger {
2077
+ private CliLogLevel;
2078
+ constructor();
1421
2079
  setCliLogLevel(level: CliLogLevel): void;
1422
2080
  log(...args: any[]): void;
1423
2081
  info(...args: any[]): void;
@@ -1477,11 +2135,22 @@ declare class CliTerminalTextAnimator implements ICliTextAnimator {
1477
2135
  isRunning: boolean;
1478
2136
  context?: ICliExecutionContext;
1479
2137
  private animationInterval?;
2138
+ /** Characters of the current animation still visible on the line. */
2139
+ private visibleChars;
2140
+ /** Ends the current `showText` promise early (set while it runs). */
2141
+ private finish?;
1480
2142
  private text;
1481
2143
  private textColor;
1482
2144
  constructor(terminal: Terminal);
1483
2145
  show(text?: string): void;
1484
2146
  showText(text: string, options?: CliTextAnimatorOptions): Promise<void>;
2147
+ /** Cursor position as `row:col`, or `null` when unavailable. */
2148
+ private cursorPosition;
2149
+ /**
2150
+ * Stop the animation, erase the text it wrote and resolve its `showText`
2151
+ * promise. Used when the user starts typing over the greeting.
2152
+ */
2153
+ cancel(): void;
1485
2154
  /**
1486
2155
  * Hide the animation and reset the state.
1487
2156
  */
@@ -1498,6 +2167,101 @@ interface ICliWelcomeModule extends ICliModule {
1498
2167
  configure(config: CliWelcomeMessageConfig): ICliModule;
1499
2168
  }
1500
2169
  declare const welcomeModule: ICliWelcomeModule;
2170
+ /**
2171
+ * Animated, time-based greeting on the first prompt. Runs after every other
2172
+ * module's `onAfterBoot` hook (setup and sign-in prompts come first), and
2173
+ * only when the welcome banner was shown.
2174
+ */
2175
+ declare const greetingModule: ICliModule;
2176
+
2177
+ interface CliBootLogOptions {
2178
+ /** Steps taking at least this long are highlighted as slow. */
2179
+ slowStepMs?: number;
2180
+ /** When boot started (ms since epoch); defaults to now. */
2181
+ startedAt?: number;
2182
+ }
2183
+ /**
2184
+ * Live boot report written to the terminal while the CLI starts: a list of
2185
+ * the steps (terminal, services, servers, modules) with a thin progress bar
2186
+ * and percentage pinned below it.
2187
+ *
2188
+ * Anything else written to the terminal meanwhile is captured and the bar
2189
+ * steps aside for it. When boot is complete the report is cleared so the
2190
+ * regular terminal takes over; warnings, errors and other output (plugin
2191
+ * warnings) are written again in order. First-run setup prompts, answered
2192
+ * while the report is suspended, are cleared with it.
2193
+ *
2194
+ * A disabled log records problems but writes nothing.
2195
+ */
2196
+ declare class CliBootLog {
2197
+ private readonly terminal;
2198
+ readonly enabled: boolean;
2199
+ private readonly startedAt;
2200
+ private readonly slowStepMs;
2201
+ private readonly problems;
2202
+ private finished;
2203
+ private totalSteps;
2204
+ private completedSteps;
2205
+ private current;
2206
+ private barVisible;
2207
+ private cursorHidden;
2208
+ private suspended;
2209
+ private startRow;
2210
+ /** Output written by others during boot, replayed after the report is cleared. */
2211
+ private readonly captured;
2212
+ private originalWrite?;
2213
+ private originalWriteln?;
2214
+ private redrawScheduled;
2215
+ /** The last setup output did not end its line (cursor after a prompt). */
2216
+ private promptOpen;
2217
+ constructor(terminal: Terminal | undefined, enabled: boolean, options?: CliBootLogOptions);
2218
+ /** Milliseconds since boot started. */
2219
+ get elapsedMs(): number;
2220
+ /** Whether `finish()` was called; later entries are ignored. */
2221
+ get isFinished(): boolean;
2222
+ /** Completed share of the planned steps, 0–100. */
2223
+ get percent(): number;
2224
+ /** Announce `count` more steps that will each be completed with `completeStep`. */
2225
+ addSteps(count: number): void;
2226
+ /** Name what is being set up now (shown next to the bar). */
2227
+ setCurrent(text: string): void;
2228
+ /** Mark one planned step as done (successfully or not). */
2229
+ completeStep(): void;
2230
+ /**
2231
+ * Step aside for interactive output (e.g. a module's first-run setup
2232
+ * prompt): remove the bar and show the cursor until `resume()`.
2233
+ */
2234
+ suspend(): void;
2235
+ /** Bring the bar back after `suspend()`. */
2236
+ resume(): void;
2237
+ info(text: string): void;
2238
+ /** A completed step, optionally with how long it took. */
2239
+ ok(text: string, durationMs?: number): void;
2240
+ warn(text: string): void;
2241
+ error(text: string): void;
2242
+ /**
2243
+ * Write the summary line, then hand the screen over to the terminal:
2244
+ * clear the report (unless `keep`), then write warnings, errors and the
2245
+ * output captured during boot again. The report is not cleared when the
2246
+ * terminal already held something before boot started.
2247
+ */
2248
+ finish(summary: string, keep?: boolean): Promise<void>;
2249
+ private write;
2250
+ /** Redraw the bar on the line below the list (the cursor stays on it). */
2251
+ private drawBar;
2252
+ /** First output: remember where the report starts and capture other writes. */
2253
+ private begin;
2254
+ private stopCapture;
2255
+ /** Someone else writes during boot: move the bar aside and keep a copy. */
2256
+ private onExternalWrite;
2257
+ /** Write without being captured. */
2258
+ private out;
2259
+ private hideBar;
2260
+ private format;
2261
+ private absoluteRow;
2262
+ /** Resolve once xterm has parsed everything written so far. */
2263
+ private flush;
2264
+ }
1501
2265
 
1502
2266
  declare class CliBoot {
1503
2267
  private readonly registry;
@@ -1506,13 +2270,61 @@ declare class CliBoot {
1506
2270
  private initializing;
1507
2271
  private readonly moduleRegistry;
1508
2272
  private readonly bootedModules;
2273
+ private readonly initializedProcessors;
2274
+ /** Services and guards each module registered, removed when it is unloaded. */
2275
+ private readonly moduleProviders;
2276
+ /** Context modules were booted with (passed to `onDestroy` on unload). */
2277
+ private context?;
2278
+ /** Boot report of the startup boot. */
2279
+ private bootLogRef?;
2280
+ /** The boot report while startup is still in progress, else `undefined`. */
2281
+ private get bootLog();
1509
2282
  constructor(registry: ICliCommandProcessorRegistry, services: ICliServiceProvider);
1510
2283
  /**
1511
2284
  * Get the module registry for external access.
1512
2285
  */
1513
2286
  getModuleRegistry(): CliModuleRegistry;
1514
- boot(context: CliExecutionContext, modules: ICliModule[]): Promise<void>;
2287
+ boot(context: CliExecutionContext, modules: ICliModule[], bootLog?: CliBootLog): Promise<void>;
2288
+ private bootAll;
2289
+ /**
2290
+ * Boot one module: declarations (services, guards, permissions,
2291
+ * translations), lifecycle (`onInit`, first-run `onSetup`), then its
2292
+ * commands. Modules already booted or with missing dependencies are skipped.
2293
+ */
1515
2294
  private bootModule;
2295
+ private dependenciesLoaded;
2296
+ /** Services, guards, permissions and translations the module declares. */
2297
+ private registerDeclarations;
2298
+ /** `onInit` runs before the module's commands are registered. */
2299
+ private runOnInit;
2300
+ /** `onSetup` runs once per browser (first-run flow), until it succeeds. */
2301
+ private runFirstSetup;
2302
+ /** Register and initialize the module's commands; returns how many. */
2303
+ private registerCommands;
2304
+ /** One boot-log line per module that does something at boot. */
2305
+ private reportModule;
2306
+ /**
2307
+ * Unload a module (`pkg remove`, or before `pkg update` boots the new
2308
+ * version): its commands, guards and permissions are removed at once,
2309
+ * then `onDestroy` runs, then its services are removed (so `onDestroy`
2310
+ * can still use them). Services are removed by registration, so a newer
2311
+ * version registered meanwhile keeps its own.
2312
+ */
2313
+ private unloadModule;
2314
+ private removeProviders;
2315
+ /** Publish on the event bus; never lets the bus break booting. */
2316
+ private emitEvent;
2317
+ /** Boot warning: into the boot log when it is shown, else the terminal. */
2318
+ private warn;
2319
+ /** Boot error: into the boot log when it is shown, else the terminal. */
2320
+ private fail;
2321
+ /**
2322
+ * Sub-processors of an `extendsProcessor` processor are merged into the
2323
+ * processor it extends, so they belong to that one: re-parent them so they
2324
+ * inherit its access rules (`requiredPermissions` etc.) and help/root
2325
+ * lookups resolve to the registered processor.
2326
+ */
2327
+ private adoptMergedSubProcessors;
1516
2328
  private buildCoreModule;
1517
2329
  /**
1518
2330
  * Topologically sort modules by their dependencies using DFS.
@@ -1576,6 +2388,13 @@ declare class ScriptLoaderService {
1576
2388
  content?: string;
1577
2389
  error?: any;
1578
2390
  }>;
2391
+ /**
2392
+ * Inject an inline script into the page.
2393
+ *
2394
+ * **Security:** This runs `code` in the host page context with full
2395
+ * DOM access. Only call with trusted content (e.g. verified UMD bundles
2396
+ * loaded via the package manager). Never pass user-supplied strings.
2397
+ */
1579
2398
  injectBodyScript(code: string): void;
1580
2399
  /**
1581
2400
  * Returns CDN URLs for a given npm package path.
@@ -1606,14 +2425,18 @@ declare class CliPackageManagerService {
1606
2425
  private readonly storageKey;
1607
2426
  QODALIS_COMMAND_PREFIX: string;
1608
2427
  private store;
2428
+ /** In-memory cache; `null` means "not yet loaded from storage". */
2429
+ private cache;
2430
+ /** Whether the one-time localStorage migration has been checked. */
2431
+ private migrationDone;
1609
2432
  constructor();
1610
2433
  /**
1611
2434
  * Set the key-value store instance for persistence.
1612
2435
  */
1613
2436
  setStore(store: ICliKeyValueStore): void;
1614
2437
  /**
1615
- * Retrieves the list of packages
1616
- * @returns {Package[]} Array of packages
2438
+ * Retrieves the list of packages.
2439
+ * Uses an in-memory cache after the first load.
1617
2440
  */
1618
2441
  getPackages(): Promise<Package[]>;
1619
2442
  /**
@@ -1656,93 +2479,12 @@ declare class CliInputReader implements ICliInputReader {
1656
2479
  readSelect(prompt: string, options: CliSelectOption[], selectOptions?: CliSelectOptions): Promise<string | null>;
1657
2480
  readSelectInline(prompt: string, options: CliSelectOption[], selectOptions?: CliSelectOptions): Promise<string | null>;
1658
2481
  readMultiSelect(prompt: string, options: CliMultiSelectOption[], selectOptions?: CliMultiSelectOptions): Promise<string[] | null>;
1659
- readNumber(prompt: string, options?: {
1660
- min?: number;
1661
- max?: number;
1662
- default?: number;
1663
- }): Promise<number | null>;
2482
+ readNumber(prompt: string, options?: CliNumberOptions): Promise<number | null>;
1664
2483
  readDate(prompt: string, options?: CliDateOptions): Promise<string | null>;
1665
2484
  readFile(prompt: string, options?: CliFilePickerOptions): Promise<CliFileResult[] | null>;
1666
2485
  }
1667
2486
 
1668
- /**
1669
- * A terminal writer wrapper that captures "stdout-equivalent" output
1670
- * (`write`, `writeln`, `writeJson`, `writeObjectsAsTable`, `writeTable`)
1671
- * while passing everything through to the underlying writer unchanged.
1672
- *
1673
- * Diagnostic methods (`writeError`, `writeWarning`, `writeInfo`, `writeSuccess`)
1674
- * are NOT captured — they are the equivalent of stderr.
1675
- *
1676
- * After a command finishes, the executor can retrieve the captured data to use
1677
- * as implicit pipeline output when the command did not call `process.output()`.
1678
- */
1679
- declare class CapturingTerminalWriter implements ICliTerminalWriter {
1680
- private readonly inner;
1681
- /** Raw text lines captured from write/writeln calls. */
1682
- private _lines;
1683
- /** Structured data captured from writeJson calls. */
1684
- private _jsonValues;
1685
- /** Structured data captured from writeObjectsAsTable calls. */
1686
- private _tableObjects;
1687
- /** Raw text lines captured from writeError/writeWarning calls. */
1688
- private _stderrLines;
1689
- constructor(inner: ICliTerminalWriter);
1690
- write(text: string): void;
1691
- writeln(text?: string): void;
1692
- writeJson(json: any): void;
1693
- writeObjectsAsTable(objects: any[]): void;
1694
- writeTable(headers: string[], rows: string[][]): void;
1695
- writeSuccess(message: string): void;
1696
- writeInfo(message: string): void;
1697
- writeWarning(message: string): void;
1698
- writeError(message: string): void;
1699
- wrapInColor(text: string, color: CliForegroundColor): string;
1700
- wrapInBackgroundColor(text: string, color: CliBackgroundColor): string;
1701
- writeToFile(fileName: string, content: string): void;
1702
- writeDivider(options?: {
1703
- color?: CliForegroundColor;
1704
- length?: number;
1705
- char?: string;
1706
- }): void;
1707
- writeList(items: string[], options?: {
1708
- ordered?: boolean;
1709
- prefix?: string;
1710
- color?: CliForegroundColor;
1711
- }): void;
1712
- writeKeyValue(entries: Record<string, string> | [string, string][], options?: {
1713
- separator?: string;
1714
- keyColor?: CliForegroundColor;
1715
- }): void;
1716
- writeColumns(items: string[], options?: {
1717
- columns?: number;
1718
- padding?: number;
1719
- }): void;
1720
- /**
1721
- * Returns true if any stdout-equivalent output was captured.
1722
- */
1723
- hasOutput(): boolean;
1724
- /**
1725
- * Returns the captured data in the most useful form:
1726
- *
1727
- * 1. If structured JSON was written (via `writeJson`), return the last
1728
- * JSON value (preserving its original type — object, array, etc.).
1729
- * 2. If objects were written as a table, return the last array of objects.
1730
- * 3. Otherwise return the captured text lines joined with newlines,
1731
- * with ANSI codes stripped and whitespace trimmed.
1732
- * 4. Returns `undefined` if nothing was captured.
1733
- */
1734
- getCapturedData(): any | undefined;
1735
- /**
1736
- * Returns true if any stderr-equivalent output was captured.
1737
- */
1738
- hasStderr(): boolean;
1739
- /**
1740
- * Returns captured stderr text joined with newlines, or undefined if empty.
1741
- */
1742
- getCapturedStderr(): string | undefined;
1743
- }
1744
-
1745
- declare const CliProcessRegistry_TOKEN = "cli-process-registry";
2487
+ declare const CliProcessRegistry_TOKEN: any;
1746
2488
  declare class CliProcessRegistry implements ICliProcessRegistry {
1747
2489
  private nextPid;
1748
2490
  private processes;
@@ -1761,7 +2503,7 @@ declare class CliProcessRegistry implements ICliProcessRegistry {
1761
2503
  }
1762
2504
 
1763
2505
  /**
1764
- * Global environment variable store for the CLI session.
2506
+ * Environment variables for the CLI.
1765
2507
  *
1766
2508
  * Variables set here are available to all commands via `$VAR` / `${VAR}`
1767
2509
  * substitution in the executor. Commands can also read/write the store
@@ -1770,29 +2512,106 @@ declare class CliProcessRegistry implements ICliProcessRegistry {
1770
2512
  interface ICliEnvironment {
1771
2513
  /** Get a variable value (undefined if not set). */
1772
2514
  get(name: string): string | undefined;
1773
- /** Set a variable. */
1774
- set(name: string, value: string): void;
1775
- /** Remove a variable. */
1776
- unset(name: string): void;
2515
+ /**
2516
+ * Set a variable: for the signed-in user (`'user'`, the default, saved),
2517
+ * for everyone (`'global'`, saved) or for this terminal only (`'session'`).
2518
+ */
2519
+ set(name: string, value: string, scope?: CliEnvironmentScope): void;
2520
+ /**
2521
+ * Remove a variable. Without a scope it is removed for this terminal and
2522
+ * the user (and hidden when it still comes from a shared or built-in
2523
+ * value); `'global'` removes the shared value.
2524
+ */
2525
+ unset(name: string, scope?: CliEnvironmentScope): void;
1777
2526
  /** Get all variables as a record. */
1778
2527
  getAll(): Record<string, string>;
1779
2528
  /** Check if a variable is set. */
1780
2529
  has(name: string): boolean;
1781
- }
1782
- declare const ICliEnvironment_TOKEN = "cli-environment";
2530
+ /** Where the current value of `name` comes from. */
2531
+ scopeOf?(name: string): CliEnvironmentSource | undefined;
2532
+ }
2533
+ declare const ICliEnvironment_TOKEN: any;
2534
+ /** Where a variable is set: this terminal, the signed-in user, or everyone. */
2535
+ type CliEnvironmentScope = 'session' | 'user' | 'global';
2536
+ /** Where a value comes from: a scope, or computed / built in (`HOME`, `SHELL`, …). */
2537
+ type CliEnvironmentSource = CliEnvironmentScope | 'builtin';
2538
+ /** What one user (or the signed-out session, key '') changed: values set and defaults removed. */
2539
+ interface CliEnvironmentProfile {
2540
+ vars: Record<string, string>;
2541
+ unset: string[];
2542
+ }
2543
+ /** Saved environment: one profile per user name ('' when nobody is signed in). */
2544
+ type CliEnvironmentSnapshot = Record<string, CliEnvironmentProfile>;
2545
+ /**
2546
+ * One saved change, applied by the host to the latest saved state (so two
2547
+ * tabs changing different variables never overwrite each other).
2548
+ */
2549
+ type CliEnvironmentChange = {
2550
+ scope: 'user';
2551
+ profile: string;
2552
+ name: string;
2553
+ value: string;
2554
+ } | {
2555
+ scope: 'user';
2556
+ profile: string;
2557
+ name: string;
2558
+ unset: true;
2559
+ hide: boolean;
2560
+ } | {
2561
+ scope: 'global';
2562
+ name: string;
2563
+ value: string;
2564
+ } | {
2565
+ scope: 'global';
2566
+ name: string;
2567
+ unset: true;
2568
+ };
1783
2569
  /**
1784
2570
  * Default in-memory implementation.
1785
- * Seeded with some standard variables on construction.
2571
+ *
2572
+ * A variable resolves, in order, from this terminal's variables
2573
+ * (`NAME=value`), the current user's own (`export`), the shared ones
2574
+ * (`export --global`), then bound live values (USER, HOME, PWD follow the
2575
+ * session and directory), then the standard variables seeded on
2576
+ * construction. Each user has a separate set, so `su`/`login` switch
2577
+ * environments, and `onChange` lets the host save each change.
1786
2578
  */
1787
2579
  declare class CliEnvironment implements ICliEnvironment {
1788
- private readonly vars;
2580
+ private readonly defaults;
2581
+ /** Variables computed on read; a user's own value wins over them. */
2582
+ private readonly bound;
2583
+ private readonly profiles;
2584
+ private readonly global;
2585
+ private readonly session;
2586
+ private profileKey;
2587
+ /** Called after every saved change (user or global), to persist it. */
2588
+ onChange?: (change: CliEnvironmentChange) => void;
1789
2589
  constructor();
2590
+ /** Compute a variable on every read; the seeded value is the fallback while it returns nothing. */
2591
+ bind(name: string, resolver: () => string | null | undefined): void;
2592
+ /** Pick whose changes apply (the signed-in user's name, '' when signed out). */
2593
+ setProfileResolver(resolver: () => string | null | undefined): void;
2594
+ /** Restore saved profiles and shared variables (replaces the saved ones in memory). */
2595
+ load(snapshot: CliEnvironmentSnapshot | undefined, global?: Record<string, string>): void;
2596
+ snapshot(): CliEnvironmentSnapshot;
2597
+ /** The shared variables. */
2598
+ globals(): Record<string, string>;
1790
2599
  get(name: string): string | undefined;
1791
- set(name: string, value: string): void;
1792
- unset(name: string): void;
2600
+ scopeOf(name: string): CliEnvironmentSource | undefined;
2601
+ set(name: string, value: string, scope?: CliEnvironmentScope): void;
2602
+ unset(name: string, scope?: CliEnvironmentScope): void;
1793
2603
  getAll(): Record<string, string>;
1794
2604
  has(name: string): boolean;
1795
- }
2605
+ private profileOf;
2606
+ }
2607
+ /** Apply one change to saved state (the host does this under the cross-tab lock). */
2608
+ declare function applyEnvironmentChange(state: {
2609
+ profiles?: CliEnvironmentSnapshot;
2610
+ global?: Record<string, string>;
2611
+ }, change: CliEnvironmentChange): {
2612
+ profiles: CliEnvironmentSnapshot;
2613
+ global: Record<string, string>;
2614
+ };
1796
2615
 
1797
2616
  declare class CliDragDropService implements ICliDragDropService {
1798
2617
  private readonly _container;
@@ -1804,6 +2623,58 @@ declare class CliDragDropService implements ICliDragDropService {
1804
2623
  destroy(): void;
1805
2624
  }
1806
2625
 
2626
+ /**
2627
+ * Default HTTP client implementation.
2628
+ *
2629
+ * Wraps the global `fetch()` and automatically merges an abort signal
2630
+ * so that in-flight requests are cancelled when the user presses Ctrl+C.
2631
+ *
2632
+ * Created per-command by the executor — each instance is bound to the
2633
+ * command's own AbortSignal.
2634
+ */
2635
+ declare class CliHttpClient implements ICliHttpClient {
2636
+ private readonly signal?;
2637
+ constructor(signal?: AbortSignal | undefined);
2638
+ fetch(url: string, init?: RequestInit): Promise<Response>;
2639
+ get<T = any>(url: string, options?: CliHttpRequestOptions): Promise<T>;
2640
+ post<T = any>(url: string, body?: any, options?: CliHttpRequestOptions): Promise<T>;
2641
+ put<T = any>(url: string, body?: any, options?: CliHttpRequestOptions): Promise<T>;
2642
+ patch<T = any>(url: string, body?: any, options?: CliHttpRequestOptions): Promise<T>;
2643
+ delete<T = any>(url: string, options?: CliHttpRequestOptions): Promise<T>;
2644
+ head(url: string, options?: CliHttpRequestOptions): Promise<Response>;
2645
+ options<T = any>(url: string, options?: CliHttpRequestOptions): Promise<T>;
2646
+ private jsonRequest;
2647
+ private isRawBody;
2648
+ /**
2649
+ * Merge the command signal with any additional signals (caller, timeout).
2650
+ * Uses AbortSignal.any() when available, falls back to a manual composite
2651
+ * controller for older browsers (pre-Chrome 116 / Safari 17.4).
2652
+ */
2653
+ private mergeSignal;
2654
+ }
2655
+
2656
+ declare class CliNotifier implements ICliNotifier {
2657
+ private _current;
2658
+ private readonly _change$;
2659
+ readonly change$: rxjs.Observable<any>;
2660
+ get current(): CliNotification | undefined;
2661
+ info(message: string): void;
2662
+ success(message: string): void;
2663
+ warn(message: string): void;
2664
+ error(message: string): void;
2665
+ clear(): void;
2666
+ private set;
2667
+ }
2668
+
2669
+ /** Default {@link ICliPermissionRegistry}: permissions declared by modules. */
2670
+ declare class CliPermissionRegistry implements ICliPermissionRegistry {
2671
+ private readonly definitions;
2672
+ register(definitions: CliPermissionDefinition[], module?: string): void;
2673
+ unregister(module: string): void;
2674
+ list(): CliPermissionDefinition[];
2675
+ get(name: string): CliPermissionDefinition | undefined;
2676
+ }
2677
+
1807
2678
  declare class OverlayAddon implements ITerminalAddon {
1808
2679
  private terminal;
1809
2680
  private overlayNode;
@@ -1815,8 +2686,6 @@ declare class OverlayAddon implements ITerminalAddon {
1815
2686
  }
1816
2687
 
1817
2688
  declare const getCliNameArt: (cols: number) => string;
1818
- /** @deprecated Use getCliNameArt(cols) instead */
1819
- declare const CLi_Name_Art = "\n ____ _ _ _ _____ _ _____\n / __ \\ | | | (_) / ____| | |_ _|\n | | | | ___ __| | __ _| |_ ___ | | | | | |\n | | | |/ _ \\ / _` |/ _` | | / __| | | | | | |\n | |__| | (_) | (_| | (_| | | \\__ \\ | |____| |____ _| |_\n \\___\\_\\\\___/ \\__,_|\\__,_|_|_|___/ \\_____|______|_____|\n";
1820
2689
  declare const hotkeysInfo: {
1821
2690
  key: string;
1822
2691
  description: string;
@@ -1860,23 +2729,140 @@ declare class CliKeyValueStore implements ICliKeyValueStore {
1860
2729
  declare class CliStateStore implements ICliStateStore {
1861
2730
  private readonly services;
1862
2731
  readonly name: string;
1863
- private readonly initialState;
1864
2732
  private state$;
1865
- private storageKey;
1866
- constructor(services: ICliServiceProvider, name: string, initialState: CliState);
2733
+ /** Signed-in user, for `scope: 'user'` stores. */
2734
+ private user?;
2735
+ private initialState;
2736
+ private options;
2737
+ /** The first load from storage (see `initialize`). */
2738
+ private loading?;
2739
+ private loaded;
2740
+ /** Keys changed before the saved state was loaded: they win over it. */
2741
+ private readonly changedBeforeLoad;
2742
+ /** Keys changed since the last save (only these are written). */
2743
+ private readonly unsaved;
2744
+ /** When each key was last changed here (`updateState`), to tell local edits from synced ones. */
2745
+ private readonly editedAt;
2746
+ private edits;
2747
+ /** `reset()` since the last save: the whole state is written. */
2748
+ private replaceOnSave;
2749
+ /**
2750
+ * Each key as last loaded, saved or received (JSON), to also find keys
2751
+ * changed in place without `updateState`.
2752
+ */
2753
+ private baseline;
2754
+ private persistScheduled;
2755
+ /**
2756
+ * Called after the state was saved (set by the store manager to share it
2757
+ * with other tabs).
2758
+ */
2759
+ onPersisted?: (storageKey: string, state: CliState) => void;
2760
+ constructor(services: ICliServiceProvider, name: string, initialState: CliState, options?: CliStateStoreOptions);
2761
+ /** Key the state is saved under. */
2762
+ get key(): string;
2763
+ /**
2764
+ * Saved per store, or per signed-in user for `scope: 'user'` (signed
2765
+ * out, the state is shared like a global store).
2766
+ */
2767
+ private get storageKey();
2768
+ /**
2769
+ * The signed-in user changed: a `scope: 'user'` store switches to that
2770
+ * user's saved state (unsaved changes of the previous user are dropped,
2771
+ * so save before switching users).
2772
+ */
2773
+ setUser(user: string | undefined): void;
2774
+ /** Whether changes saved by other tabs are applied to this store. */
2775
+ get syncAcrossTabs(): boolean;
2776
+ /** A session store lives in this terminal only and is never saved. */
2777
+ private get isSession();
1867
2778
  getState<T extends CliState = CliState>(): T;
1868
2779
  updateState(newState: Partial<CliState>): void;
1869
2780
  select<K>(selector: (state: CliState) => K): Observable<K>;
1870
2781
  subscribe(callback: (state: CliState) => void): Subscription;
1871
2782
  reset(): void;
2783
+ /**
2784
+ * Save the state. The saved state is loaded first, so saving before the
2785
+ * store was loaded never replaces data with the initial state.
2786
+ */
1872
2787
  persist(): Promise<void>;
2788
+ /**
2789
+ * Change the state from its latest saved value and save it, atomically:
2790
+ * under the cross-tab lock, `change` gets the state as saved (plus this
2791
+ * terminal's unsaved changes) and its result is merged and written. Two
2792
+ * terminals updating the same key never lose each other's change, e.g.
2793
+ * both adding an item to a list. Without storage (or for a session
2794
+ * store) it is a plain `updateState`.
2795
+ */
2796
+ update(change: (state: CliState) => Partial<CliState>): Promise<void>;
1873
2797
  initialize(): Promise<void>;
2798
+ reload(): Promise<void>;
2799
+ /**
2800
+ * Add defaults for keys the store does not have yet (when it was first
2801
+ * created without them, e.g. read before its command registered).
2802
+ */
2803
+ applyDefaults(defaults: CliState): void;
2804
+ /** Merge store options (later options win). */
2805
+ setOptions(options: CliStateStoreOptions): void;
2806
+ /**
2807
+ * State saved by another tab or terminal: apply it without saving again,
2808
+ * keeping the keys changed here and not saved yet.
2809
+ */
2810
+ applySaved(state: CliState): void;
2811
+ /**
2812
+ * Another tab or terminal saved this store: apply what is saved now.
2813
+ * Messages can arrive out of order (one sent before this terminal's own
2814
+ * save can arrive after it), so storage, not the message, is the truth.
2815
+ * Reads are chained so the last one applied is the latest.
2816
+ */
2817
+ refreshFromStorage(fallback?: CliState): Promise<void>;
2818
+ private refreshing;
2819
+ /**
2820
+ * Complete the BehaviorSubject so all subscribers are notified
2821
+ * and no further emissions occur. Called during engine teardown.
2822
+ */
2823
+ dispose(): void;
2824
+ private load;
2825
+ /**
2826
+ * Save the keys changed here, merged into the saved state (the whole
2827
+ * state after `reset()` or a migration). Runs under a lock shared by all
2828
+ * tabs, so two terminals saving at once do not lose each other's keys.
2829
+ * Keys others saved meanwhile are applied here.
2830
+ */
2831
+ private write;
2832
+ /** Keys changed here since the last load, save or received state. */
2833
+ private changedKeys;
2834
+ private setBaseline;
2835
+ private pick;
2836
+ private get versionKey();
2837
+ /** With `autoPersist`, save once after the changes of this tick. */
2838
+ private schedulePersist;
1874
2839
  }
1875
2840
 
1876
2841
  interface CliEngineOptions extends CliOptions {
1877
2842
  terminalOptions?: Partial<ITerminalOptions & ITerminalInitOnlyOptions>;
1878
2843
  /** Optional snapshot to restore on start() */
1879
2844
  snapshot?: CliEngineSnapshot;
2845
+ /**
2846
+ * Explicit URL of `qodalis_cli_wasm_bg.wasm` (optional accelerator). When
2847
+ * omitted it is looked up next to the page (`document.baseURI`), then at
2848
+ * `/assets/wasm/` and `/wasm/`; the CLI works without it.
2849
+ */
2850
+ wasmUrl?: string;
2851
+ /**
2852
+ * The welcome banner and greeting shown at startup. `false` starts with
2853
+ * just the prompt (embedded terminals, playgrounds, terminals driven by
2854
+ * `execute()`); an object configures the banner like
2855
+ * `welcomeModule.configure()`.
2856
+ * @default true
2857
+ */
2858
+ welcome?: boolean | CliWelcomeMessageConfig;
2859
+ /**
2860
+ * Focus the terminal when it starts. Turn it off when the terminal sits
2861
+ * next to other inputs that should keep the keyboard (an editor that
2862
+ * rebuilds the terminal while the user types); `focus()` still works.
2863
+ * @default true
2864
+ */
2865
+ autoFocus?: boolean;
1880
2866
  }
1881
2867
  declare class CliEngine {
1882
2868
  private readonly container;
@@ -1895,6 +2881,11 @@ declare class CliEngine {
1895
2881
  private resizeScheduled;
1896
2882
  private bootService?;
1897
2883
  private dragDropService?;
2884
+ private _startedAt?;
2885
+ private terminalOptions;
2886
+ private _isBooted;
2887
+ private resolveBooted;
2888
+ private readonly bootedPromise;
1898
2889
  constructor(container: HTMLElement, options?: CliEngineOptions | undefined);
1899
2890
  /**
1900
2891
  * Register a CLI module to be loaded on start().
@@ -1905,25 +2896,55 @@ declare class CliEngine {
1905
2896
  */
1906
2897
  registerModules(modules: ICliModule[]): void;
1907
2898
  /**
1908
- * Register a command processor to be loaded on start().
1909
- * @deprecated Use registerModule() instead.
2899
+ * Register a service to be available in the service container before
2900
+ * any module boots. Must be called before start(). Services a module
2901
+ * needs for itself belong in its `services`.
1910
2902
  */
1911
- registerProcessor(processor: ICliCommandProcessor): void;
2903
+ registerService(token: string, value: any): void;
1912
2904
  /**
1913
- * Register multiple command processors to be loaded on start().
1914
- * @deprecated Use registerModule() instead.
2905
+ * Start the CLI: set up the terminal and services, boot the modules
2906
+ * (reporting progress in the terminal), then hand over to the prompt.
2907
+ *
2908
+ * Phases, in order:
2909
+ * 1. terminal xterm.js in the container
2910
+ * 2. services service container, executor, execution context
2911
+ * 3. boot report hold typed keys, show the boot log
2912
+ * 4. runtime environment, background services, servers
2913
+ * 5. modules core + welcome + server + user modules
2914
+ * 6. completion tab-completion providers
2915
+ * 7. ready clear the report, replay typed keys, `isBooted`
2916
+ * 8. after boot `onAfterBoot` hooks (welcome message), snapshot
1915
2917
  */
1916
- registerProcessors(processors: ICliCommandProcessor[]): void;
2918
+ start(): Promise<void>;
2919
+ /** 1. Wait for the container to have a size, then create xterm.js. */
2920
+ private setupTerminal;
2921
+ /** 2. Service container, boot service, executor and execution context. */
2922
+ private setupServices;
1917
2923
  /**
1918
- * Register a service to be available in the service container.
1919
- * Must be called before start().
1920
- * @deprecated Use registerModule() with services instead.
2924
+ * 3. Keep what the user types until the terminal is ready (replayed at
2925
+ * the first prompt) and start the boot report (configurable).
1921
2926
  */
1922
- registerService(token: string, value: any): void;
2927
+ private beginBootReport;
2928
+ /** 4. Environment variables, background services, server auth and manager. */
2929
+ private registerRuntimeServices;
2930
+ /** 4. Connect to the configured servers, one boot step each. */
2931
+ private connectServers;
1923
2932
  /**
1924
- * Initialize the terminal, wire up services, boot modules, and show welcome message.
2933
+ * 5. Built-in welcome and server modules, the app's modules, and the
2934
+ * greeting, which runs after every other `onAfterBoot` hook.
1925
2935
  */
1926
- start(): Promise<void>;
2936
+ private modulesToBoot;
2937
+ /** Whether startup shows the welcome banner (which also shows the first prompt). */
2938
+ private get showsWelcome();
2939
+ /** 7. Replace the boot report with the terminal and mark the CLI booted. */
2940
+ private completeBoot;
2941
+ /**
2942
+ * Boot threw: never leave the terminal unusable. Keep the report with the
2943
+ * error on screen, show the cursor and hand over typed keys.
2944
+ */
2945
+ private failBoot;
2946
+ /** 8. `onAfterBoot` hooks by priority (lower first); one failing hook does not stop the rest. */
2947
+ private runAfterBootHooks;
1927
2948
  /**
1928
2949
  * Clean up terminal and event listeners.
1929
2950
  */
@@ -1945,7 +2966,23 @@ declare class CliEngine {
1945
2966
  */
1946
2967
  getRegistry(): CliCommandProcessorRegistry;
1947
2968
  /**
1948
- * Execute a command programmatically.
2969
+ * `true` once boot has completed: modules are set up and the terminal
2970
+ * accepts input. `onAfterBoot` hooks (welcome message) run right after.
2971
+ */
2972
+ get isBooted(): boolean;
2973
+ /**
2974
+ * Resolves when boot has completed (see `isBooted`). Never rejects; if
2975
+ * `start()` fails it stays pending.
2976
+ */
2977
+ get booted(): Promise<void>;
2978
+ /**
2979
+ * Timestamp (ms since epoch) when the engine finished starting.
2980
+ */
2981
+ get startedAt(): number | undefined;
2982
+ /**
2983
+ * Execute a command programmatically, behaving the same as if the user
2984
+ * typed it and pressed Enter: echoes the command, adds it to history,
2985
+ * executes it, and shows a new prompt afterwards.
1949
2986
  */
1950
2987
  execute(command: string): Promise<void>;
1951
2988
  /**
@@ -1959,8 +2996,6 @@ declare class CliEngine {
1959
2996
  * source, the restored content may reflow differently.
1960
2997
  */
1961
2998
  private restoreSnapshot;
1962
- private getTerminalOptions;
1963
- private initializeTerminal;
1964
2999
  private handleResize;
1965
3000
  /**
1966
3001
  * Call fitAddon.fit() only when the container has non-zero dimensions.
@@ -1974,51 +3009,216 @@ declare class CliEngine {
1974
3009
  * so intermediate resize events cannot leave stale artefacts.
1975
3010
  */
1976
3011
  private deferResizeFix;
1977
- /**
1978
- * Wait until the container element has non-zero dimensions.
1979
- * xterm.js requires the host element to be laid out before open() is called.
1980
- */
1981
- private waitForLayout;
1982
3012
  }
1983
3013
 
3014
+ interface TerminalSetupResult {
3015
+ terminal: Terminal;
3016
+ fitAddon: FitAddon;
3017
+ serializeAddon: SerializeAddon;
3018
+ dragDropService: CliDragDropService;
3019
+ wheelListener: (e: WheelEvent) => void;
3020
+ }
3021
+ /**
3022
+ * Default terminal font size: 20px, or 14px on phone-sized viewports so a
3023
+ * line still fits a useful number of columns (about 26 at 20px on a 390px screen).
3024
+ */
3025
+ declare function defaultFontSize(): number;
3026
+ /**
3027
+ * Merge user-supplied terminal options with sensible defaults.
3028
+ */
3029
+ declare function getTerminalOptions(userOptions?: Partial<ITerminalOptions & ITerminalInitOnlyOptions>): ITerminalOptions & ITerminalInitOnlyOptions;
3030
+ /**
3031
+ * Create and configure an xterm.js Terminal with all required addons,
3032
+ * open it into the given container, and return the instances.
3033
+ */
3034
+ declare function initializeTerminal(container: HTMLElement, opts: ITerminalOptions & ITerminalInitOnlyOptions, focus?: boolean): TerminalSetupResult;
3035
+ /**
3036
+ * Wait until the container element has non-zero dimensions.
3037
+ * xterm.js requires the host element to be laid out before open() is called.
3038
+ * Rejects after {@link LAYOUT_TIMEOUT_MS} if the container stays hidden.
3039
+ */
3040
+ declare function waitForLayout(container: HTMLElement): Promise<void>;
3041
+
3042
+ /**
3043
+ * In-memory publish/subscribe bus of one terminal. Handlers run
3044
+ * synchronously in subscription order; a throwing handler is reported to
3045
+ * `onHandlerError` and does not stop delivery. Keeps the last
3046
+ * {@link CLI_EVENT_HISTORY_SIZE} events; nothing is persisted.
3047
+ */
3048
+ declare class CliEventBus implements ICliEventBus {
3049
+ private readonly onHandlerError;
3050
+ private readonly historySize;
3051
+ private readonly subject;
3052
+ private readonly recent;
3053
+ private disposed;
3054
+ constructor(onHandlerError?: (error: unknown, event: CliEvent) => void, historySize?: number);
3055
+ emit<K extends CliEventType>(type: K, data: CliEventMap[K], options?: CliEmitOptions): void;
3056
+ emit<T = unknown, K extends string = string>(type: K & CustomEventType<K>, data?: T, options?: CliEmitOptions): void;
3057
+ on<K extends CliEventType>(pattern: K, handler: CliEventHandler<CliEventMap[K]>): () => void;
3058
+ on<T = unknown>(pattern: string, handler: CliEventHandler<T>): () => void;
3059
+ once<K extends CliEventType>(pattern: K, handler: CliEventHandler<CliEventMap[K]>): () => void;
3060
+ once<T = unknown>(pattern: string, handler: CliEventHandler<T>): () => void;
3061
+ events$<K extends CliEventType>(pattern: K): Observable<CliEvent<CliEventMap[K]>>;
3062
+ events$<T = unknown>(pattern?: string): Observable<CliEvent<T>>;
3063
+ history<K extends CliEventType>(pattern: K, limit?: number): CliEvent<CliEventMap[K]>[];
3064
+ history<T = unknown>(pattern?: string, limit?: number): CliEvent<T>[];
3065
+ /** Stop delivering events and complete all observables. */
3066
+ dispose(): void;
3067
+ }
3068
+
3069
+ /**
3070
+ * Default implementation of the translation service.
3071
+ *
3072
+ * Maintains a map of locale -> flat key-value translations.
3073
+ * The 'en' locale is always implicitly available via defaultValue fallbacks.
3074
+ * Supports simple {param} interpolation.
3075
+ */
3076
+ declare class CliTranslationService implements ICliTranslationService {
3077
+ private locale;
3078
+ private readonly translations;
3079
+ t(key: string, defaultValue: string, params?: Record<string, string | number>): string;
3080
+ getLocale(): string;
3081
+ setLocale(locale: string): void;
3082
+ addTranslations(locale: string, translations: Record<string, string>): void;
3083
+ getAvailableLocales(): string[];
3084
+ }
3085
+
3086
+ interface InitializeServicesOptions {
3087
+ registry: CliCommandProcessorRegistry;
3088
+ pendingServices: CliProvider[];
3089
+ dragDropService?: CliDragDropService;
3090
+ }
3091
+ interface InitializeServicesResult {
3092
+ services: CliServiceContainer;
3093
+ events: CliEventBus;
3094
+ logger: CliLogger;
3095
+ commandHistory: CliCommandHistory;
3096
+ stateStoreManager: CliStateStoreManager;
3097
+ processRegistry: CliProcessRegistry;
3098
+ translator: CliTranslationService;
3099
+ }
3100
+ /**
3101
+ * Build and populate the service container with all core services.
3102
+ * Takes the registry, pending (user-registered) services, and the drag-drop
3103
+ * service instance, and returns all initialized services ready for wiring
3104
+ * into the execution context.
3105
+ */
3106
+ declare function initializeServices(options: InitializeServicesOptions): Promise<InitializeServicesResult>;
3107
+
3108
+ /** Service token holding the name of the framework hosting the CLI. */
3109
+ declare const CLI_FRAMEWORK_SERVICE = "cli-framework";
3110
+ /** What a framework wrapper passes to an engine: shared by components, providers and config contexts. */
3111
+ interface CliHostConfig {
3112
+ modules?: ICliModule[];
3113
+ options?: CliEngineOptions;
3114
+ /** Extra services registered by token before start. */
3115
+ services?: Record<string, any>;
3116
+ }
3117
+ interface CreateCliEngineConfig extends CliHostConfig {
3118
+ /** Reported by `version`, `debug` and `feedback`, e.g. 'React'. */
3119
+ framework?: string;
3120
+ /** Terminal state to restore on start. */
3121
+ snapshot?: CliEngineSnapshot;
3122
+ }
3123
+ /**
3124
+ * Create an engine for `container` with the services and modules of a
3125
+ * wrapper registered (in that order). Call `start()` on it.
3126
+ */
3127
+ declare function createCliEngine(container: HTMLElement, config?: CreateCliEngineConfig): CliEngine;
3128
+ /**
3129
+ * Resolve a component's config: each field set locally wins over the one
3130
+ * inherited from a surrounding config provider.
3131
+ */
3132
+ declare function resolveCliHostConfig(local: CliHostConfig, inherited?: CliHostConfig | null): CliHostConfig;
3133
+ /** Merge option objects key by key: `local` overrides `inherited`. */
3134
+ declare function mergeCliOptions<T extends object>(local: T | undefined, inherited: object | undefined): T | undefined;
3135
+
1984
3136
  declare class CliServerConnection {
1985
3137
  private readonly _config;
1986
3138
  private readonly _backgroundServices?;
3139
+ private readonly _logger?;
3140
+ private readonly _authService?;
1987
3141
  private _connected;
1988
3142
  private _commands;
1989
3143
  private _capabilities;
1990
3144
  private _eventSocket;
3145
+ private _apiVersion;
3146
+ private _basePath;
3147
+ private _wsReconnectAttempts;
3148
+ private _wsReconnectTimer;
3149
+ /** True once this connection registered its `server-events:<name>` background service */
3150
+ private _eventServiceRegistered;
3151
+ private static readonly WS_MAX_RECONNECT_ATTEMPTS;
3152
+ private static readonly WS_MAX_RECONNECT_DELAY_MS;
3153
+ private _healthCheckTimer;
3154
+ private _healthCheckAttempts;
3155
+ private static readonly HEALTH_CHECK_INTERVAL_MS;
3156
+ private static readonly HEALTH_CHECK_MAX_ATTEMPTS;
1991
3157
  onDisconnect?: () => void;
1992
- constructor(_config: CliServerConfig, _backgroundServices?: ICliBackgroundServiceRegistry | undefined);
3158
+ onReconnected?: () => void;
3159
+ constructor(_config: CliServerConfig, _backgroundServices?: ICliBackgroundServiceRegistry, _logger?: ICliLogger, _authService?: ICliServerAuthService);
1993
3160
  get config(): CliServerConfig;
1994
3161
  get connected(): boolean;
1995
3162
  get commands(): CliServerCommandDescriptor[];
1996
3163
  get capabilities(): CliServerCapabilities | null;
3164
+ get apiVersion(): number;
3165
+ /**
3166
+ * Resolve auth headers for this server connection.
3167
+ * Uses the auth service (which merges config headers with registered
3168
+ * ICliServerAuthTokenProviders), or falls back to config headers directly.
3169
+ */
3170
+ resolveAuthHeaders(): Record<string, string>;
3171
+ /**
3172
+ * WebSocket URL for this server with auth: single-use upgrade params from
3173
+ * auth providers when available, otherwise headers copied into the URL.
3174
+ */
3175
+ buildWebSocketUrl(path: string): Promise<string>;
1997
3176
  connect(): Promise<void>;
1998
3177
  disconnect(): void;
3178
+ startHealthCheck(): void;
3179
+ private scheduleNextHealthCheck;
3180
+ stopHealthCheck(): void;
1999
3181
  fetchCommands(): Promise<CliServerCommandDescriptor[]>;
2000
3182
  fetchCapabilities(): Promise<CliServerCapabilities | null>;
2001
3183
  execute(command: CliProcessCommand): Promise<CliServerResponse>;
3184
+ executeStream(command: CliProcessCommand, onOutput: (output: CliServerOutput) => void): Promise<{
3185
+ exitCode: number;
3186
+ }>;
2002
3187
  ping(): Promise<boolean>;
3188
+ /** Whether the server answers HTTP at all (any status: it is running). */
3189
+ private answers;
2003
3190
  private connectEventSocket;
2004
3191
  private connectEventSocketDirect;
3192
+ private connectEventSocketDirectAsync;
3193
+ /**
3194
+ * The server closes the event socket with 4401 when the session behind it
3195
+ * ended (logout, revoke, expiry). Retrying with the same credentials cannot
3196
+ * succeed; the auth layer reconnects the server when the session changes.
3197
+ */
3198
+ private isSessionEndedClose;
2005
3199
  private handleServerDisconnect;
2006
3200
  private closeEventSocket;
2007
3201
  private closeEventSocketDirect;
3202
+ private scheduleWsReconnect;
3203
+ private httpFetchWithRetry;
2008
3204
  private httpFetch;
2009
3205
  private normalizeUrl;
2010
3206
  private toWebSocketUrl;
2011
3207
  }
2012
3208
 
2013
3209
  /**
2014
- * Execute a command on a specific server connection and render the response.
2015
- * Shared by both single-proxy and multi-proxy processors.
3210
+ * Render a single CliServerOutput to the terminal.
2016
3211
  */
2017
- declare function executeOnServer(connection: CliServerConnection, serverName: string, descriptor: CliServerCommandDescriptor, command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
3212
+ declare function renderSingleOutput(output: CliServerOutput, context: ICliExecutionContext): void;
2018
3213
  /**
2019
3214
  * Render a CliServerResponse to the terminal.
2020
3215
  */
2021
3216
  declare function renderServerResponse(response: CliServerResponse, context: ICliExecutionContext): void;
3217
+ /**
3218
+ * Execute a command on a specific server connection and render the response.
3219
+ * Shared by both single-proxy and multi-proxy processors.
3220
+ */
3221
+ declare function executeOnServer(connection: CliServerConnection, serverName: string, descriptor: CliServerCommandDescriptor, command: CliProcessCommand, context: ICliExecutionContext, commandPath?: string[]): Promise<void>;
2022
3222
  declare class CliServerProxyProcessor implements ICliCommandProcessor {
2023
3223
  private readonly connection;
2024
3224
  private readonly descriptor;
@@ -2028,9 +3228,12 @@ declare class CliServerProxyProcessor implements ICliCommandProcessor {
2028
3228
  description?: string;
2029
3229
  version?: string;
2030
3230
  metadata?: CliProcessorMetadata;
2031
- parameters?: ICliCommandParameterDescriptor[];
3231
+ parameters?: ICliCommandParameterDescriptor$1[];
2032
3232
  processors?: ICliCommandProcessor[];
2033
- constructor(connection: CliServerConnection, descriptor: CliServerCommandDescriptor, serverName: string);
3233
+ acceptsRawInput?: boolean;
3234
+ /** Full command path from root to this processor (e.g. ["aws", "lambda", "list"]) */
3235
+ private readonly commandPath;
3236
+ constructor(connection: CliServerConnection, descriptor: CliServerCommandDescriptor, serverName: string, isNested?: boolean, parentPath?: string[]);
2034
3237
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
2035
3238
  }
2036
3239
 
@@ -2054,31 +3257,41 @@ declare class CliServerMultiProxyProcessor implements ICliCommandProcessor {
2054
3257
  command: string;
2055
3258
  description?: string;
2056
3259
  metadata?: CliProcessorMetadata;
2057
- parameters?: ICliCommandParameterDescriptor[];
3260
+ parameters?: ICliCommandParameterDescriptor$1[];
2058
3261
  processors?: ICliCommandProcessor[];
2059
- constructor(entries: MultiProxyEntry[], provider: DefaultServerProvider);
3262
+ acceptsRawInput?: boolean;
3263
+ /** Full command path from root to this processor */
3264
+ private readonly commandPath;
3265
+ constructor(entries: MultiProxyEntry[], provider: DefaultServerProvider, parentPath?: string[]);
2060
3266
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
2061
3267
  }
2062
3268
 
2063
- declare const CliServerManager_TOKEN = "cli-server-manager";
3269
+ declare const CliServerManager_TOKEN: any;
2064
3270
  declare class CliServerManager implements DefaultServerProvider {
2065
3271
  private readonly registry;
3272
+ private readonly authService?;
3273
+ private readonly events?;
2066
3274
  readonly connections: Map<string, CliServerConnection>;
2067
3275
  private _logger?;
3276
+ private _cliLogger?;
2068
3277
  private _defaultServer;
3278
+ /** Bare-name aliases this manager registered (only these are ever removed) */
3279
+ private readonly _bareAliases;
2069
3280
  private _backgroundServices?;
2070
- constructor(registry: ICliCommandProcessorRegistry);
3281
+ constructor(registry: ICliCommandProcessorRegistry, authService?: ICliServerAuthService, events?: ICliEventBus);
2071
3282
  get defaultServer(): string | null;
3283
+ preferredServer(): string | null;
2072
3284
  setDefaultServer(name: string | null): void;
2073
3285
  connectAll(servers: CliServerConfig[], logger?: {
2074
3286
  warn(msg: string): void;
2075
3287
  info(msg: string): void;
2076
- }, backgroundServices?: ICliBackgroundServiceRegistry): Promise<void>;
3288
+ }, backgroundServices?: ICliBackgroundServiceRegistry, cliLogger?: ICliLogger): Promise<void>;
2077
3289
  reconnect(name: string): Promise<{
2078
3290
  success: boolean;
2079
3291
  commandCount: number;
2080
3292
  }>;
2081
3293
  getConnection(name: string): CliServerConnection | undefined;
3294
+ private emitConnected;
2082
3295
  private handleDisconnect;
2083
3296
  private unregisterServerProcessors;
2084
3297
  private unregisterBareAliases;
@@ -2088,37 +3301,60 @@ declare class CliServerManager implements DefaultServerProvider {
2088
3301
 
2089
3302
  declare function createServerModule(): ICliModule;
2090
3303
 
3304
+ /**
3305
+ * `server`: the servers this terminal is connected to (configured by the
3306
+ * app in `options.servers`). Their commands are available directly (`echo`)
3307
+ * and namespaced (`node:echo`).
3308
+ */
2091
3309
  declare class CliServerCommandProcessor implements ICliCommandProcessor {
2092
3310
  command: string;
3311
+ aliases: string[];
2093
3312
  description: string;
2094
3313
  metadata: {
2095
- icon: CliIcon;
3314
+ icon: any;
2096
3315
  module: string;
2097
3316
  sealed: boolean;
2098
3317
  };
3318
+ stateConfiguration: CliStateConfiguration;
2099
3319
  processors: ICliCommandChildProcessor[];
3320
+ /** Restore the default server saved by `server default <name>`. */
3321
+ initialize(context: ICliExecutionContext): Promise<void>;
3322
+ /** `server` alone: the servers, then what can be done with them. */
2100
3323
  processCommand(_command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
3324
+ writeDescription(context: ICliExecutionContext): void;
2101
3325
  }
2102
3326
 
2103
3327
  declare class CliSshCommandProcessor implements ICliCommandProcessor {
2104
3328
  command: string;
3329
+ aliases: string[];
2105
3330
  description: string;
2106
3331
  acceptsRawInput: boolean;
2107
3332
  valueRequired: boolean;
2108
3333
  metadata: CliProcessorMetadata;
2109
- parameters?: ICliCommandParameterDescriptor[];
2110
- private socket;
2111
- private context;
3334
+ parameters?: ICliCommandParameterDescriptor$1[];
2112
3335
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
2113
- onData(data: string, context: ICliExecutionContext): Promise<void>;
2114
- onResize(cols: number, rows: number, _context: ICliExecutionContext): void;
2115
- onDispose(_context: ICliExecutionContext): void;
3336
+ /**
3337
+ * Full-screen handler for one session: input, resize and disposal go to
3338
+ * that session's socket only.
3339
+ */
3340
+ private fullScreenHandler;
2116
3341
  private resolveServer;
3342
+ /** Why `name` cannot be used: unknown, unreachable or without a shell. */
3343
+ private writeWhyNotAvailable;
3344
+ /** No server has a shell: say whether none is configured, connected or shell-enabled. */
3345
+ private writeNoShellServers;
3346
+ writeDescription(context: ICliExecutionContext): void;
2117
3347
  private executeInteractive;
2118
3348
  private executeOneShot;
3349
+ /** `ssh <server> <cmd...>` → `<cmd...>` exactly as typed */
3350
+ private remoteCommandFromRaw;
2119
3351
  private buildShellUrl;
2120
3352
  private cleanup;
2121
3353
  }
3354
+ declare function describeShellClose(event: {
3355
+ code?: number;
3356
+ reason?: string;
3357
+ }, serverName: string): string | null;
2122
3358
 
2123
3359
  /**
2124
3360
  * Result of executing a command through the test harness.
@@ -2164,20 +3400,30 @@ declare class CliTestHarness {
2164
3400
  readonly registry: CliCommandProcessorRegistry;
2165
3401
  readonly executor: CliCommandExecutor;
2166
3402
  readonly services: CliServiceContainer;
3403
+ /** Shared by every command: add a language pack and switch locale to test translations. */
3404
+ readonly translator: CliTranslationService;
2167
3405
  private readonly stateStoreManager;
3406
+ private readonly initialized;
2168
3407
  private readonly processRegistry;
2169
3408
  /** Current user session — set via setUserSession() */
2170
3409
  userSession?: ICliUserSession;
2171
3410
  /** Reader responses — set via setReaderResponses() for interactive commands */
2172
3411
  private readerResponses;
3412
+ private userSessionProvider?;
2173
3413
  constructor();
3414
+ /**
3415
+ * Resolve `context.userSession` on every command from this function
3416
+ * (e.g. a session service), instead of the value set via setUserSession().
3417
+ */
3418
+ setUserSessionProvider(provider: () => ICliUserSession | undefined): void;
2174
3419
  /**
2175
3420
  * Register a service in the test container.
2176
3421
  */
2177
3422
  registerService(token: any, value: any): void;
2178
3423
  /**
2179
3424
  * Register a command processor. If the processor has an `initialize()`
2180
- * method, it will be called with a context wired to the harness services.
3425
+ * method, it is called (with the processor's own state store, as in the
3426
+ * engine) before the first `execute()`, or by `initializeProcessors()`.
2181
3427
  */
2182
3428
  registerProcessor(processor: ICliCommandProcessor): void;
2183
3429
  /**
@@ -2189,6 +3435,8 @@ declare class CliTestHarness {
2189
3435
  * Call this after registering all services and processors.
2190
3436
  */
2191
3437
  initializeProcessors(): Promise<void>;
3438
+ /** As the engine's boot: link sub-commands to their parent, then initialize. */
3439
+ private initializeTree;
2192
3440
  /**
2193
3441
  * Set the active user session. Commands that check `context.userSession`
2194
3442
  * will see this session.
@@ -2263,4 +3511,511 @@ declare function getAccelerator(): ICliWasmAccelerator;
2263
3511
  */
2264
3512
  declare function isWasmAccelerated(): boolean;
2265
3513
 
2266
- 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, 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, 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, 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 };
3514
+ /** One terminal inside a tab. */
3515
+ interface CliPanelPane {
3516
+ id: number;
3517
+ widthPercent: number;
3518
+ /** Snapshot to restore when the pane's engine starts (used by "Duplicate"). */
3519
+ snapshot?: CliEngineSnapshot;
3520
+ }
3521
+ /** One tab of the panel: a title and one or more panes side by side. */
3522
+ interface CliPanelTab {
3523
+ id: number;
3524
+ title: string;
3525
+ isEditing: boolean;
3526
+ panes: CliPanelPane[];
3527
+ }
3528
+ interface CliPanelContextMenu {
3529
+ visible: boolean;
3530
+ x: number;
3531
+ y: number;
3532
+ tabId: number;
3533
+ }
3534
+ interface CliPanelServiceDetail {
3535
+ name: string;
3536
+ status: string;
3537
+ description?: string;
3538
+ }
3539
+ interface CliPanelServerDetail {
3540
+ name: string;
3541
+ url: string;
3542
+ connected: boolean;
3543
+ apiVersion?: string;
3544
+ commandCount?: number;
3545
+ }
3546
+ type CliPanelExecutionState = 'idle' | 'running';
3547
+ type CliPanelServerState = 'connected' | 'disconnected' | 'none';
3548
+ /** Status derived from the engines of a single tab. */
3549
+ interface CliPanelTabStatus {
3550
+ executionState: CliPanelExecutionState;
3551
+ lastCommand: {
3552
+ name: string;
3553
+ success: boolean;
3554
+ } | null;
3555
+ notification: CliNotification | null;
3556
+ }
3557
+ /** Status derived from the first engine of the active tab. */
3558
+ interface CliPanelGlobalStatus {
3559
+ serviceCount: {
3560
+ running: number;
3561
+ total: number;
3562
+ };
3563
+ serviceDetails: CliPanelServiceDetail[];
3564
+ serverState: CliPanelServerState;
3565
+ serverDetails: CliPanelServerDetail[];
3566
+ /** Milliseconds since the engine started, 0 when unknown. */
3567
+ uptime: number;
3568
+ }
3569
+ declare const DEFAULT_TAB_STATUS: CliPanelTabStatus;
3570
+ declare const DEFAULT_GLOBAL_STATUS: CliPanelGlobalStatus;
3571
+ /**
3572
+ * Values a host may control from the outside. A defined value wins over the
3573
+ * panel's own state; `undefined` leaves the panel uncontrolled for that field.
3574
+ */
3575
+ interface CliPanelControlledState {
3576
+ collapsed?: boolean;
3577
+ hidden?: boolean;
3578
+ maximized?: boolean;
3579
+ activeTabId?: number;
3580
+ position?: CliPanelPosition;
3581
+ height?: number;
3582
+ width?: number;
3583
+ }
3584
+ /** Change notifications and structural events, mapped by each framework wrapper. */
3585
+ interface CliPanelCallbacks {
3586
+ onCollapsedChange?: (collapsed: boolean) => void;
3587
+ onHiddenChange?: (hidden: boolean) => void;
3588
+ onMaximizedChange?: (maximized: boolean) => void;
3589
+ onActiveTabIdChange?: (tabId: number) => void;
3590
+ onPositionChange?: (position: CliPanelPosition) => void;
3591
+ onHeightChange?: (height: number) => void;
3592
+ onWidthChange?: (width: number) => void;
3593
+ onClose?: () => void;
3594
+ onTabAdded?: (event: {
3595
+ tabId: number;
3596
+ }) => void;
3597
+ onTabClosed?: (event: {
3598
+ tabId: number;
3599
+ }) => void;
3600
+ onPaneSplit?: (event: {
3601
+ paneId: number;
3602
+ tabId: number;
3603
+ }) => void;
3604
+ onPaneClosed?: (event: {
3605
+ paneId: number;
3606
+ }) => void;
3607
+ }
3608
+ interface CliPanelViewport {
3609
+ width: number;
3610
+ height: number;
3611
+ }
3612
+ interface CliPanelControllerOptions {
3613
+ /** Panel configuration (initial state, chrome buttons, theme sync). */
3614
+ config?: CliPanelConfig;
3615
+ callbacks?: CliPanelCallbacks;
3616
+ controlled?: CliPanelControlledState;
3617
+ /** Viewport size used for maximize and resize clamping. Defaults to `window`. */
3618
+ viewport?: () => CliPanelViewport;
3619
+ /**
3620
+ * Restore and persist the position through localStorage.
3621
+ * @default true
3622
+ */
3623
+ persistPosition?: boolean;
3624
+ }
3625
+ /**
3626
+ * Immutable view of the whole panel. A new object is produced on every
3627
+ * change, so views can compare by reference.
3628
+ */
3629
+ interface CliPanelSnapshot {
3630
+ visible: boolean;
3631
+ /** True once the first tab has been created (content rendered). */
3632
+ initialized: boolean;
3633
+ collapsed: boolean;
3634
+ hidden: boolean;
3635
+ maximized: boolean;
3636
+ position: CliPanelPosition;
3637
+ height: number;
3638
+ width: number;
3639
+ isHorizontal: boolean;
3640
+ /** Status text is shown in the header for top/bottom, compact dots otherwise. */
3641
+ showStatusIndicators: boolean;
3642
+ panelResizing: boolean;
3643
+ themeStyles: Record<string, string>;
3644
+ closable: boolean;
3645
+ resizable: boolean;
3646
+ hideable: boolean;
3647
+ hideAlignment: CliPanelHideAlignment;
3648
+ syncTheme: boolean;
3649
+ tabs: readonly CliPanelTab[];
3650
+ activeTabId: number;
3651
+ activePaneId: number;
3652
+ paneResizing: boolean;
3653
+ contextMenu: CliPanelContextMenu;
3654
+ positionDropdownOpen: boolean;
3655
+ servicesDropdownOpen: boolean;
3656
+ servicesDropdownStyle: Record<string, string>;
3657
+ serversDropdownOpen: boolean;
3658
+ serversDropdownStyle: Record<string, string>;
3659
+ /** Status of the active tab. */
3660
+ status: CliPanelTabStatus;
3661
+ tabStatuses: Readonly<Record<number, CliPanelTabStatus>>;
3662
+ global: CliPanelGlobalStatus;
3663
+ formattedUptime: string;
3664
+ }
3665
+
3666
+ declare const MIN_PANE_WIDTH_PERCENT = 10;
3667
+ declare const MIN_PANEL_SIZE = 100;
3668
+ declare const DEFAULT_PANEL_HEIGHT = 600;
3669
+ declare const DEFAULT_PANEL_WIDTH = 400;
3670
+ declare const PANEL_POSITIONS: readonly CliPanelPosition[];
3671
+ /** Scale pane widths so they add up to 100. Returns new pane objects. */
3672
+ declare function normalizePaneWidths(panes: readonly CliPanelPane[]): CliPanelPane[];
3673
+ /** Give every pane the same width. Returns new pane objects. */
3674
+ declare function distributePaneWidths(panes: readonly CliPanelPane[]): CliPanelPane[];
3675
+ /**
3676
+ * Move the divider between pane `dividerIndex` and `dividerIndex + 1` by
3677
+ * `deltaPercent`, keeping both panes at least `MIN_PANE_WIDTH_PERCENT` wide.
3678
+ */
3679
+ declare function resizePaneWidths(startWidths: readonly number[], dividerIndex: number, deltaPercent: number): number[];
3680
+ /** Clamp a dragged panel size between the minimum and the viewport. */
3681
+ declare function clampPanelSize(size: number, max: number): number;
3682
+ /**
3683
+ * New panel size for a drag that started at `start` and moved by
3684
+ * (`deltaX`, `deltaY`). Only the axis matching the position matters.
3685
+ */
3686
+ declare function resizedPanelSize(position: CliPanelPosition, start: {
3687
+ width: number;
3688
+ height: number;
3689
+ }, deltaX: number, deltaY: number, viewport: CliPanelViewport): {
3690
+ width?: number;
3691
+ height?: number;
3692
+ };
3693
+ interface AnchorRect {
3694
+ top: number;
3695
+ bottom: number;
3696
+ left: number;
3697
+ right: number;
3698
+ }
3699
+ /**
3700
+ * Fixed-position style for a dropdown opened from `anchor`, placed on the
3701
+ * side of the panel that faces the page.
3702
+ */
3703
+ declare function dropdownAnchorStyle(anchor: AnchorRect, position: CliPanelPosition, viewport: CliPanelViewport): Record<string, string>;
3704
+ /** "12m", "1h05m"-style uptime label. */
3705
+ declare function formatUptime(ms: number): string;
3706
+ declare function isHorizontalPosition(position: CliPanelPosition): boolean;
3707
+
3708
+ /** Poll interval for execution state, last command and notifications. */
3709
+ declare const EXEC_POLL_MS = 300;
3710
+ /** Poll interval for services, servers and uptime. */
3711
+ declare const GLOBAL_POLL_MS = 2000;
3712
+ /** Status of a tab from all of its pane engines. */
3713
+ declare function computeTabStatus(engines: Iterable<CliEngine>): CliPanelTabStatus;
3714
+ /** Services, servers and uptime of one engine. */
3715
+ declare function computeGlobalStatus(engine: CliEngine | undefined, now?: number): CliPanelGlobalStatus;
3716
+ interface CliPanelStatusTrackerListener {
3717
+ onTabStatus(tabId: number, status: CliPanelTabStatus): void;
3718
+ onGlobalStatus(status: CliPanelGlobalStatus): void;
3719
+ }
3720
+ /**
3721
+ * Watches the engines of every tab and reports status changes. Execution
3722
+ * state is polled quickly, services and servers slowly; engine events
3723
+ * (notifier, background services) trigger an immediate refresh.
3724
+ */
3725
+ declare class CliPanelStatusTracker {
3726
+ private readonly listener;
3727
+ private tabs;
3728
+ private activeTabId?;
3729
+ private globalStatus;
3730
+ private execTimer?;
3731
+ private globalTimer?;
3732
+ constructor(listener: CliPanelStatusTrackerListener);
3733
+ registerEngine(tabId: number, paneId: number, engine: CliEngine): void;
3734
+ unregisterPane(paneId: number): void;
3735
+ unregisterTab(tabId: number): void;
3736
+ setActiveTab(tabId: number): void;
3737
+ /** Recompute everything now. */
3738
+ refresh(): void;
3739
+ destroy(): void;
3740
+ private ensurePolling;
3741
+ private stopPolling;
3742
+ private refreshTab;
3743
+ private refreshGlobal;
3744
+ }
3745
+
3746
+ /**
3747
+ * Framework-agnostic state and behaviour of the collapsible CLI panel:
3748
+ * tabs and panes, chrome (collapse, hide, maximize, position, size),
3749
+ * menus, drag resizing, theme sync and the status bar.
3750
+ *
3751
+ * Views subscribe with {@link subscribe} and render {@link getSnapshot};
3752
+ * every change produces a new immutable snapshot. Hosts may control any of
3753
+ * the bindable values through {@link setControlled}; the matching
3754
+ * `onXChange` callback is invoked whenever the panel wants to change it.
3755
+ */
3756
+ declare class CliPanelController implements ICliPanelRef<CliEngine> {
3757
+ callbacks: CliPanelCallbacks;
3758
+ private snapshot;
3759
+ private internal;
3760
+ private controlled;
3761
+ private readonly listeners;
3762
+ private readonly engines;
3763
+ private readonly tracker;
3764
+ private readonly viewport;
3765
+ private readonly persistPosition;
3766
+ private nextTabId;
3767
+ private nextPaneId;
3768
+ private preHideCollapsed;
3769
+ private previousHeight;
3770
+ private previousWidth;
3771
+ private panelDrag?;
3772
+ private paneDrag?;
3773
+ private documentListenersAttached;
3774
+ private rootElement;
3775
+ private themeObserver?;
3776
+ constructor(options?: CliPanelControllerOptions);
3777
+ readonly subscribe: (listener: () => void) => (() => void);
3778
+ readonly getSnapshot: () => CliPanelSnapshot;
3779
+ /** Apply a new panel configuration (chrome buttons, theme sync). */
3780
+ setOptions(config: CliPanelConfig | undefined): void;
3781
+ /** Replace the change callbacks (wrappers call this when their props change). */
3782
+ setCallbacks(callbacks: CliPanelCallbacks): void;
3783
+ /** Update host-controlled values. Unchanged values are ignored. */
3784
+ setControlled(values: CliPanelControlledState): void;
3785
+ /** Element containing the terminals, used for theme sync. */
3786
+ setRootElement(element: ParentNode | null): void;
3787
+ /**
3788
+ * Stop timers, observers and document listeners. Engines are not
3789
+ * destroyed (their views own them). Registering an engine again
3790
+ * restarts status tracking, so a remounted view can reuse the controller.
3791
+ */
3792
+ destroy(): void;
3793
+ /** Header collapse button: expand (creating the first tab) or collapse. */
3794
+ toggle(): void;
3795
+ open(): void;
3796
+ collapse(): void;
3797
+ toggleCollapse(): void;
3798
+ hide(): void;
3799
+ unhide(): void;
3800
+ toggleHide(): void;
3801
+ close(): void;
3802
+ maximize(): void;
3803
+ restore(): void;
3804
+ toggleMaximize(): void;
3805
+ resize(dimensions: {
3806
+ height?: number;
3807
+ width?: number;
3808
+ }): void;
3809
+ setPosition(position: CliPanelPosition): void;
3810
+ addTab(title?: string): number;
3811
+ closeTab(tabId: number): void;
3812
+ selectTab(tabId: number): void;
3813
+ renameTab(tabId: number, title: string): void;
3814
+ /** Switch a tab's title into inline editing. */
3815
+ startRename(tabId: number): void;
3816
+ /** Finish inline editing; an empty value keeps the old title. */
3817
+ commitRename(tabId: number, value: string): void;
3818
+ cancelRename(): void;
3819
+ /** Open a new tab next to `tabId` with a copy of its first terminal's content. */
3820
+ duplicateTab(tabId: number): number;
3821
+ closeOtherTabs(tabId: number): void;
3822
+ closeTabsToTheRight(tabId: number): void;
3823
+ closeAllTabs(): void;
3824
+ splitPane(tabId?: number): number;
3825
+ closePane(paneId: number): void;
3826
+ /** A pane was clicked: make it (and its tab) active and focus its terminal. */
3827
+ activatePane(tabId: number, paneId: number): void;
3828
+ /** Called by the view once a pane's terminal engine is running. */
3829
+ registerEngine(tabId: number, paneId: number, engine: CliEngine): void;
3830
+ getEngine(paneId?: number): CliEngine | undefined;
3831
+ getState(): CliPanelState;
3832
+ openContextMenu(tabId: number, x: number, y: number): void;
3833
+ closeContextMenu(): void;
3834
+ togglePositionDropdown(): void;
3835
+ /** `anchor` is the clicked status item; the dropdown is placed next to it. */
3836
+ toggleServicesDropdown(anchor?: Element | null): void;
3837
+ toggleServersDropdown(anchor?: Element | null): void;
3838
+ /** Close the context menu and every dropdown. */
3839
+ closeMenus(): void;
3840
+ /** Mouse down on the panel's resize bar. */
3841
+ startPanelResize(clientX: number, clientY: number): void;
3842
+ /** Mouse down on the divider before pane `dividerIndex + 1` of a tab. */
3843
+ startPaneResize(tabId: number, dividerIndex: number, clientX: number, containerWidth: number): void;
3844
+ private readonly onPanelResizeMove;
3845
+ private readonly onPanelResizeEnd;
3846
+ private endPanelResize;
3847
+ private readonly onPaneResizeMove;
3848
+ private readonly onPaneResizeEnd;
3849
+ private endPaneResize;
3850
+ private readonly onDocumentClick;
3851
+ private readonly onDocumentKeydown;
3852
+ private syncDocumentListeners;
3853
+ private detachDocumentListeners;
3854
+ /** Read the first terminal's theme and derive the panel colours from it. */
3855
+ syncThemeFromEngine(): void;
3856
+ /**
3857
+ * Sync now and follow the first terminal's container: the `theme`
3858
+ * command restyles it, which re-derives the panel colours.
3859
+ * Engines are registered after they start, so their theme is set.
3860
+ */
3861
+ private startThemeSync;
3862
+ private stopThemeSync;
3863
+ private ensureInitialized;
3864
+ private updateCollapsed;
3865
+ private updateHidden;
3866
+ private updateMaximized;
3867
+ private updateHeight;
3868
+ private updateWidth;
3869
+ private updateActiveTabId;
3870
+ private findTab;
3871
+ private patchTab;
3872
+ /** Remove tabs without touching collapsed/initialized state. */
3873
+ private removeTabs;
3874
+ private releaseTab;
3875
+ private releasePane;
3876
+ private focusPane;
3877
+ private anchorStyle;
3878
+ private setTabStatus;
3879
+ private configFields;
3880
+ /** Resolve controlled values and derived fields on top of a snapshot. */
3881
+ private derive;
3882
+ private commit;
3883
+ }
3884
+
3885
+ /**
3886
+ * Geometry of the panel's SVG icons, shared by every framework wrapper.
3887
+ * All icons use a 24x24 view box, `stroke="currentColor"`, round caps and
3888
+ * joins, and no fill unless a shape says otherwise.
3889
+ */
3890
+ interface SvgShape {
3891
+ tag: 'polyline' | 'line' | 'rect';
3892
+ attrs: Record<string, string>;
3893
+ }
3894
+ interface SvgIcon {
3895
+ size: number;
3896
+ strokeWidth: number;
3897
+ shapes: SvgShape[];
3898
+ }
3899
+ declare const SVG_VIEW_BOX = "0 0 24 24";
3900
+ declare const SVG_COMMON_ATTRS: Record<string, string>;
3901
+ declare const TERMINAL_ICON: SvgIcon;
3902
+ declare const HIDE_TAB_TERMINAL_ICON: SvgIcon;
3903
+ declare const MAXIMIZE_ICON: SvgIcon;
3904
+ declare const RESTORE_ICON: SvgIcon;
3905
+ declare const CLOSE_ICON: SvgIcon;
3906
+ declare const HIDE_ICON: SvgIcon;
3907
+ /** Chevron that points where the panel body will go when the collapse button is pressed. */
3908
+ declare function collapseChevronIcon(position: CliPanelPosition, collapsed: boolean): SvgIcon;
3909
+ /** Chevron on the small "show CLI" tab, pointing into the page. */
3910
+ declare function hideTabChevronIcon(position: CliPanelPosition): SvgIcon;
3911
+ /** Square with a filled bar on the side the panel is docked to. */
3912
+ declare function positionIcon(position: CliPanelPosition, size?: number): SvgIcon;
3913
+ /** Attributes for the `<svg>` element of an icon. */
3914
+ declare function svgAttrs(icon: SvgIcon): Record<string, string>;
3915
+
3916
+ /**
3917
+ * View helpers shared by the React, Vue and Angular panels: class names,
3918
+ * inline styles, labels and the lists the header and menus are built from.
3919
+ */
3920
+ declare const PANEL_LABELS: {
3921
+ readonly title: "CLI";
3922
+ readonly showCli: "Show CLI";
3923
+ readonly movePanel: "Move panel";
3924
+ readonly hide: "Hide";
3925
+ readonly maximize: "Maximize";
3926
+ readonly restore: "Restore";
3927
+ readonly expand: "Expand";
3928
+ readonly collapse: "Collapse";
3929
+ readonly close: "Close";
3930
+ readonly newTerminal: "New terminal";
3931
+ readonly closeTab: "Close tab";
3932
+ readonly closePane: "Close pane";
3933
+ readonly servicesHeader: "Background Services";
3934
+ readonly servicesEmpty: "No services registered";
3935
+ readonly serversHeader: "Server Connections";
3936
+ readonly serversEmpty: "No servers configured";
3937
+ };
3938
+ declare const SERVICES_ICON = "\u2699";
3939
+ declare const UPTIME_ICON = "\u2191";
3940
+ declare const SUCCESS_ICON = "\u2713";
3941
+ declare const ERROR_ICON = "\u2717";
3942
+ declare const CLOSE_GLYPH = "\u00D7";
3943
+ declare function capitalize(value: string): string;
3944
+ declare function joinClasses(...classes: Array<string | false | null | undefined>): string;
3945
+ declare function panelWrapperClass(s: CliPanelSnapshot, extra?: string): string;
3946
+ declare function panelTabClass(s: CliPanelSnapshot, tab: CliPanelTab): string;
3947
+ /** Activity dot of a tab: running, last command failed, or idle. */
3948
+ declare function tabDotClass(status: CliPanelTabStatus | undefined): string;
3949
+ declare function panelTabDotClass(s: CliPanelSnapshot, tab: CliPanelTab): string;
3950
+ declare function panesContainerClass(s: CliPanelSnapshot): string;
3951
+ declare function paneClass(s: CliPanelSnapshot, tabId: number, paneId: number): string;
3952
+ declare function glowLineClass(s: CliPanelSnapshot): string;
3953
+ declare function positionDropdownItemClass(s: CliPanelSnapshot, position: CliPanelPosition): string;
3954
+ /** Size, visibility and theme variables of the panel wrapper. */
3955
+ declare function panelWrapperStyle(s: CliPanelSnapshot): Record<string, string>;
3956
+ declare function paneStyle(widthPercent: number): Record<string, string>;
3957
+ declare function contextMenuStyle(s: CliPanelSnapshot): Record<string, string>;
3958
+ interface PanelStatusIndicator {
3959
+ key: 'execution' | 'services' | 'lastCommand' | 'servers' | 'uptime' | 'notification';
3960
+ /** Extra classes on the full item (top/bottom positions). */
3961
+ itemClass: string;
3962
+ /** Extra classes on the compact item (left/right positions). */
3963
+ compactClass: string;
3964
+ /** Class of the leading dot, when the indicator shows a dot. */
3965
+ dotClass?: string;
3966
+ /** Glyph shown before the label, when the indicator shows an icon. */
3967
+ icon?: string;
3968
+ iconClass?: string;
3969
+ label: string;
3970
+ /** Tooltip of the compact variant. */
3971
+ title: string;
3972
+ /** Compact variant shows only this dot (notifications). */
3973
+ compactDotClass?: string;
3974
+ /** Which dropdown a click opens. */
3975
+ dropdown?: 'services' | 'servers';
3976
+ }
3977
+ /** Items of the header status bar, in display order. */
3978
+ declare function statusIndicators(s: CliPanelSnapshot): PanelStatusIndicator[];
3979
+ interface PanelPositionOption {
3980
+ position: CliPanelPosition;
3981
+ label: string;
3982
+ className: string;
3983
+ }
3984
+ declare function positionOptions(s: CliPanelSnapshot): PanelPositionOption[];
3985
+ type PanelContextMenuAction = 'rename' | 'duplicate' | 'split-right' | 'close' | 'close-others' | 'close-right' | 'close-all';
3986
+ interface PanelContextMenuItem {
3987
+ action: PanelContextMenuAction;
3988
+ label: string;
3989
+ disabled: boolean;
3990
+ destructive: boolean;
3991
+ /** Draw a separator above this item. */
3992
+ separatorBefore: boolean;
3993
+ }
3994
+ declare function contextMenuItems(s: CliPanelSnapshot): PanelContextMenuItem[];
3995
+ /** Run a context-menu action against the tab the menu was opened for. */
3996
+ declare function runContextMenuAction(controller: CliPanelController, action: PanelContextMenuAction): void;
3997
+ /** Enter commits, Escape cancels an inline tab rename. */
3998
+ declare function handleRenameKey(controller: CliPanelController, tabId: number, key: string, value: string): void;
3999
+ /** Width of the panes container the divider belongs to, for drag math. */
4000
+ declare function panesContainerWidth(target: EventTarget | null): number;
4001
+ interface PanelDropdownRow {
4002
+ key: string;
4003
+ dotClass: string;
4004
+ name: string;
4005
+ description?: string;
4006
+ status: string;
4007
+ /** Extra lines under the status (servers: API version, command count). */
4008
+ meta: string[];
4009
+ }
4010
+ interface PanelStatusDropdown {
4011
+ kind: 'services' | 'servers';
4012
+ header: string;
4013
+ emptyText: string;
4014
+ style: Record<string, string>;
4015
+ rows: PanelDropdownRow[];
4016
+ }
4017
+ /** The open services or servers dropdown, or null when neither is open. */
4018
+ declare function openStatusDropdown(s: CliPanelSnapshot): PanelStatusDropdown | null;
4019
+
4020
+ export { API_VERSION, CLI_ENV_GLOBAL_PERMISSION, CLI_FRAMEWORK_SERVICE, CLOSE_GLYPH, CLOSE_ICON, CapturingTerminalWriter, CliAliasCommandProcessor, CliArgsParser, CliBackgroundServiceRegistry_TOKEN, CliBoot, CliBootLog, CliBootLog_TOKEN, CliCalCommandProcessor, CliCaptureCommandProcessor, CliClearCommandProcessor, CliClipboard, CliClipboardCommandProcessor, CliColorCommandProcessor, CliCommandExecutionContext, CliCommandExecutor, CliCommandHistory, CliCommandHistory_TOKEN, CliCommandProcessorRegistry, CliConfigureCommandProcessor, CliConvertCommandProcessor, CliDebugCommandProcessor, CliDefaultPingServerService, CliDiffCommandProcessor, CliDragDropService, CliEchoCommandProcessor, CliEngine, CliEnvCommandProcessor, CliEnvironment, CliEvalCommandProcessor, CliEventsCommandProcessor, CliExecutionContext, CliExecutionProcess, CliExportCommandProcessor, CliFalseCommandProcessor, CliFeedbackCommandProcessor, CliFontSizeCommandProcessor, CliFullScreenManager, CliHelpCommandProcessor, CliHistoryCommandProcessor, CliHotKeysCommandProcessor, CliHtopCommandProcessor, CliHttpClient, CliInputReader, CliJsonCommandProcessor, CliKeyValueStore, CliKeyValueStore_TOKEN, CliKillCommandProcessor, CliLogger, CliLoremCommandProcessor, CliModuleRegistry_TOKEN, CliNanoCommandProcessor, CliNotifier, CliOpenCommandProcessor, CliPackageManagerService, CliPackageManagerService_TOKEN, CliPackagesCommandProcessor, CliPanelController, CliPanelStatusTracker, CliPermissionRegistry, CliPingCommandProcessor, CliProcessRegistry, CliProcessRegistry_TOKEN, CliProcessorsRegistry_TOKEN, CliPsCommandProcessor, CliRandomCommandProcessor, CliScreenCommandProcessor, CliScriptSyntaxError, CliSeqCommandProcessor, CliServerCommandProcessor, CliServerConnection, CliServerManager, CliServerManager_TOKEN, CliServerMultiProxyProcessor, CliServerProxyProcessor, CliServiceContainer, CliServicesCommandProcessor, CliSleepCommandProcessor, CliSnippetCommandProcessor, CliSshCommandProcessor, CliStateStore, CliStateStoreManager, CliStateStoreManager_TOKEN, CliTerminalProgressBar, CliTerminalSpinner, CliTerminalTextAnimator, CliTerminalWriter, CliTestCommandProcessor, CliTestHarness, CliThemeCommandProcessor, CliTimeCommandProcessor, CliTimerManager, CliTimestampCommandProcessor, CliTrueCommandProcessor, CliUnAliasCommandProcessor, CliUnameCommandProcessor, CliUnsetCommandProcessor, CliUptimeCommandProcessor, CliVersionCommandProcessor, CliYesCommandProcessor, CommandParser, DEFAULT_GLOBAL_STATUS, DEFAULT_PANEL_HEIGHT, DEFAULT_PANEL_WIDTH, DEFAULT_TAB_STATUS, ERROR_ICON, EXEC_POLL_MS, GLOBAL_POLL_MS, HIDE_ICON, HIDE_TAB_TERMINAL_ICON, ICliEnvironment_TOKEN, ICliPingServerService_TOKEN, ICliScriptRunner_TOKEN, JsFallbackAccelerator, LIBRARY_VERSION, MAXIMIZE_ICON, MIN_PANEL_SIZE, MIN_PANE_WIDTH_PERCENT, OverlayAddon, PANEL_LABELS, PANEL_POSITIONS, ProcessExitedError, RESTORE_ICON, SERVICES_ICON, SUCCESS_ICON, SVG_COMMON_ATTRS, SVG_VIEW_BOX, ScriptLoaderService, SyntaxHighlighterRegistry_TOKEN, TERMINAL_ICON, UPTIME_ICON, appendOutputToFile, appendStderrToFile, applyEnvironmentChange, builtinProcessors, capitalize, clampPanelSize, cliScriptRunner, collapseChevronIcon, computeDiff, computeGlobalStatus, computeTabStatus, contextGlobalParameter, contextMenuItems, contextMenuStyle, createCliEngine, createServerModule, defaultFontSize, describeShellClose, distributePaneWidths, dropdownAnchorStyle, executeOnServer, expandBraces, expandEnvironmentVars, expandGlobs, formatDiff, formatUptime, getAccelerator, getCliNameArt, getGreetingBasedOnTime, getTerminalOptions, glowLineClass, greetingModule, groupBy, handleRenameKey, helpGlobalParameter, hideTabChevronIcon, hotkeysInfo, initWasmAccelerator, initializeServices, initializeTerminal, isHorizontalPosition, isWasmAccelerated, joinClasses, matchGlob, mergeCliOptions, miscProcessors, normalizePaneWidths, openLink, openStatusDropdown, paneClass, paneStyle, panelTabClass, panelTabDotClass, panelWrapperClass, panelWrapperStyle, panesContainerClass, panesContainerWidth, parseAssignments, parseScript, positionDropdownItemClass, positionIcon, positionOptions, reconcileArgs, renderServerResponse, renderSingleOutput, resizePaneWidths, resizedPanelSize, resolveCliHostConfig, runContextMenuAction, runScript, splitWords, statusIndicators, substituteCommands, substituteVars, svgAttrs, systemProcessors, tabDotClass, themeInfos, themes, tryExecuteScript, versionGlobalParameter, waitForLayout, welcomeModule, writeOutputToFile, writeStderrToFile };
4021
+ export type { AnchorRect, CdnSourceName, CliBootLogOptions, CliEngineOptions, CliEnvironmentChange, CliEnvironmentProfile, CliEnvironmentScope, CliEnvironmentSnapshot, CliEnvironmentSource, CliExecutionContextDeps, CliHostConfig, CliPanelCallbacks, CliPanelContextMenu, CliPanelControlledState, CliPanelControllerOptions, CliPanelExecutionState, CliPanelGlobalStatus, CliPanelPane, CliPanelServerDetail, CliPanelServerState, CliPanelServiceDetail, CliPanelSnapshot, CliPanelStatusTrackerListener, CliPanelTab, CliPanelTabStatus, CliPanelViewport, CliTestResult, CliWelcomeMessageConfig, CommandParserOutput, CommandPart, ConfigureState, CreateCliEngineConfig, DefaultServerProvider, DiffLine, DiffType, ICliEnvironment, ICliExecutionHost, ICliScriptRunOptions, ICliScriptRunner, ICliStateStoreManager, ICliWasmAccelerator, InitializeServicesOptions, InitializeServicesResult, MultiProxyEntry, PanelContextMenuAction, PanelContextMenuItem, PanelDropdownRow, PanelPositionOption, PanelStatusDropdown, PanelStatusIndicator, ParsedArg, ParsedToken, SvgIcon, SvgShape, TerminalSetupResult, ThemeState };